diff --git a/client/implementation/op_snapshots_create.go b/client/implementation/op_snapshots_create.go index 72b9d15..05a0a14 100644 --- a/client/implementation/op_snapshots_create.go +++ b/client/implementation/op_snapshots_create.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/radekg/yugabyte-db-go-client/configs" + "github.com/radekg/yugabyte-db-go-client/utils" "github.com/radekg/yugabyte-db-go-client/utils/ybdbid" ybApi "github.com/radekg/yugabyte-db-go-proto/v2/yb/api" ) @@ -79,15 +80,9 @@ func createSnapshotYCQL(c *defaultYBCliClient, opConfig *configs.OpSnapshotCreat } payload := &ybApi.CreateSnapshotRequestPB{ - Tables: tableIdentifiers, - AddIndexes: func() *bool { - v := true // https://github.com/yugabyte/yugabyte-db/blob/d4d5688147734d1a36bbe58430f35ba4db2770f1/ent/src/yb/tools/yb-admin_cli_ent.cc#L119 - return &v - }(), - TransactionAware: func() *bool { - v := true // https://github.com/yugabyte/yugabyte-db/blob/d4d5688147734d1a36bbe58430f35ba4db2770f1/ent/src/yb/tools/yb-admin_client_ent.cc#L247 - return &v - }(), + Tables: tableIdentifiers, + AddIndexes: utils.PBool(true), // https://github.com/yugabyte/yugabyte-db/blob/d4d5688147734d1a36bbe58430f35ba4db2770f1/ent/src/yb/tools/yb-admin_cli_ent.cc#L119 + TransactionAware: utils.PBool(true), // https://github.com/yugabyte/yugabyte-db/blob/d4d5688147734d1a36bbe58430f35ba4db2770f1/ent/src/yb/tools/yb-admin_client_ent.cc#L247 } responsePayload := &ybApi.CreateSnapshotResponsePB{} @@ -119,17 +114,12 @@ func createSnapshotYSQL(c *defaultYBCliClient, opConfig *configs.OpSnapshotCreat payload := &ybApi.CreateSnapshotRequestPB{ Tables: tableIdentifiers, - AddIndexes: func() *bool { - v := false - return &v - }(), - // CreateSnapshot called from https://github.com/yugabyte/yugabyte-db/blob/d4d5688147734d1a36bbe58430f35ba4db2770f1/ent/src/yb/tools/yb-admin_client_ent.cc#L288 + // CreateSnapshot called with add_indexes=false + // from https://github.com/yugabyte/yugabyte-db/blob/d4d5688147734d1a36bbe58430f35ba4db2770f1/ent/src/yb/tools/yb-admin_client_ent.cc#L288 // and always sets transaction aware to true: // https://github.com/yugabyte/yugabyte-db/blob/d4d5688147734d1a36bbe58430f35ba4db2770f1/ent/src/yb/tools/yb-admin_client_ent.cc#L247 - TransactionAware: func() *bool { - v := true - return &v - }(), + AddIndexes: utils.PBool(false), + TransactionAware: utils.PBool(true), } responsePayload := &ybApi.CreateSnapshotResponsePB{} diff --git a/client/implementation/op_snapshots_export.go b/client/implementation/op_snapshots_export.go index 79e1195..cc3fe2c 100644 --- a/client/implementation/op_snapshots_export.go +++ b/client/implementation/op_snapshots_export.go @@ -30,11 +30,8 @@ func (c *defaultYBCliClient) SnapshotsExport(opConfig *configs.OpSnapshotExportC } payload := &ybApi.ListSnapshotsRequestPB{ - PrepareForBackup: func() *bool { - v := true - return &v - }(), - SnapshotId: ybDbID.Bytes(), + PrepareForBackup: utils.PBool(true), + SnapshotId: ybDbID.Bytes(), } responsePayload := &ybApi.ListSnapshotsResponsePB{} if err := c.connectedClient.Execute(payload, responsePayload); err != nil {