diff --git a/go/cmd/vtctl/vtctl.go b/go/cmd/vtctl/vtctl.go index 9f6d7136d0b..23e3f034882 100644 --- a/go/cmd/vtctl/vtctl.go +++ b/go/cmd/vtctl/vtctl.go @@ -45,9 +45,9 @@ import ( ) var ( - waitTime = flag.Duration("wait-time", 24*time.Hour, "time to wait on an action") - detachedMode = flag.Bool("detach", false, "detached mode - run vtcl detached from the terminal") - durability = flag.String("durability", "none", "type of durability to enforce. Default is none. Other values are dictated by registered plugins") + waitTime = flag.Duration("wait-time", 24*time.Hour, "time to wait on an action") + detachedMode = flag.Bool("detach", false, "detached mode - run vtcl detached from the terminal") + durabilityPolicy = flag.String("durability_policy", "none", "type of durability to enforce. Default is none. Other values are dictated by registered plugins") ) func init() { @@ -93,7 +93,7 @@ func main() { log.Warningf("cannot connect to syslog: %v", err) } - if err := reparentutil.SetDurabilityPolicy(*durability, nil); err != nil { + if err := reparentutil.SetDurabilityPolicy(*durabilityPolicy, nil); err != nil { log.Errorf("error in setting durability policy: %v", err) exit.Return(1) } diff --git a/go/cmd/vtworker/vtworker.go b/go/cmd/vtworker/vtworker.go index 7c9a1fa40e8..301617d1579 100644 --- a/go/cmd/vtworker/vtworker.go +++ b/go/cmd/vtworker/vtworker.go @@ -37,6 +37,7 @@ import ( "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/servenv" "vitess.io/vitess/go/vt/topo" + "vitess.io/vitess/go/vt/vtctl/reparentutil" "vitess.io/vitess/go/vt/worker" ) @@ -44,6 +45,7 @@ var ( cell = flag.String("cell", "", "cell to pick servers from") commandDisplayInterval = flag.Duration("command_display_interval", time.Second, "Interval between each status update when vtworker is executing a single command from the command line") username = flag.String("username", "", "If set, value is set as immediate caller id in the request and used by vttablet for TableACL check") + durabilityPolicy = flag.String("durability_policy", "none", "type of durability to enforce. Default is none. Other values are dictated by registered plugins") ) func init() { @@ -78,6 +80,11 @@ func main() { os.Exit(0) } + if err := reparentutil.SetDurabilityPolicy(*durabilityPolicy, nil); err != nil { + log.Errorf("error in setting durability policy: %v", err) + exit.Return(1) + } + ts := topo.Open() defer ts.Close() diff --git a/go/test/endtoend/backup/transform/backup_transform_utils.go b/go/test/endtoend/backup/transform/backup_transform_utils.go index d9af72ea66c..1cc13160979 100644 --- a/go/test/endtoend/backup/transform/backup_transform_utils.go +++ b/go/test/endtoend/backup/transform/backup_transform_utils.go @@ -68,6 +68,7 @@ func TestMainSetup(m *testing.M, useMysqlctld bool) { localCluster = cluster.NewCluster(cell, hostname) defer localCluster.Teardown() + localCluster.VtctldExtraArgs = append(localCluster.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := localCluster.StartTopo() if err != nil { diff --git a/go/test/endtoend/backup/vtbackup/main_test.go b/go/test/endtoend/backup/vtbackup/main_test.go index a9df0c97675..c4d9edbafca 100644 --- a/go/test/endtoend/backup/vtbackup/main_test.go +++ b/go/test/endtoend/backup/vtbackup/main_test.go @@ -61,6 +61,7 @@ func TestMain(m *testing.M) { localCluster = cluster.NewCluster(cell, hostname) defer localCluster.Teardown() + localCluster.VtctldExtraArgs = append(localCluster.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := localCluster.StartTopo() if err != nil { diff --git a/go/test/endtoend/backup/vtctlbackup/backup_utils.go b/go/test/endtoend/backup/vtctlbackup/backup_utils.go index 7d84b00ce85..c23a7f9b2c6 100644 --- a/go/test/endtoend/backup/vtctlbackup/backup_utils.go +++ b/go/test/endtoend/backup/vtctlbackup/backup_utils.go @@ -83,6 +83,7 @@ var ( // LaunchCluster : starts the cluster as per given params. func LaunchCluster(setupType int, streamMode string, stripes int) (int, error) { localCluster = cluster.NewCluster(cell, hostname) + localCluster.VtctldExtraArgs = append(localCluster.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := localCluster.StartTopo() diff --git a/go/test/endtoend/recovery/pitr/shardedpitr_test.go b/go/test/endtoend/recovery/pitr/shardedpitr_test.go index 4096e1649fd..a9dbbef2cd1 100644 --- a/go/test/endtoend/recovery/pitr/shardedpitr_test.go +++ b/go/test/endtoend/recovery/pitr/shardedpitr_test.go @@ -371,6 +371,7 @@ func removeTablets(t *testing.T, tablets []*cluster.Vttablet) { func initializeCluster(t *testing.T) { clusterInstance = cluster.NewCluster(cell, hostname) + clusterInstance.VtctldExtraArgs = append(clusterInstance.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := clusterInstance.StartTopo() diff --git a/go/test/endtoend/recovery/pitrtls/shardedpitr_tls_test.go b/go/test/endtoend/recovery/pitrtls/shardedpitr_tls_test.go index 4df09bd8243..604d65b1ebd 100644 --- a/go/test/endtoend/recovery/pitrtls/shardedpitr_tls_test.go +++ b/go/test/endtoend/recovery/pitrtls/shardedpitr_tls_test.go @@ -108,6 +108,7 @@ func removeTablets(t *testing.T, tablets []*cluster.Vttablet) { func initializeCluster(t *testing.T) { clusterInstance = cluster.NewCluster(cell, hostname) + clusterInstance.VtctldExtraArgs = append(clusterInstance.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := clusterInstance.StartTopo() diff --git a/go/test/endtoend/recovery/shardedrecovery/sharded_recovery_test.go b/go/test/endtoend/recovery/shardedrecovery/sharded_recovery_test.go index 34d63c70716..7dd1565c954 100644 --- a/go/test/endtoend/recovery/shardedrecovery/sharded_recovery_test.go +++ b/go/test/endtoend/recovery/shardedrecovery/sharded_recovery_test.go @@ -466,6 +466,7 @@ func removeTablets(t *testing.T, tablets []*cluster.Vttablet) { func initializeCluster(t *testing.T) (int, error) { localCluster = cluster.NewCluster(cell, hostname) + localCluster.VtctldExtraArgs = append(localCluster.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := localCluster.StartTopo() diff --git a/go/test/endtoend/recovery/unshardedrecovery/recovery.go b/go/test/endtoend/recovery/unshardedrecovery/recovery.go index 9a5b21bf53a..ac6acb2c11e 100644 --- a/go/test/endtoend/recovery/unshardedrecovery/recovery.go +++ b/go/test/endtoend/recovery/unshardedrecovery/recovery.go @@ -82,6 +82,7 @@ func TestMainImpl(m *testing.M) { localCluster = cluster.NewCluster(cell, hostname) defer localCluster.Teardown() + localCluster.VtctldExtraArgs = append(localCluster.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := localCluster.StartTopo() if err != nil { diff --git a/go/test/endtoend/reparent/emergencyreparent/ers_test.go b/go/test/endtoend/reparent/emergencyreparent/ers_test.go index b99cd3ef25c..fb529189c91 100644 --- a/go/test/endtoend/reparent/emergencyreparent/ers_test.go +++ b/go/test/endtoend/reparent/emergencyreparent/ers_test.go @@ -30,7 +30,7 @@ import ( func TestTrivialERS(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -55,7 +55,7 @@ func TestTrivialERS(t *testing.T) { func TestReparentIgnoreReplicas(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets var err error @@ -97,7 +97,7 @@ func TestReparentIgnoreReplicas(t *testing.T) { func TestReparentDownPrimary(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -133,7 +133,7 @@ func TestReparentDownPrimary(t *testing.T) { func TestReparentNoChoiceDownPrimary(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets var err error @@ -165,3 +165,61 @@ func TestReparentNoChoiceDownPrimary(t *testing.T) { // bring back the old primary as a replica, check that it catches up utils.ResurrectTablet(ctx, t, clusterInstance, tablets[0]) } + +func TestSemiSyncSetupCorrectly(t *testing.T) { + t.Run("semi-sync enabled", func(t *testing.T) { + defer cluster.PanicHandler(t) + clusterInstance := utils.SetupReparentCluster(t, true) + defer utils.TeardownCluster(clusterInstance) + tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets + + utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) + // Run forced reparent operation, this should proceed unimpeded. + out, err := utils.Ers(clusterInstance, tablets[1], "60s", "30s") + require.NoError(t, err, out) + + utils.ConfirmReplication(t, tablets[1], []*cluster.Vttablet{tablets[0], tablets[2], tablets[3]}) + + for _, tablet := range tablets { + utils.CheckSemiSyncSetupCorrectly(t, tablet, "ON") + } + + // Run forced reparent operation, this should proceed unimpeded. + out, err = utils.Prs(t, clusterInstance, tablets[0]) + require.NoError(t, err, out) + + utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) + + for _, tablet := range tablets { + utils.CheckSemiSyncSetupCorrectly(t, tablet, "ON") + } + }) + + t.Run("semi-sync disabled", func(t *testing.T) { + defer cluster.PanicHandler(t) + clusterInstance := utils.SetupReparentCluster(t, false) + defer utils.TeardownCluster(clusterInstance) + tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets + + utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) + // Run forced reparent operation, this should proceed unimpeded. + out, err := utils.Ers(clusterInstance, tablets[1], "60s", "30s") + require.NoError(t, err, out) + + utils.ConfirmReplication(t, tablets[1], []*cluster.Vttablet{tablets[0], tablets[2], tablets[3]}) + + for _, tablet := range tablets { + utils.CheckSemiSyncSetupCorrectly(t, tablet, "OFF") + } + + // Run forced reparent operation, this should proceed unimpeded. + out, err = utils.Prs(t, clusterInstance, tablets[0]) + require.NoError(t, err, out) + + utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) + + for _, tablet := range tablets { + utils.CheckSemiSyncSetupCorrectly(t, tablet, "OFF") + } + }) +} diff --git a/go/test/endtoend/reparent/newfeaturetest/reparent_test.go b/go/test/endtoend/reparent/newfeaturetest/reparent_test.go index 393da0f6e70..50c9fc79fd9 100644 --- a/go/test/endtoend/reparent/newfeaturetest/reparent_test.go +++ b/go/test/endtoend/reparent/newfeaturetest/reparent_test.go @@ -37,6 +37,7 @@ func TestPRSForInitialization(t *testing.T) { var tablets []*cluster.Vttablet clusterInstance := cluster.NewCluster("zone1", "localhost") keyspace := &cluster.Keyspace{Name: utils.KeyspaceName} + clusterInstance.VtctldExtraArgs = append(clusterInstance.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := clusterInstance.StartTopo() require.NoError(t, err) @@ -107,7 +108,7 @@ func TestPRSForInitialization(t *testing.T) { // TestERSPromoteRdonly tests that we never end up promoting a rdonly instance as the primary func TestERSPromoteRdonly(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets var err error @@ -135,7 +136,7 @@ func TestERSPromoteRdonly(t *testing.T) { // TestERSPreventCrossCellPromotion tests that we promote a replica in the same cell as the previous primary if prevent cross cell promotion flag is set func TestERSPreventCrossCellPromotion(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets var err error @@ -158,7 +159,7 @@ func TestERSPreventCrossCellPromotion(t *testing.T) { // caught up to it by pulling transactions from it func TestPullFromRdonly(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets var err error @@ -223,7 +224,7 @@ func TestPullFromRdonly(t *testing.T) { // is stopped on the primary elect. func TestNoReplicationStatusAndReplicationStopped(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) @@ -253,6 +254,7 @@ func TestERSForInitialization(t *testing.T) { var tablets []*cluster.Vttablet clusterInstance := cluster.NewCluster("zone1", "localhost") keyspace := &cluster.Keyspace{Name: utils.KeyspaceName} + clusterInstance.VtctldExtraArgs = append(clusterInstance.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := clusterInstance.StartTopo() require.NoError(t, err) diff --git a/go/test/endtoend/reparent/plannedreparent/reparent_test.go b/go/test/endtoend/reparent/plannedreparent/reparent_test.go index fcbd9bc523b..369f31a64eb 100644 --- a/go/test/endtoend/reparent/plannedreparent/reparent_test.go +++ b/go/test/endtoend/reparent/plannedreparent/reparent_test.go @@ -33,7 +33,7 @@ import ( func TestPrimaryToSpareStateChangeImpossible(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -45,7 +45,7 @@ func TestPrimaryToSpareStateChangeImpossible(t *testing.T) { func TestReparentCrossCell(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -59,7 +59,7 @@ func TestReparentCrossCell(t *testing.T) { func TestReparentGraceful(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -84,7 +84,7 @@ func TestReparentGraceful(t *testing.T) { // TestPRSWithDrainedLaggingTablet tests that PRS succeeds even if we have a lagging drained tablet func TestPRSWithDrainedLaggingTablet(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -111,7 +111,7 @@ func TestPRSWithDrainedLaggingTablet(t *testing.T) { func TestReparentReplicaOffline(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -128,7 +128,7 @@ func TestReparentReplicaOffline(t *testing.T) { func TestReparentAvoid(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets utils.DeleteTablet(t, clusterInstance, tablets[2]) @@ -160,14 +160,14 @@ func TestReparentAvoid(t *testing.T) { func TestReparentFromOutside(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) reparentFromOutside(t, clusterInstance, false) } func TestReparentFromOutsideWithNoPrimary(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -256,7 +256,7 @@ func reparentFromOutside(t *testing.T, clusterInstance *cluster.LocalProcessClus func TestReparentWithDownReplica(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -299,7 +299,7 @@ func TestReparentWithDownReplica(t *testing.T) { func TestChangeTypeSemiSync(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -363,7 +363,7 @@ func TestChangeTypeSemiSync(t *testing.T) { func TestReparentDoesntHangIfPrimaryFails(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t) + clusterInstance := utils.SetupReparentCluster(t, true) defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets diff --git a/go/test/endtoend/reparent/utils/utils.go b/go/test/endtoend/reparent/utils/utils.go index dd9202c980e..011720c3d85 100644 --- a/go/test/endtoend/reparent/utils/utils.go +++ b/go/test/endtoend/reparent/utils/utils.go @@ -64,13 +64,13 @@ var ( //region cluster setup/teardown // SetupReparentCluster is used to setup the reparent cluster -func SetupReparentCluster(t *testing.T) *cluster.LocalProcessCluster { - return setupCluster(context.Background(), t, ShardName, []string{cell1, cell2}, []int{3, 1}) +func SetupReparentCluster(t *testing.T, enableSemiSync bool) *cluster.LocalProcessCluster { + return setupCluster(context.Background(), t, ShardName, []string{cell1, cell2}, []int{3, 1}, enableSemiSync) } // SetupRangeBasedCluster sets up the range based cluster func SetupRangeBasedCluster(ctx context.Context, t *testing.T) *cluster.LocalProcessCluster { - return setupCluster(ctx, t, ShardName, []string{cell1}, []int{2}) + return setupCluster(ctx, t, ShardName, []string{cell1}, []int{2}, true) } // TeardownCluster is used to teardown the reparent cluster @@ -78,10 +78,18 @@ func TeardownCluster(clusterInstance *cluster.LocalProcessCluster) { clusterInstance.Teardown() } -func setupCluster(ctx context.Context, t *testing.T, shardName string, cells []string, numTablets []int) *cluster.LocalProcessCluster { +func setupCluster(ctx context.Context, t *testing.T, shardName string, cells []string, numTablets []int, enableSemiSync bool) *cluster.LocalProcessCluster { var tablets []*cluster.Vttablet clusterInstance := cluster.NewCluster(cells[0], Hostname) keyspace := &cluster.Keyspace{Name: KeyspaceName} + + if enableSemiSync { + clusterInstance.VtTabletExtraArgs = append(clusterInstance.VtTabletExtraArgs, "-enable_semi_sync") + if clusterInstance.VtctlMajorVersion >= 13 { + clusterInstance.VtctldExtraArgs = append(clusterInstance.VtctldExtraArgs, "-durability_policy=semi_sync") + } + } + // Start topo server err := clusterInstance.StartTopo() if err != nil { @@ -115,9 +123,8 @@ func setupCluster(ctx context.Context, t *testing.T, shardName string, cells []s shard := &cluster.Shard{Name: shardName} shard.Vttablets = tablets - clusterInstance.VtTabletExtraArgs = []string{ + clusterInstance.VtTabletExtraArgs = append(clusterInstance.VtTabletExtraArgs, "-lock_tables_timeout", "5s", - "-enable_semi_sync", "-init_populate_metadata", "-track_schema_versions=true", // disabling online-ddl for reparent tests. This is done to reduce flakiness. @@ -126,8 +133,8 @@ func setupCluster(ctx context.Context, t *testing.T, shardName string, cells []s // In this case, the close method and initSchema method of the onlineDDL executor race. // If the initSchema acquires the lock, then it takes about 30 seconds for it to run during which time the // DemotePrimary rpc is stalled! - "-queryserver_enable_online_ddl=false", - } + "-queryserver_enable_online_ddl=false") + if clusterInstance.VtTabletMajorVersion >= 13 && clusterInstance.VtctlMajorVersion >= 13 { // disabling active reparents on the tablet since we don't want the replication manager // to fix replication if it is stopped. Some tests deliberately do that. Also, we don't want @@ -303,6 +310,9 @@ func ErsIgnoreTablet(clusterInstance *cluster.LocalProcessCluster, tab *cluster. // ErsWithVtctl runs ERS via vtctl binary func ErsWithVtctl(clusterInstance *cluster.LocalProcessCluster) (string, error) { args := []string{"EmergencyReparentShard", "-keyspace_shard", fmt.Sprintf("%s/%s", KeyspaceName, ShardName)} + if clusterInstance.VtctlMajorVersion >= 13 { + args = append([]string{"-durability_policy=semi_sync"}, args...) + } return clusterInstance.VtctlProcess.ExecuteCommandWithOutput(args...) } @@ -409,6 +419,12 @@ func CheckInsertedValues(ctx context.Context, t *testing.T, tablet *cluster.Vtta return fmt.Errorf("data is not yet replicated on tablet %s", tablet.Alias) } +func CheckSemiSyncSetupCorrectly(t *testing.T, tablet *cluster.Vttablet, semiSyncVal string) { + dbVar, err := tablet.VttabletProcess.GetDBVar("rpl_semi_sync_slave_enabled", "") + require.NoError(t, err) + require.Equal(t, semiSyncVal, dbVar) +} + // CheckCountOfInsertedValues checks that the number of inserted values matches the given count on the given tablet func CheckCountOfInsertedValues(ctx context.Context, t *testing.T, tablet *cluster.Vttablet, count int) error { selectSQL := "select * from vt_insert_test" diff --git a/go/test/endtoend/sharding/initialsharding/sharding_util.go b/go/test/endtoend/sharding/initialsharding/sharding_util.go index 825100ca00d..708b02ba561 100644 --- a/go/test/endtoend/sharding/initialsharding/sharding_util.go +++ b/go/test/endtoend/sharding/initialsharding/sharding_util.go @@ -96,6 +96,7 @@ func ClusterWrapper(isMulti bool) (int, error) { ClusterInstance = nil ClusterInstance = cluster.NewCluster(cell, hostname) + ClusterInstance.VtctldExtraArgs = append(ClusterInstance.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server if err := ClusterInstance.StartTopo(); err != nil { return 1, err diff --git a/go/test/endtoend/sharding/mergesharding/mergesharding_base.go b/go/test/endtoend/sharding/mergesharding/mergesharding_base.go index d64277f616f..6501ea8c418 100644 --- a/go/test/endtoend/sharding/mergesharding/mergesharding_base.go +++ b/go/test/endtoend/sharding/mergesharding/mergesharding_base.go @@ -107,6 +107,7 @@ func TestMergesharding(t *testing.T, useVarbinaryShardingKeyType bool) { // Launch keyspace keyspace := &cluster.Keyspace{Name: keyspaceName} + clusterInstance.VtctldExtraArgs = append(clusterInstance.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := clusterInstance.StartTopo() diff --git a/go/test/endtoend/sharding/resharding/resharding_base.go b/go/test/endtoend/sharding/resharding/resharding_base.go index 36aa38df74f..a8d7d5f474c 100644 --- a/go/test/endtoend/sharding/resharding/resharding_base.go +++ b/go/test/endtoend/sharding/resharding/resharding_base.go @@ -190,6 +190,7 @@ func TestResharding(t *testing.T, useVarbinaryShardingKeyType bool) { // Launch keyspace keyspace := &cluster.Keyspace{Name: keyspaceName} + clusterInstance.VtctldExtraArgs = append(clusterInstance.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := clusterInstance.StartTopo() diff --git a/go/test/endtoend/tabletmanager/main_test.go b/go/test/endtoend/tabletmanager/main_test.go index 9c118465edc..3bf20a01c50 100644 --- a/go/test/endtoend/tabletmanager/main_test.go +++ b/go/test/endtoend/tabletmanager/main_test.go @@ -182,7 +182,7 @@ func tmcStopReplication(ctx context.Context, tabletGrpcPort int) error { func tmcStartReplication(ctx context.Context, tabletGrpcPort int) error { vtablet := getTablet(tabletGrpcPort) - return tmClient.StartReplication(ctx, vtablet) + return tmClient.StartReplication(ctx, vtablet, false) } func tmcPrimaryPosition(ctx context.Context, tabletGrpcPort int) (string, error) { diff --git a/go/test/endtoend/vault/vault_test.go b/go/test/endtoend/vault/vault_test.go index c531985f5d9..cb10c07e5b6 100644 --- a/go/test/endtoend/vault/vault_test.go +++ b/go/test/endtoend/vault/vault_test.go @@ -218,6 +218,7 @@ func setupVaultServer(t *testing.T, vs *VaultServer) (string, string) { func initializeClusterEarly(t *testing.T) { clusterInstance = cluster.NewCluster(cell, hostname) + clusterInstance.VtctldExtraArgs = append(clusterInstance.VtctldExtraArgs, "-durability_policy=semi_sync") // Start topo server err := clusterInstance.StartTopo() require.NoError(t, err) diff --git a/go/test/fuzzing/vttablet_fuzzer.go b/go/test/fuzzing/vttablet_fuzzer.go index b3266de811e..bd94bc0084d 100644 --- a/go/test/fuzzing/vttablet_fuzzer.go +++ b/go/test/fuzzing/vttablet_fuzzer.go @@ -298,7 +298,7 @@ func (fs *fuzzStore) callInitMaster() error { if err != nil { return err } - _, _ = fs.client.InitMaster(context.Background(), tablet) + _, _ = fs.client.InitMaster(context.Background(), tablet, false) return nil } @@ -331,7 +331,7 @@ func (fs *fuzzStore) callStartReplication() error { if err != nil { return err } - _ = fs.client.StartReplication(context.Background(), tablet) + _ = fs.client.StartReplication(context.Background(), tablet, false) return nil } @@ -419,7 +419,7 @@ func (fs *fuzzStore) callUndoDemotePrimary() error { if err != nil { return err } - _ = fs.client.UndoDemotePrimary(context.Background(), tablet) + _ = fs.client.UndoDemotePrimary(context.Background(), tablet, false) return nil } @@ -441,7 +441,7 @@ func (fs *fuzzStore) callPromoteReplica() error { if err != nil { return err } - _, _ = fs.client.PromoteReplica(context.Background(), tablet) + _, _ = fs.client.PromoteReplica(context.Background(), tablet, false) return nil } @@ -562,7 +562,7 @@ func (fs *fuzzStore) callSetMaster() error { if err != nil { return err } - _ = fs.client.SetMaster(context.Background(), tablet, parent, int64(timeCreatedNS), pos, false) + _ = fs.client.SetMaster(context.Background(), tablet, parent, int64(timeCreatedNS), pos, false, false) return nil } @@ -585,7 +585,7 @@ func (fs *fuzzStore) callInitReplica() error { if err != nil { return err } - _ = fs.client.InitReplica(context.Background(), tablet, parent, replicationPosition, int64(timeCreatedNS)) + _ = fs.client.InitReplica(context.Background(), tablet, parent, replicationPosition, int64(timeCreatedNS), false) return nil } diff --git a/go/vt/orchestrator/inst/analysis_dao.go b/go/vt/orchestrator/inst/analysis_dao.go index 99d2c5a96fa..10c6b4a121c 100644 --- a/go/vt/orchestrator/inst/analysis_dao.go +++ b/go/vt/orchestrator/inst/analysis_dao.go @@ -532,11 +532,11 @@ func GetReplicationAnalysis(clusterName string, hints *ReplicationAnalysisHints) a.Analysis = ReplicationStopped a.Description = "Replication is stopped" // - } else if topo.IsReplicaType(a.TabletType) && !a.IsPrimary && reparentutil.ReplicaSemiSync(primaryTablet, tablet) && !a.SemiSyncReplicaEnabled { + } else if topo.IsReplicaType(a.TabletType) && !a.IsPrimary && reparentutil.IsReplicaSemiSync(primaryTablet, tablet) && !a.SemiSyncReplicaEnabled { a.Analysis = ReplicaSemiSyncMustBeSet a.Description = "Replica semi-sync must be set" // - } else if topo.IsReplicaType(a.TabletType) && !a.IsPrimary && !reparentutil.ReplicaSemiSync(primaryTablet, tablet) && a.SemiSyncReplicaEnabled { + } else if topo.IsReplicaType(a.TabletType) && !a.IsPrimary && !reparentutil.IsReplicaSemiSync(primaryTablet, tablet) && a.SemiSyncReplicaEnabled { a.Analysis = ReplicaSemiSyncMustNotBeSet a.Description = "Replica semi-sync must not be set" // diff --git a/go/vt/orchestrator/inst/durability.go b/go/vt/orchestrator/inst/durability.go index 547ae03916f..c9cb199f1a8 100644 --- a/go/vt/orchestrator/inst/durability.go +++ b/go/vt/orchestrator/inst/durability.go @@ -20,8 +20,8 @@ import ( "vitess.io/vitess/go/vt/vtctl/reparentutil" ) -// ReplicaSemiSync returns the replica semi-sync setting for the instance. -func ReplicaSemiSync(primaryKey, replicaKey InstanceKey) bool { +// IsReplicaSemiSync returns the replica semi-sync setting for the instance. +func IsReplicaSemiSync(primaryKey, replicaKey InstanceKey) bool { primary, err := ReadTablet(primaryKey) if err != nil { return false @@ -30,7 +30,7 @@ func ReplicaSemiSync(primaryKey, replicaKey InstanceKey) bool { if err != nil { return false } - return reparentutil.ReplicaSemiSync(primary, replica) + return reparentutil.IsReplicaSemiSync(primary, replica) } // SemiSyncAckers returns the primary semi-sync setting for the instance. diff --git a/go/vt/orchestrator/inst/instance_topology_dao.go b/go/vt/orchestrator/inst/instance_topology_dao.go index ba584674892..b40aa831c9e 100644 --- a/go/vt/orchestrator/inst/instance_topology_dao.go +++ b/go/vt/orchestrator/inst/instance_topology_dao.go @@ -675,7 +675,7 @@ func ChangePrimaryTo(instanceKey *InstanceKey, primaryKey *InstanceKey, primaryB return instance, log.Errore(err) } - semiSync := ReplicaSemiSync(*primaryKey, *instanceKey) + semiSync := IsReplicaSemiSync(*primaryKey, *instanceKey) if _, err := ExecInstance(instanceKey, `set global rpl_semi_sync_master_enabled = ?, global rpl_semi_sync_slave_enabled = ?`, false, semiSync); err != nil { return instance, log.Errore(err) } diff --git a/go/vt/orchestrator/inst/tablet_dao.go b/go/vt/orchestrator/inst/tablet_dao.go index 448d6f0b52b..21309109d0d 100644 --- a/go/vt/orchestrator/inst/tablet_dao.go +++ b/go/vt/orchestrator/inst/tablet_dao.go @@ -46,7 +46,7 @@ var ErrTabletAliasNil = errors.New("tablet alias is nil") // The proactive propagation allows a competing Orchestrator from discovering // the successful action of a previous one, which reduces churn. func SwitchPrimary(newPrimaryKey, oldPrimaryKey InstanceKey) error { - newPrimaryTablet, err := ChangeTabletType(newPrimaryKey, topodatapb.TabletType_PRIMARY) + newPrimaryTablet, err := ChangeTabletType(newPrimaryKey, topodatapb.TabletType_PRIMARY, SemiSyncAckers(newPrimaryKey) > 0) if err != nil { return err } @@ -80,7 +80,7 @@ func SwitchPrimary(newPrimaryKey, oldPrimaryKey InstanceKey) error { log.Errore(err) return nil } - if _, err := ChangeTabletType(oldPrimaryKey, topodatapb.TabletType_REPLICA); err != nil { + if _, err := ChangeTabletType(oldPrimaryKey, topodatapb.TabletType_REPLICA, IsReplicaSemiSync(newPrimaryKey, oldPrimaryKey)); err != nil { // This is best effort. log.Errore(err) } @@ -88,7 +88,7 @@ func SwitchPrimary(newPrimaryKey, oldPrimaryKey InstanceKey) error { } // ChangeTabletType designates the tablet that owns an instance as the primary. -func ChangeTabletType(instanceKey InstanceKey, tabletType topodatapb.TabletType) (*topodatapb.Tablet, error) { +func ChangeTabletType(instanceKey InstanceKey, tabletType topodatapb.TabletType, semiSync bool) (*topodatapb.Tablet, error) { if instanceKey.Hostname == "" { return nil, errors.New("can't set tablet to primary: instance is unspecified") } @@ -99,7 +99,7 @@ func ChangeTabletType(instanceKey InstanceKey, tabletType topodatapb.TabletType) tmc := tmclient.NewTabletManagerClient() tmcCtx, tmcCancel := context.WithTimeout(context.Background(), *topo.RemoteOperationTimeout) defer tmcCancel() - if err := tmc.ChangeType(tmcCtx, tablet, tabletType); err != nil { + if err := tmc.ChangeType(tmcCtx, tablet, tabletType, semiSync); err != nil { return nil, err } tsCtx, tsCancel := context.WithTimeout(context.Background(), *topo.RemoteOperationTimeout) diff --git a/go/vt/orchestrator/logic/tablet_discovery.go b/go/vt/orchestrator/logic/tablet_discovery.go index 8b0ee13221e..5ee009d0b7a 100644 --- a/go/vt/orchestrator/logic/tablet_discovery.go +++ b/go/vt/orchestrator/logic/tablet_discovery.go @@ -311,7 +311,7 @@ func tabletDemotePrimary(instanceKey inst.InstanceKey, forward bool) error { if forward { _, err = tmc.DemotePrimary(ctx, tablet) } else { - err = tmc.UndoDemotePrimary(ctx, tablet) + err = tmc.UndoDemotePrimary(ctx, tablet, inst.SemiSyncAckers(instanceKey) > 0) } return err } diff --git a/go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go b/go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go index afd35b3a867..ab5e353d3bc 100644 --- a/go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go +++ b/go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go @@ -1138,6 +1138,7 @@ type ChangeTypeRequest struct { unknownFields protoimpl.UnknownFields TabletType topodata.TabletType `protobuf:"varint,1,opt,name=tablet_type,json=tabletType,proto3,enum=topodata.TabletType" json:"tablet_type,omitempty"` + SemiSync bool `protobuf:"varint,2,opt,name=semiSync,proto3" json:"semiSync,omitempty"` } func (x *ChangeTypeRequest) Reset() { @@ -1179,6 +1180,13 @@ func (x *ChangeTypeRequest) GetTabletType() topodata.TabletType { return topodata.TabletType(0) } +func (x *ChangeTypeRequest) GetSemiSync() bool { + if x != nil { + return x.SemiSync + } + return false +} + type ChangeTypeResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2910,6 +2918,8 @@ type StartReplicationRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SemiSync bool `protobuf:"varint,1,opt,name=semiSync,proto3" json:"semiSync,omitempty"` } func (x *StartReplicationRequest) Reset() { @@ -2944,6 +2954,13 @@ func (*StartReplicationRequest) Descriptor() ([]byte, []int) { return file_tabletmanagerdata_proto_rawDescGZIP(), []int{58} } +func (x *StartReplicationRequest) GetSemiSync() bool { + if x != nil { + return x.SemiSync + } + return false +} + type StartReplicationResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3427,6 +3444,8 @@ type InitPrimaryRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SemiSync bool `protobuf:"varint,1,opt,name=semiSync,proto3" json:"semiSync,omitempty"` } func (x *InitPrimaryRequest) Reset() { @@ -3461,6 +3480,13 @@ func (*InitPrimaryRequest) Descriptor() ([]byte, []int) { return file_tabletmanagerdata_proto_rawDescGZIP(), []int{70} } +func (x *InitPrimaryRequest) GetSemiSync() bool { + if x != nil { + return x.SemiSync + } + return false +} + type InitPrimaryResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3625,6 +3651,7 @@ type InitReplicaRequest struct { Parent *topodata.TabletAlias `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` ReplicationPosition string `protobuf:"bytes,2,opt,name=replication_position,json=replicationPosition,proto3" json:"replication_position,omitempty"` TimeCreatedNs int64 `protobuf:"varint,3,opt,name=time_created_ns,json=timeCreatedNs,proto3" json:"time_created_ns,omitempty"` + SemiSync bool `protobuf:"varint,4,opt,name=semiSync,proto3" json:"semiSync,omitempty"` } func (x *InitReplicaRequest) Reset() { @@ -3680,6 +3707,13 @@ func (x *InitReplicaRequest) GetTimeCreatedNs() int64 { return 0 } +func (x *InitReplicaRequest) GetSemiSync() bool { + if x != nil { + return x.SemiSync + } + return false +} + type InitReplicaResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3820,6 +3854,8 @@ type UndoDemotePrimaryRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SemiSync bool `protobuf:"varint,1,opt,name=semiSync,proto3" json:"semiSync,omitempty"` } func (x *UndoDemotePrimaryRequest) Reset() { @@ -3854,6 +3890,13 @@ func (*UndoDemotePrimaryRequest) Descriptor() ([]byte, []int) { return file_tabletmanagerdata_proto_rawDescGZIP(), []int{78} } +func (x *UndoDemotePrimaryRequest) GetSemiSync() bool { + if x != nil { + return x.SemiSync + } + return false +} + type UndoDemotePrimaryResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3977,6 +4020,7 @@ type SetReplicationSourceRequest struct { TimeCreatedNs int64 `protobuf:"varint,2,opt,name=time_created_ns,json=timeCreatedNs,proto3" json:"time_created_ns,omitempty"` ForceStartReplication bool `protobuf:"varint,3,opt,name=force_start_replication,json=forceStartReplication,proto3" json:"force_start_replication,omitempty"` WaitPosition string `protobuf:"bytes,4,opt,name=wait_position,json=waitPosition,proto3" json:"wait_position,omitempty"` + SemiSync bool `protobuf:"varint,5,opt,name=semiSync,proto3" json:"semiSync,omitempty"` } func (x *SetReplicationSourceRequest) Reset() { @@ -4039,6 +4083,13 @@ func (x *SetReplicationSourceRequest) GetWaitPosition() string { return "" } +func (x *SetReplicationSourceRequest) GetSemiSync() bool { + if x != nil { + return x.SemiSync + } + return false +} + type SetReplicationSourceResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4276,6 +4327,8 @@ type PromoteReplicaRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SemiSync bool `protobuf:"varint,1,opt,name=semiSync,proto3" json:"semiSync,omitempty"` } func (x *PromoteReplicaRequest) Reset() { @@ -4310,6 +4363,13 @@ func (*PromoteReplicaRequest) Descriptor() ([]byte, []int) { return file_tabletmanagerdata_proto_rawDescGZIP(), []int{88} } +func (x *PromoteReplicaRequest) GetSemiSync() bool { + if x != nil { + return x.SemiSync + } + return false +} + type PromoteReplicaResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4806,224 +4866,231 @@ var file_tabletmanagerdata_proto_rawDesc = []byte{ 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x52, 0x65, 0x61, 0x64, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x16, 0x0a, 0x14, 0x53, 0x65, 0x74, 0x52, 0x65, 0x61, 0x64, 0x57, - 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4a, 0x0a, 0x11, + 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x66, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x74, 0x61, - 0x62, 0x6c, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x6e, - 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, - 0x0a, 0x13, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x16, 0x0a, 0x14, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x0a, - 0x15, 0x52, 0x75, 0x6e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x18, 0x0a, 0x16, 0x52, 0x75, 0x6e, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x34, 0x0a, 0x18, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, - 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x22, 0x1b, 0x0a, 0x19, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, - 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x77, 0x61, - 0x69, 0x74, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x77, 0x61, 0x69, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0x16, 0x0a, 0x14, 0x52, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x0a, 0x16, 0x50, 0x72, 0x65, 0x66, 0x6c, - 0x69, 0x67, 0x68, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x22, 0x67, 0x0a, 0x17, 0x50, - 0x72, 0x65, 0x66, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, - 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, - 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, - 0x74, 0x61, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x73, 0x22, 0x96, 0x02, 0x0a, 0x12, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, - 0x71, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x71, 0x6c, 0x12, 0x14, 0x0a, - 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x66, 0x6f, - 0x72, 0x63, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, - 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x48, 0x0a, 0x0d, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x62, 0x65, - 0x66, 0x6f, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x46, 0x0a, 0x0c, 0x61, 0x66, - 0x74, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65, 0x66, 0x69, 0x6e, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x66, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x71, 0x6c, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x71, 0x6c, 0x4d, 0x6f, 0x64, 0x65, 0x22, 0xa7, 0x01, - 0x0a, 0x13, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x5f, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, + 0x62, 0x6c, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x69, + 0x53, 0x79, 0x6e, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x73, 0x65, 0x6d, 0x69, + 0x53, 0x79, 0x6e, 0x63, 0x22, 0x14, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x52, 0x65, + 0x66, 0x72, 0x65, 0x73, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x22, 0x16, 0x0a, 0x14, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x75, 0x6e, + 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x18, 0x0a, 0x16, 0x52, 0x75, 0x6e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x0a, 0x18, + 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x22, 0x1b, 0x0a, 0x19, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x3a, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x77, + 0x61, 0x69, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x16, 0x0a, 0x14, 0x52, + 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x32, 0x0a, 0x16, 0x50, 0x72, 0x65, 0x66, 0x6c, 0x69, 0x67, 0x68, 0x74, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, + 0x07, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, + 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x22, 0x67, 0x0a, 0x17, 0x50, 0x72, 0x65, 0x66, 0x6c, + 0x69, 0x67, 0x68, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, + 0x22, 0x96, 0x02, 0x0a, 0x12, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x71, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x71, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6f, 0x72, + 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x12, + 0x2b, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x0d, + 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65, + 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x46, 0x0a, 0x0c, 0x61, 0x66, 0x74, 0x65, 0x72, 0x5f, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x0c, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, - 0x46, 0x0a, 0x0c, 0x61, 0x66, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x66, 0x74, 0x65, - 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x13, 0x0a, 0x11, 0x4c, 0x6f, 0x63, 0x6b, 0x54, - 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x14, 0x0a, 0x12, - 0x4c, 0x6f, 0x63, 0x6b, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x61, 0x62, 0x6c, - 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x16, 0x0a, 0x14, 0x55, 0x6e, 0x6c, - 0x6f, 0x63, 0x6b, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x5f, 0x0a, 0x13, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, - 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x72, - 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x52, 0x6f, - 0x77, 0x73, 0x22, 0x42, 0x0a, 0x14, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, 0x65, - 0x72, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0xb2, 0x01, 0x0a, 0x18, 0x45, 0x78, 0x65, 0x63, 0x75, - 0x74, 0x65, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x73, 0x44, 0x62, 0x61, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x27, 0x0a, - 0x0f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x73, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x42, - 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x6f, 0x61, 0x64, - 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x72, - 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x47, 0x0a, 0x19, 0x45, - 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x73, 0x44, 0x62, 0x61, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x22, 0x8e, 0x01, 0x0a, 0x1d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, - 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x73, 0x41, 0x6c, 0x6c, 0x50, 0x72, 0x69, 0x76, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, 0x0a, 0x07, - 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, - 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x6f, 0x77, - 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x52, 0x6f, 0x77, 0x73, - 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x72, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x53, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x4c, 0x0a, 0x1e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, - 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x73, 0x41, 0x6c, 0x6c, 0x50, 0x72, 0x69, 0x76, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x22, 0x4b, 0x0a, 0x18, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x46, 0x65, - 0x74, 0x63, 0x68, 0x41, 0x73, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x6e, 0x52, 0x0b, 0x61, 0x66, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x19, + 0x0a, 0x08, 0x73, 0x71, 0x6c, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x73, 0x71, 0x6c, 0x4d, 0x6f, 0x64, 0x65, 0x22, 0xa7, 0x01, 0x0a, 0x13, 0x41, 0x70, + 0x70, 0x6c, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x5f, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x62, + 0x65, 0x66, 0x6f, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x46, 0x0a, 0x0c, 0x61, + 0x66, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x23, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65, 0x66, 0x69, + 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x66, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x22, 0x13, 0x0a, 0x11, 0x4c, 0x6f, 0x63, 0x6b, 0x54, 0x61, 0x62, 0x6c, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x14, 0x0a, 0x12, 0x4c, 0x6f, 0x63, 0x6b, + 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, + 0x0a, 0x13, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x16, 0x0a, 0x14, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x54, + 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5f, 0x0a, + 0x13, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x6f, 0x77, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x52, 0x6f, 0x77, 0x73, 0x22, 0x42, + 0x0a, 0x14, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x22, 0xb2, 0x01, 0x0a, 0x18, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x46, 0x65, + 0x74, 0x63, 0x68, 0x41, 0x73, 0x44, 0x62, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x6f, 0x77, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x52, 0x6f, 0x77, 0x73, - 0x22, 0x47, 0x0a, 0x19, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x46, 0x65, 0x74, 0x63, 0x68, - 0x41, 0x73, 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, - 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1a, 0x0a, 0x18, 0x52, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4c, 0x0a, 0x19, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x22, 0x16, 0x0a, 0x14, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4f, 0x0a, 0x15, 0x50, - 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x18, 0x0a, 0x16, - 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x35, 0x0a, 0x17, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, - 0x79, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x34, 0x0a, - 0x16, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x19, 0x0a, 0x17, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x50, 0x6f, - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, - 0x0a, 0x16, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x19, 0x0a, 0x17, 0x53, 0x74, 0x6f, 0x70, - 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x5e, 0x0a, 0x1d, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x77, 0x61, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, - 0x6f, 0x75, 0x74, 0x22, 0x3c, 0x0a, 0x1e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0x19, 0x0a, 0x17, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1a, 0x0a, 0x18, - 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x62, 0x0a, 0x21, 0x53, 0x74, 0x61, 0x72, - 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x6e, 0x74, 0x69, - 0x6c, 0x41, 0x66, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x61, 0x69, - 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0b, 0x77, 0x61, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x24, 0x0a, 0x22, - 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x55, 0x6e, 0x74, 0x69, 0x6c, 0x41, 0x66, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x2b, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, - 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, - 0x61, 0x64, 0x64, 0x72, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x1a, 0x0a, 0x18, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x0a, 0x17, - 0x56, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x65, 0x63, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x46, 0x0a, - 0x18, 0x56, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x65, - 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x73, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, + 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x07, 0x6d, 0x61, 0x78, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x69, 0x73, + 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x6c, 0x6f, + 0x67, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x72, 0x65, 0x6c, 0x6f, 0x61, + 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x47, 0x0a, 0x19, 0x45, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x65, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x73, 0x44, 0x62, 0x61, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x22, 0x8e, 0x01, 0x0a, 0x1d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x46, 0x65, 0x74, 0x63, + 0x68, 0x41, 0x73, 0x41, 0x6c, 0x6c, 0x50, 0x72, 0x69, 0x76, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x23, 0x0a, 0x0d, + 0x72, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0c, 0x72, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x22, 0x4c, 0x0a, 0x1e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x46, 0x65, 0x74, 0x63, + 0x68, 0x41, 0x73, 0x41, 0x6c, 0x6c, 0x50, 0x72, 0x69, 0x76, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, + 0x4b, 0x0a, 0x18, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, + 0x73, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x52, 0x6f, 0x77, 0x73, 0x22, 0x47, 0x0a, 0x19, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x73, 0x41, 0x70, + 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x4b, 0x0a, 0x1d, 0x56, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x50, 0x6f, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0x20, 0x0a, 0x1e, 0x56, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x50, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x49, 0x6e, 0x69, 0x74, 0x50, 0x72, 0x69, 0x6d, - 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x31, 0x0a, 0x13, 0x49, 0x6e, - 0x69, 0x74, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1a, 0x0a, 0x18, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x22, 0x4c, 0x0a, 0x19, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, + 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, + 0x16, 0x0a, 0x14, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4f, 0x0a, 0x15, 0x50, 0x72, 0x69, 0x6d, 0x61, + 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x36, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, + 0x74, 0x61, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x50, 0x72, 0x69, 0x6d, + 0x61, 0x72, 0x79, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x35, 0x0a, 0x17, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x50, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x34, 0x0a, 0x16, 0x57, 0x61, 0x69, + 0x74, 0x46, 0x6f, 0x72, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x19, 0x0a, 0x17, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x0a, 0x16, 0x53, 0x74, + 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x22, 0x19, 0x0a, 0x17, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x5e, 0x0a, 0x1d, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, + 0x77, 0x61, 0x69, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0b, 0x77, 0x61, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, + 0x3c, 0x0a, 0x1e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xd8, 0x01, - 0x0a, 0x1e, 0x50, 0x6f, 0x70, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x61, 0x72, 0x65, - 0x6e, 0x74, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x5f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x74, 0x69, 0x6d, 0x65, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x0d, 0x70, 0x72, 0x69, - 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x15, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x61, 0x62, 0x6c, - 0x65, 0x74, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x0c, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, - 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x35, 0x0a, + 0x17, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x69, + 0x53, 0x79, 0x6e, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x73, 0x65, 0x6d, 0x69, + 0x53, 0x79, 0x6e, 0x63, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x62, 0x0a, 0x21, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x6e, 0x74, 0x69, 0x6c, 0x41, 0x66, 0x74, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x77, 0x61, 0x69, 0x74, 0x54, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x22, 0x24, 0x0a, 0x22, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x6e, 0x74, 0x69, 0x6c, 0x41, 0x66, 0x74, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x2b, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x22, 0x19, 0x0a, + 0x17, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1a, 0x0a, 0x18, 0x52, 0x65, 0x73, 0x65, + 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x0a, 0x17, 0x56, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x46, 0x0a, 0x18, 0x56, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x4b, 0x0a, + 0x1d, 0x56, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x61, 0x69, + 0x74, 0x46, 0x6f, 0x72, 0x50, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, + 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x20, 0x0a, 0x1e, 0x56, 0x52, + 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, + 0x72, 0x50, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x0a, 0x12, + 0x49, 0x6e, 0x69, 0x74, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x69, 0x53, 0x79, 0x6e, 0x63, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x73, 0x65, 0x6d, 0x69, 0x53, 0x79, 0x6e, 0x63, 0x22, 0x31, + 0x0a, 0x13, 0x49, 0x6e, 0x69, 0x74, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0xd8, 0x01, 0x0a, 0x1e, 0x50, 0x6f, 0x70, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x74, + 0x69, 0x6d, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x3a, 0x0a, + 0x0d, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, + 0x54, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x0c, 0x70, 0x72, 0x69, + 0x6d, 0x61, 0x72, 0x79, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x72, 0x65, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x21, 0x0a, 0x1f, + 0x50, 0x6f, 0x70, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0xba, 0x01, 0x0a, 0x12, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x64, 0x61, 0x74, + 0x61, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x06, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x14, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x21, 0x0a, 0x1f, 0x50, 0x6f, 0x70, 0x75, - 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x4a, 0x6f, 0x75, 0x72, - 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x12, - 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x61, - 0x62, 0x6c, 0x65, 0x74, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x12, 0x31, 0x0a, 0x14, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x13, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x73, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x74, - 0x69, 0x6d, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x22, 0x15, 0x0a, 0x13, + 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, + 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0d, 0x74, 0x69, 0x6d, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, + 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x69, 0x53, 0x79, 0x6e, 0x63, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x08, 0x73, 0x65, 0x6d, 0x69, 0x53, 0x79, 0x6e, 0x63, 0x22, 0x15, 0x0a, 0x13, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x0a, 0x14, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x15, @@ -5036,91 +5103,96 @@ var file_tabletmanagerdata_proto_rawDesc = []byte{ 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x55, 0x6e, 0x64, 0x6f, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, - 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x0a, - 0x19, 0x55, 0x6e, 0x64, 0x6f, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x69, 0x6d, 0x61, - 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x0a, 0x19, 0x52, 0x65, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x57, 0x61, 0x73, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x1a, 0x52, 0x65, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x57, 0x61, 0x73, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd1, 0x01, 0x0a, 0x1b, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x64, 0x61, 0x74, 0x61, - 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x06, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x74, - 0x69, 0x6d, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x12, 0x36, 0x0a, 0x17, - 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x72, 0x65, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x66, - 0x6f, 0x72, 0x63, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x77, 0x61, 0x69, - 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x1e, 0x0a, 0x1c, 0x53, 0x65, 0x74, - 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4b, 0x0a, 0x1a, 0x52, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x57, 0x61, 0x73, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x64, 0x61, - 0x74, 0x61, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x06, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x1d, 0x0a, 0x1b, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x57, 0x61, 0x73, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7e, 0x0a, 0x22, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x47, 0x65, 0x74, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x58, 0x0a, 0x15, 0x73, - 0x74, 0x6f, 0x70, 0x5f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x72, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74, 0x6f, - 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x6f, 0x64, 0x65, - 0x52, 0x13, 0x73, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x22, 0xa7, 0x01, 0x0a, 0x23, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x47, 0x65, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, - 0x0d, 0x68, 0x79, 0x62, 0x72, 0x69, 0x64, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x02, 0x18, - 0x01, 0x52, 0x0c, 0x68, 0x79, 0x62, 0x72, 0x69, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x3e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x26, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, - 0x61, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, - 0x17, 0x0a, 0x15, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x34, 0x0a, 0x16, 0x50, 0x72, 0x6f, 0x6d, - 0x6f, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x56, - 0x0a, 0x0d, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, - 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x72, 0x69, 0x6d, 0x61, - 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, - 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x22, 0x36, 0x0a, 0x0e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6c, 0x6f, 0x67, 0x75, 0x74, 0x69, - 0x6c, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x49, - 0x0a, 0x18, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x61, 0x63, - 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x0b, 0x62, 0x61, - 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0c, 0x2e, 0x76, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x62, - 0x61, 0x63, 0x6b, 0x75, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x41, 0x0a, 0x19, 0x52, 0x65, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6c, 0x6f, 0x67, 0x75, 0x74, 0x69, 0x6c, 0x2e, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x5c, 0x0a, 0x0c, - 0x56, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, - 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, - 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1a, - 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x3b, 0x0a, 0x0d, 0x56, 0x45, - 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, - 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x30, 0x5a, 0x2e, 0x76, 0x69, 0x74, 0x65, 0x73, - 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x69, 0x74, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x76, - 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x73, 0x22, 0x36, 0x0a, 0x18, 0x55, 0x6e, 0x64, 0x6f, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, + 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, + 0x08, 0x73, 0x65, 0x6d, 0x69, 0x53, 0x79, 0x6e, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x73, 0x65, 0x6d, 0x69, 0x53, 0x79, 0x6e, 0x63, 0x22, 0x1b, 0x0a, 0x19, 0x55, 0x6e, 0x64, + 0x6f, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x0a, 0x19, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x57, 0x61, 0x73, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x1a, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x57, 0x61, + 0x73, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0xed, 0x01, 0x0a, 0x1b, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x61, 0x62, + 0x6c, 0x65, 0x74, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x74, 0x69, 0x6d, 0x65, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x66, 0x6f, 0x72, 0x63, + 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x66, 0x6f, 0x72, 0x63, 0x65, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x23, 0x0a, 0x0d, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x77, 0x61, 0x69, 0x74, 0x50, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x69, 0x53, 0x79, 0x6e, + 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x73, 0x65, 0x6d, 0x69, 0x53, 0x79, 0x6e, + 0x63, 0x22, 0x1e, 0x0a, 0x1c, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x4b, 0x0a, 0x1a, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x57, 0x61, 0x73, 0x52, + 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, + 0x74, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x1d, + 0x0a, 0x1b, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x57, 0x61, 0x73, 0x52, 0x65, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7e, 0x0a, + 0x22, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x41, 0x6e, 0x64, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x58, 0x0a, 0x15, 0x73, 0x74, 0x6f, 0x70, 0x5f, 0x72, 0x65, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x13, 0x73, 0x74, 0x6f, 0x70, 0x52, 0x65, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x22, 0xa7, 0x01, + 0x0a, 0x23, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x41, 0x6e, 0x64, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x68, 0x79, 0x62, 0x72, 0x69, 0x64, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x72, + 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0c, 0x68, 0x79, 0x62, 0x72, 0x69, + 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x33, 0x0a, 0x15, 0x50, 0x72, 0x6f, 0x6d, 0x6f, + 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x69, 0x53, 0x79, 0x6e, 0x63, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x08, 0x73, 0x65, 0x6d, 0x69, 0x53, 0x79, 0x6e, 0x63, 0x22, 0x34, 0x0a, 0x16, + 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x56, 0x0a, 0x0d, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, + 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, + 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x61, 0x6c, + 0x6c, 0x6f, 0x77, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x22, 0x36, 0x0a, 0x0e, 0x42, 0x61, + 0x63, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x05, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6c, 0x6f, + 0x67, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x22, 0x49, 0x0a, 0x18, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x46, 0x72, 0x6f, + 0x6d, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, + 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x76, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x52, 0x0a, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x41, 0x0a, + 0x19, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x61, 0x63, 0x6b, + 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x05, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6c, 0x6f, 0x67, 0x75, + 0x74, 0x69, 0x6c, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x22, 0x5c, 0x0a, 0x0c, 0x56, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, + 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, + 0x6f, 0x77, 0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x3b, + 0x0a, 0x0d, 0x56, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x30, 0x5a, 0x2e, 0x76, + 0x69, 0x74, 0x65, 0x73, 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x69, 0x74, 0x65, 0x73, 0x73, 0x2f, + 0x67, 0x6f, 0x2f, 0x76, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/go/vt/proto/tabletmanagerdata/tabletmanagerdata_vtproto.pb.go b/go/vt/proto/tabletmanagerdata/tabletmanagerdata_vtproto.pb.go index 4a7918b064e..05c967f754a 100644 --- a/go/vt/proto/tabletmanagerdata/tabletmanagerdata_vtproto.pb.go +++ b/go/vt/proto/tabletmanagerdata/tabletmanagerdata_vtproto.pb.go @@ -1043,6 +1043,16 @@ func (m *ChangeTypeRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.SemiSync { + i-- + if m.SemiSync { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } if m.TabletType != 0 { i = encodeVarint(dAtA, i, uint64(m.TabletType)) i-- @@ -2603,6 +2613,16 @@ func (m *StartReplicationRequest) MarshalToSizedBufferVT(dAtA []byte) (int, erro i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.SemiSync { + i-- + if m.SemiSync { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -3049,6 +3069,16 @@ func (m *InitPrimaryRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.SemiSync { + i-- + if m.SemiSync { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -3217,6 +3247,16 @@ func (m *InitReplicaRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.SemiSync { + i-- + if m.SemiSync { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if m.TimeCreatedNs != 0 { i = encodeVarint(dAtA, i, uint64(m.TimeCreatedNs)) i-- @@ -3388,6 +3428,16 @@ func (m *UndoDemotePrimaryRequest) MarshalToSizedBufferVT(dAtA []byte) (int, err i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.SemiSync { + i-- + if m.SemiSync { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -3520,6 +3570,16 @@ func (m *SetReplicationSourceRequest) MarshalToSizedBufferVT(dAtA []byte) (int, i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.SemiSync { + i-- + if m.SemiSync { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } if len(m.WaitPosition) > 0 { i -= len(m.WaitPosition) copy(dAtA[i:], m.WaitPosition) @@ -3785,6 +3845,16 @@ func (m *PromoteReplicaRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.SemiSync { + i-- + if m.SemiSync { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -4534,6 +4604,9 @@ func (m *ChangeTypeRequest) SizeVT() (n int) { if m.TabletType != 0 { n += 1 + sov(uint64(m.TabletType)) } + if m.SemiSync { + n += 2 + } if m.unknownFields != nil { n += len(m.unknownFields) } @@ -5132,6 +5205,9 @@ func (m *StartReplicationRequest) SizeVT() (n int) { } var l int _ = l + if m.SemiSync { + n += 2 + } if m.unknownFields != nil { n += len(m.unknownFields) } @@ -5304,6 +5380,9 @@ func (m *InitPrimaryRequest) SizeVT() (n int) { } var l int _ = l + if m.SemiSync { + n += 2 + } if m.unknownFields != nil { n += len(m.unknownFields) } @@ -5382,6 +5461,9 @@ func (m *InitReplicaRequest) SizeVT() (n int) { if m.TimeCreatedNs != 0 { n += 1 + sov(uint64(m.TimeCreatedNs)) } + if m.SemiSync { + n += 2 + } if m.unknownFields != nil { n += len(m.unknownFields) } @@ -5438,6 +5520,9 @@ func (m *UndoDemotePrimaryRequest) SizeVT() (n int) { } var l int _ = l + if m.SemiSync { + n += 2 + } if m.unknownFields != nil { n += len(m.unknownFields) } @@ -5500,6 +5585,9 @@ func (m *SetReplicationSourceRequest) SizeVT() (n int) { if l > 0 { n += 1 + l + sov(uint64(l)) } + if m.SemiSync { + n += 2 + } if m.unknownFields != nil { n += len(m.unknownFields) } @@ -5587,6 +5675,9 @@ func (m *PromoteReplicaRequest) SizeVT() (n int) { } var l int _ = l + if m.SemiSync { + n += 2 + } if m.unknownFields != nil { n += len(m.unknownFields) } @@ -8205,6 +8296,26 @@ func (m *ChangeTypeRequest) UnmarshalVT(dAtA []byte) error { break } } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SemiSync", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SemiSync = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -11252,6 +11363,26 @@ func (m *StartReplicationRequest) UnmarshalVT(dAtA []byte) error { return fmt.Errorf("proto: StartReplicationRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SemiSync", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SemiSync = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -12066,6 +12197,26 @@ func (m *InitPrimaryRequest) UnmarshalVT(dAtA []byte) error { return fmt.Errorf("proto: InitPrimaryRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SemiSync", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SemiSync = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -12508,6 +12659,26 @@ func (m *InitReplicaRequest) UnmarshalVT(dAtA []byte) error { break } } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SemiSync", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SemiSync = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -12780,6 +12951,26 @@ func (m *UndoDemotePrimaryRequest) UnmarshalVT(dAtA []byte) error { return fmt.Errorf("proto: UndoDemotePrimaryRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SemiSync", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SemiSync = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -13091,6 +13282,26 @@ func (m *SetReplicationSourceRequest) UnmarshalVT(dAtA []byte) error { } m.WaitPosition = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SemiSync", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SemiSync = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) @@ -13524,6 +13735,26 @@ func (m *PromoteReplicaRequest) UnmarshalVT(dAtA []byte) error { return fmt.Errorf("proto: PromoteReplicaRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SemiSync", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SemiSync = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) diff --git a/go/vt/vtcombo/tablet_map.go b/go/vt/vtcombo/tablet_map.go index 8b0c12f728f..523f3b0beb9 100644 --- a/go/vt/vtcombo/tablet_map.go +++ b/go/vt/vtcombo/tablet_map.go @@ -124,7 +124,8 @@ func CreateTablet( } if tabletType == topodatapb.TabletType_PRIMARY { - if err := tm.ChangeType(ctx, topodatapb.TabletType_PRIMARY); err != nil { + // Semi-sync has to be set to false, since we have 1 single backing MySQL + if err := tm.ChangeType(ctx, topodatapb.TabletType_PRIMARY /* semi-sync */, false); err != nil { return fmt.Errorf("TabletExternallyReparented failed on primary %v: %v", topoproto.TabletAliasString(alias), err) } } @@ -805,12 +806,12 @@ func (itmc *internalTabletManagerClient) SetReadWrite(ctx context.Context, table return fmt.Errorf("not implemented in vtcombo") } -func (itmc *internalTabletManagerClient) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType) error { +func (itmc *internalTabletManagerClient) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType, semiSync bool) error { t, ok := tabletMap[tablet.Alias.Uid] if !ok { return fmt.Errorf("tmclient: cannot find tablet %v", tablet.Alias.Uid) } - t.tm.ChangeType(ctx, dbType) + t.tm.ChangeType(ctx, dbType, semiSync) return nil } @@ -929,11 +930,11 @@ func (itmc *internalTabletManagerClient) ResetReplication(context.Context, *topo return fmt.Errorf("not implemented in vtcombo") } -func (itmc *internalTabletManagerClient) InitMaster(context.Context, *topodatapb.Tablet) (string, error) { +func (itmc *internalTabletManagerClient) InitMaster(context.Context, *topodatapb.Tablet, bool) (string, error) { return "", fmt.Errorf("not implemented in vtcombo") } -func (itmc *internalTabletManagerClient) InitPrimary(context.Context, *topodatapb.Tablet) (string, error) { +func (itmc *internalTabletManagerClient) InitPrimary(context.Context, *topodatapb.Tablet, bool) (string, error) { return "", fmt.Errorf("not implemented in vtcombo") } @@ -945,7 +946,7 @@ func (itmc *internalTabletManagerClient) DemoteMaster(context.Context, *topodata return nil, fmt.Errorf("not implemented in vtcombo") } -func (itmc *internalTabletManagerClient) UndoDemoteMaster(context.Context, *topodatapb.Tablet) error { +func (itmc *internalTabletManagerClient) UndoDemoteMaster(context.Context, *topodatapb.Tablet, bool) error { return fmt.Errorf("not implemented in vtcombo") } @@ -953,15 +954,15 @@ func (itmc *internalTabletManagerClient) DemotePrimary(context.Context, *topodat return nil, fmt.Errorf("not implemented in vtcombo") } -func (itmc *internalTabletManagerClient) UndoDemotePrimary(context.Context, *topodatapb.Tablet) error { +func (itmc *internalTabletManagerClient) UndoDemotePrimary(context.Context, *topodatapb.Tablet, bool) error { return fmt.Errorf("not implemented in vtcombo") } -func (itmc *internalTabletManagerClient) SetMaster(context.Context, *topodatapb.Tablet, *topodatapb.TabletAlias, int64, string, bool) error { +func (itmc *internalTabletManagerClient) SetMaster(context.Context, *topodatapb.Tablet, *topodatapb.TabletAlias, int64, string, bool, bool) error { return fmt.Errorf("not implemented in vtcombo") } -func (itmc *internalTabletManagerClient) SetReplicationSource(context.Context, *topodatapb.Tablet, *topodatapb.TabletAlias, int64, string, bool) error { +func (itmc *internalTabletManagerClient) SetReplicationSource(context.Context, *topodatapb.Tablet, *topodatapb.TabletAlias, int64, string, bool, bool) error { return fmt.Errorf("not implemented in vtcombo") } @@ -969,7 +970,7 @@ func (itmc *internalTabletManagerClient) StopReplicationAndGetStatus(context.Con return nil, nil, fmt.Errorf("not implemented in vtcombo") } -func (itmc *internalTabletManagerClient) PromoteReplica(context.Context, *topodatapb.Tablet) (string, error) { +func (itmc *internalTabletManagerClient) PromoteReplica(context.Context, *topodatapb.Tablet, bool) (string, error) { return "", fmt.Errorf("not implemented in vtcombo") } @@ -996,7 +997,7 @@ func (itmc *internalTabletManagerClient) StopReplicationMinimum(context.Context, return "", fmt.Errorf("not implemented in vtcombo") } -func (itmc *internalTabletManagerClient) StartReplication(context.Context, *topodatapb.Tablet) error { +func (itmc *internalTabletManagerClient) StartReplication(context.Context, *topodatapb.Tablet, bool) error { return fmt.Errorf("not implemented in vtcombo") } @@ -1008,7 +1009,7 @@ func (itmc *internalTabletManagerClient) GetReplicas(context.Context, *topodatap return nil, fmt.Errorf("not implemented in vtcombo") } -func (itmc *internalTabletManagerClient) InitReplica(context.Context, *topodatapb.Tablet, *topodatapb.TabletAlias, string, int64) error { +func (itmc *internalTabletManagerClient) InitReplica(context.Context, *topodatapb.Tablet, *topodatapb.TabletAlias, string, int64, bool) error { return fmt.Errorf("not implemented in vtcombo") } diff --git a/go/vt/vtctl/grpcvtctldserver/endtoend/init_shard_primary_test.go b/go/vt/vtctl/grpcvtctldserver/endtoend/init_shard_primary_test.go index 52aad94d9a6..270f09e139c 100644 --- a/go/vt/vtctl/grpcvtctldserver/endtoend/init_shard_primary_test.go +++ b/go/vt/vtctl/grpcvtctldserver/endtoend/init_shard_primary_test.go @@ -29,6 +29,7 @@ import ( "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/topo/memorytopo" "vitess.io/vitess/go/vt/vtctl/grpcvtctldserver" + "vitess.io/vitess/go/vt/vtctl/reparentutil" "vitess.io/vitess/go/vt/vttablet/tabletservermock" "vitess.io/vitess/go/vt/vttablet/tmclient" "vitess.io/vitess/go/vt/wrangler" @@ -42,6 +43,7 @@ func TestInitShardPrimary(t *testing.T) { ts := memorytopo.NewServer("cell1") tmc := tmclient.NewTabletManagerClient() wr := wrangler.New(logutil.NewConsoleLogger(), ts, tmc) + _ = reparentutil.SetDurabilityPolicy("none", nil) primaryDb := fakesqldb.New(t) primaryDb.AddQuery("create database if not exists `vt_test_keyspace`", &sqltypes.Result{InsertID: 0, RowsAffected: 0}) @@ -101,6 +103,7 @@ func TestInitShardPrimaryNoFormerPrimary(t *testing.T) { ts := memorytopo.NewServer("cell1") tmc := tmclient.NewTabletManagerClient() wr := wrangler.New(logutil.NewConsoleLogger(), ts, tmc) + _ = reparentutil.SetDurabilityPolicy("none", nil) primaryDb := fakesqldb.New(t) primaryDb.AddQuery("create database if not exists `vt_test_keyspace`", &sqltypes.Result{InsertID: 0, RowsAffected: 0}) diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index d938f4864ed..18e00c0ffa3 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -260,7 +260,33 @@ func (s *VtctldServer) ChangeTabletType(ctx context.Context, req *vtctldatapb.Ch }, nil } - err = s.tmc.ChangeType(ctx, tablet.Tablet, req.DbType) + shard, err := s.ts.GetShard(ctx, tablet.Keyspace, tablet.Shard) + if err != nil { + return nil, err + } + + if !shard.HasPrimary() { + return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "no primary tablet for shard %v/%v", tablet.Keyspace, tablet.Shard) + } + + shardPrimary, err := s.ts.GetTablet(ctx, shard.PrimaryAlias) + if err != nil { + return nil, fmt.Errorf("cannot lookup primary tablet %v for shard %v/%v: %w", topoproto.TabletAliasString(shard.PrimaryAlias), tablet.Keyspace, tablet.Shard, err) + } + + if shardPrimary.Type != topodatapb.TabletType_PRIMARY { + return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "TopologyServer has incosistent state for shard primary %v", topoproto.TabletAliasString(shard.PrimaryAlias)) + } + + if shardPrimary.Keyspace != tablet.Keyspace || shardPrimary.Shard != tablet.Shard { + return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "primary %v and potential replica %v not in same keypace shard (%v/%v)", topoproto.TabletAliasString(shard.PrimaryAlias), req.TabletAlias, tablet.Keyspace, tablet.Shard) + } + + // We should clone the tablet and change its type to the expected type before checking the durability rules + // Since we want to check the durability rules for the desired state and not before we make that change + expectedTablet := proto.Clone(tablet.Tablet).(*topodatapb.Tablet) + expectedTablet.Type = req.DbType + err = s.tmc.ChangeType(ctx, tablet.Tablet, req.DbType, reparentutil.IsReplicaSemiSync(shardPrimary.Tablet, expectedTablet)) if err != nil { return nil, err } @@ -1463,7 +1489,7 @@ func (s *VtctldServer) InitShardPrimaryLocked( // position logger.Infof("initializing primary on %v", topoproto.TabletAliasString(req.PrimaryElectTabletAlias)) event.DispatchUpdate(ev, "initializing primary") - rp, err := tmc.InitPrimary(ctx, primaryElectTabletInfo.Tablet) + rp, err := tmc.InitPrimary(ctx, primaryElectTabletInfo.Tablet, reparentutil.SemiSyncAckers(primaryElectTabletInfo.Tablet) > 0) if err != nil { return err } @@ -1504,7 +1530,7 @@ func (s *VtctldServer) InitShardPrimaryLocked( go func(alias string, tabletInfo *topo.TabletInfo) { defer wgReplicas.Done() logger.Infof("initializing replica %v", alias) - if err := tmc.InitReplica(replCtx, tabletInfo.Tablet, req.PrimaryElectTabletAlias, rp, now); err != nil { + if err := tmc.InitReplica(replCtx, tabletInfo.Tablet, req.PrimaryElectTabletAlias, rp, now, reparentutil.IsReplicaSemiSync(primaryElectTabletInfo.Tablet, tabletInfo.Tablet)); err != nil { rec.RecordError(fmt.Errorf("tablet %v InitReplica failed: %v", alias, err)) } }(alias, tabletInfo) @@ -1923,7 +1949,7 @@ func (s *VtctldServer) ReparentTablet(ctx context.Context, req *vtctldatapb.Repa return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "cannot ReparentTablet current shard primary (%v) onto itself", topoproto.TabletAliasString(req.Tablet)) } - if err := s.tmc.SetReplicationSource(ctx, tablet.Tablet, shard.PrimaryAlias, 0, "", false); err != nil { + if err := s.tmc.SetReplicationSource(ctx, tablet.Tablet, shard.PrimaryAlias, 0, "", false, reparentutil.IsReplicaSemiSync(shardPrimary.Tablet, tablet.Tablet)); err != nil { return nil, err } @@ -2340,7 +2366,29 @@ func (s *VtctldServer) StartReplication(ctx context.Context, req *vtctldatapb.St return nil, err } - if err := s.tmc.StartReplication(ctx, tablet.Tablet); err != nil { + shard, err := s.ts.GetShard(ctx, tablet.Keyspace, tablet.Shard) + if err != nil { + return nil, err + } + + if !shard.HasPrimary() { + return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "no primary tablet for shard %v/%v", tablet.Keyspace, tablet.Shard) + } + + shardPrimary, err := s.ts.GetTablet(ctx, shard.PrimaryAlias) + if err != nil { + return nil, fmt.Errorf("cannot lookup primary tablet %v for shard %v/%v: %w", topoproto.TabletAliasString(shard.PrimaryAlias), tablet.Keyspace, tablet.Shard, err) + } + + if shardPrimary.Type != topodatapb.TabletType_PRIMARY { + return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "TopologyServer has incosistent state for shard primary %v", topoproto.TabletAliasString(shard.PrimaryAlias)) + } + + if shardPrimary.Keyspace != tablet.Keyspace || shardPrimary.Shard != tablet.Shard { + return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "primary %v and replica %v not in same keypace shard (%v/%v)", topoproto.TabletAliasString(shard.PrimaryAlias), topoproto.TabletAliasString(tablet.Alias), tablet.Keyspace, tablet.Shard) + } + + if err := s.tmc.StartReplication(ctx, tablet.Tablet, reparentutil.IsReplicaSemiSync(shardPrimary.Tablet, tablet.Tablet)); err != nil { log.Errorf("StartReplication: failed to start replication on %v: %v", alias, err) return nil, err } @@ -2429,7 +2477,7 @@ func (s *VtctldServer) TabletExternallyReparented(ctx context.Context, req *vtct event.DispatchUpdate(ev, "starting external reparent") - if err := s.tmc.ChangeType(ctx, tablet.Tablet, topodatapb.TabletType_PRIMARY); err != nil { + if err := s.tmc.ChangeType(ctx, tablet.Tablet, topodatapb.TabletType_PRIMARY, reparentutil.SemiSyncAckers(tablet.Tablet) > 0); err != nil { log.Warningf("ChangeType(%v, PRIMARY): %v", topoproto.TabletAliasString(req.Tablet), err) return nil, err } diff --git a/go/vt/vtctl/grpcvtctldserver/server_test.go b/go/vt/vtctl/grpcvtctldserver/server_test.go index e8af50cbb39..7cf80f081e9 100644 --- a/go/vt/vtctl/grpcvtctldserver/server_test.go +++ b/go/vt/vtctl/grpcvtctldserver/server_test.go @@ -503,7 +503,17 @@ func TestChangeTabletType(t *testing.T) { Cell: "zone1", Uid: 100, }, - Type: topodatapb.TabletType_REPLICA, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_REPLICA, + }, { + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 101, + }, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_PRIMARY, }, }, req: &vtctldatapb.ChangeTabletTypeRequest{ @@ -519,14 +529,18 @@ func TestChangeTabletType(t *testing.T) { Cell: "zone1", Uid: 100, }, - Type: topodatapb.TabletType_REPLICA, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_REPLICA, }, AfterTablet: &topodatapb.Tablet{ Alias: &topodatapb.TabletAlias{ Cell: "zone1", Uid: 100, }, - Type: topodatapb.TabletType_RDONLY, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_RDONLY, }, WasDryRun: false, }, @@ -541,7 +555,17 @@ func TestChangeTabletType(t *testing.T) { Cell: "zone1", Uid: 100, }, - Type: topodatapb.TabletType_REPLICA, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_REPLICA, + }, { + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 101, + }, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_PRIMARY, }, }, req: &vtctldatapb.ChangeTabletTypeRequest{ @@ -558,14 +582,18 @@ func TestChangeTabletType(t *testing.T) { Cell: "zone1", Uid: 100, }, - Type: topodatapb.TabletType_REPLICA, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_REPLICA, }, AfterTablet: &topodatapb.Tablet{ Alias: &topodatapb.TabletAlias{ Cell: "zone1", Uid: 100, }, - Type: topodatapb.TabletType_RDONLY, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_RDONLY, }, WasDryRun: true, }, @@ -580,7 +608,17 @@ func TestChangeTabletType(t *testing.T) { Cell: "zone1", Uid: 200, }, - Type: topodatapb.TabletType_REPLICA, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_REPLICA, + }, { + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 101, + }, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_PRIMARY, }, }, req: &vtctldatapb.ChangeTabletTypeRequest{ @@ -602,7 +640,17 @@ func TestChangeTabletType(t *testing.T) { Cell: "zone1", Uid: 100, }, - Type: topodatapb.TabletType_REPLICA, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_REPLICA, + }, { + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 101, + }, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_PRIMARY, }, }, req: &vtctldatapb.ChangeTabletTypeRequest{ @@ -624,7 +672,9 @@ func TestChangeTabletType(t *testing.T) { Cell: "zone1", Uid: 100, }, - Type: topodatapb.TabletType_PRIMARY, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_PRIMARY, }, }, req: &vtctldatapb.ChangeTabletTypeRequest{ @@ -651,7 +701,9 @@ func TestChangeTabletType(t *testing.T) { TopoServer: ts, }, func(ts *topo.Server) vtctlservicepb.VtctldServer { return NewVtctldServer(ts) }) - testutil.AddTablets(ctx, t, ts, nil, tt.tablets...) + testutil.AddTablets(ctx, t, ts, &testutil.AddTabletOptions{ + AlsoSetShardPrimary: true, + }, tt.tablets...) resp, err := vtctld.ChangeTabletType(ctx, tt.req) if tt.shouldErr { @@ -699,8 +751,21 @@ func TestChangeTabletType(t *testing.T) { Cell: "zone1", Uid: 100, }, - Type: topodatapb.TabletType_REPLICA, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_REPLICA, }, nil) + testutil.AddTablet(ctx, t, ts, &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 101, + }, + Keyspace: "ks", + Shard: "0", + Type: topodatapb.TabletType_PRIMARY, + }, &testutil.AddTabletOptions{ + AlsoSetShardPrimary: true, + }) _, err := vtctld.ChangeTabletType(ctx, &vtctldatapb.ChangeTabletTypeRequest{ TabletAlias: &topodatapb.TabletAlias{ @@ -8073,6 +8138,14 @@ func TestStartReplication(t *testing.T) { Keyspace: "testkeyspace", Shard: "-", Type: topodatapb.TabletType_REPLICA, + }, { + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 101, + }, + Keyspace: "testkeyspace", + Shard: "-", + Type: topodatapb.TabletType_PRIMARY, }, }, tmc: testutil.TabletManagerClient{ @@ -8099,6 +8172,14 @@ func TestStartReplication(t *testing.T) { Keyspace: "testkeyspace", Shard: "-", Type: topodatapb.TabletType_REPLICA, + }, { + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 101, + }, + Keyspace: "testkeyspace", + Shard: "-", + Type: topodatapb.TabletType_PRIMARY, }, }, tmc: testutil.TabletManagerClient{ @@ -8126,6 +8207,14 @@ func TestStartReplication(t *testing.T) { Keyspace: "testkeyspace", Shard: "-", Type: topodatapb.TabletType_REPLICA, + }, { + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 101, + }, + Keyspace: "testkeyspace", + Shard: "-", + Type: topodatapb.TabletType_PRIMARY, }, }, tmc: testutil.TabletManagerClient{ @@ -8153,6 +8242,14 @@ func TestStartReplication(t *testing.T) { Keyspace: "testkeyspace", Shard: "-", Type: topodatapb.TabletType_REPLICA, + }, { + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 101, + }, + Keyspace: "testkeyspace", + Shard: "-", + Type: topodatapb.TabletType_PRIMARY, }, }, req: &vtctldatapb.StartReplicationRequest{}, @@ -8169,7 +8266,9 @@ func TestStartReplication(t *testing.T) { ts := memorytopo.NewServer(tt.cells...) defer ts.Close() - testutil.AddTablets(ctx, t, ts, nil, tt.tablets...) + testutil.AddTablets(ctx, t, ts, &testutil.AddTabletOptions{ + AlsoSetShardPrimary: true, + }, tt.tablets...) vtctld := testutil.NewVtctldServerWithTabletManagerClient(t, ts, &tt.tmc, func(ts *topo.Server) vtctlservicepb.VtctldServer { return NewVtctldServer(ts) }) diff --git a/go/vt/vtctl/grpcvtctldserver/testutil/test_tmclient.go b/go/vt/vtctl/grpcvtctldserver/testutil/test_tmclient.go index 56fcd0e5322..a3e676e8ded 100644 --- a/go/vt/vtctl/grpcvtctldserver/testutil/test_tmclient.go +++ b/go/vt/vtctl/grpcvtctldserver/testutil/test_tmclient.go @@ -261,7 +261,7 @@ type TabletManagerClient struct { } // ChangeType is part of the tmclient.TabletManagerClient interface. -func (fake *TabletManagerClient) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, newType topodatapb.TabletType) error { +func (fake *TabletManagerClient) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, newType topodatapb.TabletType, semiSync bool) error { if result, ok := fake.ChangeTabletTypeResult[topoproto.TabletAliasString(tablet.Alias)]; ok { return result } @@ -459,7 +459,7 @@ func (fake *TabletManagerClient) PopulateReparentJournal(ctx context.Context, ta } // PromoteReplica is part of the tmclient.TabletManagerClient interface. -func (fake *TabletManagerClient) PromoteReplica(ctx context.Context, tablet *topodatapb.Tablet) (string, error) { +func (fake *TabletManagerClient) PromoteReplica(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) { if fake.PromoteReplicaResults == nil { return "", assert.AnError } @@ -495,7 +495,7 @@ func (fake *TabletManagerClient) PromoteReplica(ctx context.Context, tablet *top } // InitPrimary is part of the tmclient.TabletManagerClient interface. -func (fake *TabletManagerClient) InitPrimary(ctx context.Context, tablet *topodatapb.Tablet) (string, error) { +func (fake *TabletManagerClient) InitPrimary(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) { if fake.InitPrimaryResults == nil { return "", assert.AnError } @@ -627,7 +627,7 @@ func (fake *TabletManagerClient) RunHealthCheck(ctx context.Context, tablet *top } // SetReplicationSource is part of the tmclient.TabletManagerClient interface. -func (fake *TabletManagerClient) SetReplicationSource(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error { +func (fake *TabletManagerClient) SetReplicationSource(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error { if fake.SetReplicationSourceResults == nil { return assert.AnError } @@ -744,7 +744,7 @@ func (fake *TabletManagerClient) Sleep(ctx context.Context, tablet *topodatapb.T } // StartReplication is part of the tmclient.TabletManagerClient interface. -func (fake *TabletManagerClient) StartReplication(ctx context.Context, tablet *topodatapb.Tablet) error { +func (fake *TabletManagerClient) StartReplication(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error { if fake.StartReplicationResults == nil { return assert.AnError } @@ -877,7 +877,7 @@ func (fake *TabletManagerClient) WaitForPosition(ctx context.Context, tablet *to } // UndoDemotePrimary is part of the tmclient.TabletManagerClient interface. -func (fake *TabletManagerClient) UndoDemotePrimary(ctx context.Context, tablet *topodatapb.Tablet) error { +func (fake *TabletManagerClient) UndoDemotePrimary(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error { if fake.UndoDemotePrimaryResults == nil { return assert.AnError } diff --git a/go/vt/vtctl/reparentutil/durability.go b/go/vt/vtctl/reparentutil/durability.go index 8b80cc5cf9f..320df553c47 100644 --- a/go/vt/vtctl/reparentutil/durability.go +++ b/go/vt/vtctl/reparentutil/durability.go @@ -61,7 +61,7 @@ func init() { type durabler interface { promotionRule(*topodatapb.Tablet) promotionrule.CandidatePromotionRule semiSyncAckers(*topodatapb.Tablet) int - replicaSemiSync(primary, replica *topodatapb.Tablet) bool + isReplicaSemiSync(primary, replica *topodatapb.Tablet) bool } func registerDurability(name string, newDurablerFunc newDurabler) { @@ -101,12 +101,12 @@ func SemiSyncAckers(tablet *topodatapb.Tablet) int { return curDurabilityPolicy.semiSyncAckers(tablet) } -// ReplicaSemiSync returns the replica semi-sync setting from the tablet record. +// IsReplicaSemiSync returns the replica semi-sync setting from the tablet record. // Prefer using this function if tablet record is available. -func ReplicaSemiSync(primary, replica *topodatapb.Tablet) bool { +func IsReplicaSemiSync(primary, replica *topodatapb.Tablet) bool { curDurabilityPolicyMutex.Lock() defer curDurabilityPolicyMutex.Unlock() - return curDurabilityPolicy.replicaSemiSync(primary, replica) + return curDurabilityPolicy.isReplicaSemiSync(primary, replica) } //======================================================================= @@ -126,7 +126,7 @@ func (d *durabilityNone) semiSyncAckers(tablet *topodatapb.Tablet) int { return 0 } -func (d *durabilityNone) replicaSemiSync(primary, replica *topodatapb.Tablet) bool { +func (d *durabilityNone) isReplicaSemiSync(primary, replica *topodatapb.Tablet) bool { return false } @@ -148,7 +148,7 @@ func (d *durabilitySemiSync) semiSyncAckers(tablet *topodatapb.Tablet) int { return 1 } -func (d *durabilitySemiSync) replicaSemiSync(primary, replica *topodatapb.Tablet) bool { +func (d *durabilitySemiSync) isReplicaSemiSync(primary, replica *topodatapb.Tablet) bool { switch replica.Type { case topodatapb.TabletType_PRIMARY, topodatapb.TabletType_REPLICA: return true @@ -175,7 +175,7 @@ func (d *durabilityCrossCell) semiSyncAckers(tablet *topodatapb.Tablet) int { return 1 } -func (d *durabilityCrossCell) replicaSemiSync(primary, replica *topodatapb.Tablet) bool { +func (d *durabilityCrossCell) isReplicaSemiSync(primary, replica *topodatapb.Tablet) bool { // Prevent panics. if primary.Alias == nil || replica.Alias == nil { return false @@ -212,7 +212,7 @@ func (d *durabilitySpecified) semiSyncAckers(tablet *topodatapb.Tablet) int { return 0 } -func (d *durabilitySpecified) replicaSemiSync(primary, replica *topodatapb.Tablet) bool { +func (d *durabilitySpecified) isReplicaSemiSync(primary, replica *topodatapb.Tablet) bool { return false } diff --git a/go/vt/vtctl/reparentutil/durability_test.go b/go/vt/vtctl/reparentutil/durability_test.go index f862b7b6cbe..45c352da2eb 100644 --- a/go/vt/vtctl/reparentutil/durability_test.go +++ b/go/vt/vtctl/reparentutil/durability_test.go @@ -52,7 +52,7 @@ func TestDurabilityNone(t *testing.T) { }) assert.Equal(t, promotionrule.MustNot, promoteRule) assert.Equal(t, 0, SemiSyncAckers(nil)) - assert.Equal(t, false, ReplicaSemiSync(nil, nil)) + assert.Equal(t, false, IsReplicaSemiSync(nil, nil)) } func TestDurabilitySemiSync(t *testing.T) { @@ -79,10 +79,10 @@ func TestDurabilitySemiSync(t *testing.T) { }) assert.Equal(t, promotionrule.MustNot, promoteRule) assert.Equal(t, 1, SemiSyncAckers(nil)) - assert.Equal(t, true, ReplicaSemiSync(nil, &topodatapb.Tablet{ + assert.Equal(t, true, IsReplicaSemiSync(nil, &topodatapb.Tablet{ Type: topodatapb.TabletType_REPLICA, })) - assert.Equal(t, false, ReplicaSemiSync(nil, &topodatapb.Tablet{ + assert.Equal(t, false, IsReplicaSemiSync(nil, &topodatapb.Tablet{ Type: topodatapb.TabletType_EXPERIMENTAL, })) } @@ -111,7 +111,7 @@ func TestDurabilityCrossCell(t *testing.T) { }) assert.Equal(t, promotionrule.MustNot, promoteRule) assert.Equal(t, 1, SemiSyncAckers(nil)) - assert.Equal(t, false, ReplicaSemiSync(&topodatapb.Tablet{ + assert.Equal(t, false, IsReplicaSemiSync(&topodatapb.Tablet{ Type: topodatapb.TabletType_PRIMARY, Alias: &topodatapb.TabletAlias{ Cell: "cell1", @@ -122,7 +122,7 @@ func TestDurabilityCrossCell(t *testing.T) { Cell: "cell1", }, })) - assert.Equal(t, true, ReplicaSemiSync(&topodatapb.Tablet{ + assert.Equal(t, true, IsReplicaSemiSync(&topodatapb.Tablet{ Type: topodatapb.TabletType_PRIMARY, Alias: &topodatapb.TabletAlias{ Cell: "cell1", @@ -133,7 +133,7 @@ func TestDurabilityCrossCell(t *testing.T) { Cell: "cell2", }, })) - assert.Equal(t, false, ReplicaSemiSync(&topodatapb.Tablet{ + assert.Equal(t, false, IsReplicaSemiSync(&topodatapb.Tablet{ Type: topodatapb.TabletType_PRIMARY, Alias: &topodatapb.TabletAlias{ Cell: "cell1", diff --git a/go/vt/vtctl/reparentutil/emergency_reparenter.go b/go/vt/vtctl/reparentutil/emergency_reparenter.go index f83ee7b2895..356e303a806 100644 --- a/go/vt/vtctl/reparentutil/emergency_reparenter.go +++ b/go/vt/vtctl/reparentutil/emergency_reparenter.go @@ -499,7 +499,7 @@ func (erp *EmergencyReparenter) reparentReplicas( forceStart = fs } - err := erp.tmc.SetReplicationSource(replCtx, ti.Tablet, newPrimaryTablet.Alias, 0, "", forceStart) + err := erp.tmc.SetReplicationSource(replCtx, ti.Tablet, newPrimaryTablet.Alias, 0, "", forceStart, IsReplicaSemiSync(newPrimaryTablet, ti.Tablet)) if err != nil { err = vterrors.Wrapf(err, "tablet %v SetReplicationSource failed: %v", alias, err) rec.RecordError(err) @@ -716,11 +716,11 @@ func (erp *EmergencyReparenter) promoteNewPrimary( if ev.ShardInfo.PrimaryAlias == nil { erp.logger.Infof("setting up %v as new primary for an uninitialized cluster", newPrimary.Alias) // we call InitPrimary when the PrimaryAlias in the ShardInfo is empty. This happens when we have an uninitialized cluster. - _, err = erp.tmc.InitPrimary(ctx, newPrimary) + _, err = erp.tmc.InitPrimary(ctx, newPrimary, SemiSyncAckers(newPrimary) > 0) } else { erp.logger.Infof("starting promotion for the new primary - %v", newPrimary.Alias) // we call PromoteReplica which changes the tablet type, fixes the semi-sync, set the primary to read-write and flushes the binlogs - _, err = erp.tmc.PromoteReplica(ctx, newPrimary) + _, err = erp.tmc.PromoteReplica(ctx, newPrimary, SemiSyncAckers(newPrimary) > 0) } if err != nil { return vterrors.Wrapf(err, "primary-elect tablet %v failed to be upgraded to primary: %v", newPrimary.Alias, err) diff --git a/go/vt/vtctl/reparentutil/planned_reparenter.go b/go/vt/vtctl/reparentutil/planned_reparenter.go index 8d089be9a8d..3b1dabeb05c 100644 --- a/go/vt/vtctl/reparentutil/planned_reparenter.go +++ b/go/vt/vtctl/reparentutil/planned_reparenter.go @@ -227,7 +227,7 @@ func (pr *PlannedReparenter) performGracefulPromotion( setSourceCtx, setSourceCancel := context.WithTimeout(ctx, opts.WaitReplicasTimeout) defer setSourceCancel() - if err := pr.tmc.SetReplicationSource(setSourceCtx, primaryElect, currentPrimary.Alias, 0, snapshotPos, true); err != nil { + if err := pr.tmc.SetReplicationSource(setSourceCtx, primaryElect, currentPrimary.Alias, 0, snapshotPos, true, IsReplicaSemiSync(currentPrimary.Tablet, primaryElect)); err != nil { return "", vterrors.Wrapf(err, "replication on primary-elect %v did not catch up in time; replication must be healthy to perform PlannedReparent", primaryElectAliasStr) } @@ -275,7 +275,7 @@ func (pr *PlannedReparenter) performGracefulPromotion( undoCtx, undoCancel := context.WithTimeout(context.Background(), *topo.RemoteOperationTimeout) defer undoCancel() - if undoErr := pr.tmc.UndoDemotePrimary(undoCtx, currentPrimary.Tablet); undoErr != nil { + if undoErr := pr.tmc.UndoDemotePrimary(undoCtx, currentPrimary.Tablet, SemiSyncAckers(currentPrimary.Tablet) > 0); undoErr != nil { pr.logger.Warningf("encountered error while performing UndoDemotePrimary(%v): %v", currentPrimary.AliasString(), undoErr) finalWaitErr = vterrors.Wrapf(finalWaitErr, "encountered error while performing UndoDemotePrimary(%v): %v", currentPrimary.AliasString(), undoErr) } @@ -288,7 +288,7 @@ func (pr *PlannedReparenter) performGracefulPromotion( promoteCtx, promoteCancel := context.WithTimeout(ctx, opts.WaitReplicasTimeout) defer promoteCancel() - rp, err := pr.tmc.PromoteReplica(promoteCtx, primaryElect) + rp, err := pr.tmc.PromoteReplica(promoteCtx, primaryElect, SemiSyncAckers(primaryElect) > 0) if err != nil { return "", vterrors.Wrapf(err, "primary-elect tablet %v failed to be promoted to primary; please try again", primaryElectAliasStr) } @@ -319,7 +319,7 @@ func (pr *PlannedReparenter) performInitialPromotion( // This is done to guarantee safety, in the sense that the semi-sync is on before we start accepting writes. // However, during initialization, it is likely that the database would not be created in the MySQL instance. // Therefore, we have to first set read-write mode, create the database and then fix semi-sync, otherwise we get blocked. - rp, err := pr.tmc.InitPrimary(promoteCtx, primaryElect) + rp, err := pr.tmc.InitPrimary(promoteCtx, primaryElect, SemiSyncAckers(primaryElect) > 0) if err != nil { return "", vterrors.Wrapf(err, "primary-elect tablet %v failed to be promoted to primary; please try again", primaryElectAliasStr) } @@ -485,7 +485,7 @@ func (pr *PlannedReparenter) performPotentialPromotion( promoteCtx, promoteCancel := context.WithTimeout(ctx, *topo.RemoteOperationTimeout) defer promoteCancel() - rp, err := pr.tmc.PromoteReplica(promoteCtx, primaryElect) + rp, err := pr.tmc.PromoteReplica(promoteCtx, primaryElect, SemiSyncAckers(primaryElect) > 0) if err != nil { return "", vterrors.Wrapf(err, "failed to promote %v to primary", primaryElectAliasStr) } @@ -652,7 +652,7 @@ func (pr *PlannedReparenter) reparentTablets( // that it needs to start replication after transitioning from // PRIMARY => REPLICA. forceStartReplication := false - if err := pr.tmc.SetReplicationSource(replCtx, tablet, ev.NewPrimary.Alias, reparentJournalTimestamp, "", forceStartReplication); err != nil { + if err := pr.tmc.SetReplicationSource(replCtx, tablet, ev.NewPrimary.Alias, reparentJournalTimestamp, "", forceStartReplication, IsReplicaSemiSync(ev.NewPrimary, tablet)); err != nil { rec.RecordError(vterrors.Wrapf(err, "tablet %v failed to SetReplicationSource(%v): %v", alias, primaryElectAliasStr, err)) } }(alias, tabletInfo.Tablet) diff --git a/go/vt/vtctld/vtctld.go b/go/vt/vtctld/vtctld.go index b0259bc9c86..8f7a46b95e9 100644 --- a/go/vt/vtctld/vtctld.go +++ b/go/vt/vtctld/vtctld.go @@ -41,7 +41,7 @@ import ( var ( enableRealtimeStats = flag.Bool("enable_realtime_stats", false, "Required for the Realtime Stats view. If set, vtctld will maintain a streaming RPC to each tablet (in all cells) to gather the realtime health stats.") - durability = flag.String("durability", "none", "type of durability to enforce. Default is none. Other values are dictated by registered plugins") + durabilityPolicy = flag.String("durability_policy", "none", "type of durability to enforce. Default is none. Other values are dictated by registered plugins") _ = flag.String("web_dir", "", "NOT USED, here for backward compatibility") _ = flag.String("web_dir2", "", "NOT USED, here for backward compatibility") @@ -53,7 +53,7 @@ const ( // InitVtctld initializes all the vtctld functionality. func InitVtctld(ts *topo.Server) error { - err := reparentutil.SetDurabilityPolicy(*durability, nil) + err := reparentutil.SetDurabilityPolicy(*durabilityPolicy, nil) if err != nil { log.Errorf("error in setting durability policy: %v", err) return err diff --git a/go/vt/vtgr/controller/mock_refresh.go b/go/vt/vtgr/controller/mock_refresh.go index 01a3a097c07..c7329d7138e 100644 --- a/go/vt/vtgr/controller/mock_refresh.go +++ b/go/vt/vtgr/controller/mock_refresh.go @@ -120,7 +120,7 @@ func (m *MockGRTmcClient) EXPECT() *MockGRTmcClientMockRecorder { } // ChangeType mocks base method. -func (m *MockGRTmcClient) ChangeType(ctx context.Context, tablet *topodata.Tablet, dbType topodata.TabletType) error { +func (m *MockGRTmcClient) ChangeType(ctx context.Context, tablet *topodata.Tablet, dbType topodata.TabletType, semiSync bool) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ChangeType", ctx, tablet, dbType) ret0, _ := ret[0].(error) diff --git a/go/vt/vtgr/controller/refresh.go b/go/vt/vtgr/controller/refresh.go index 468fd2bb6e9..6f597729118 100644 --- a/go/vt/vtgr/controller/refresh.go +++ b/go/vt/vtgr/controller/refresh.go @@ -60,7 +60,7 @@ type GRTopo interface { // GRTmcClient is VTGR wrapper for tmc client type GRTmcClient interface { - ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType) error + ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType, semiSync bool) error Ping(ctx context.Context, tablet *topodatapb.Tablet) error } diff --git a/go/vt/vtgr/controller/repair.go b/go/vt/vtgr/controller/repair.go index da8e7133c09..d2d508b1ea0 100644 --- a/go/vt/vtgr/controller/repair.go +++ b/go/vt/vtgr/controller/repair.go @@ -473,7 +473,7 @@ func (shard *GRShard) fixPrimaryTabletLocked(ctx context.Context) error { if err := shard.checkShardLocked(ctx); err != nil { return err } - err := shard.tmc.ChangeType(ctx, candidate.tablet, topodatapb.TabletType_PRIMARY) + err := shard.tmc.ChangeType(ctx, candidate.tablet, topodatapb.TabletType_PRIMARY, false) if err != nil { return fmt.Errorf("failed to change type to primary on %v: %v", candidate.alias, err) } @@ -674,7 +674,7 @@ func (shard *GRShard) failoverLocked(ctx context.Context) error { if err := shard.checkShardLocked(ctx); err != nil { return err } - err = shard.tmc.ChangeType(ctx, candidate.tablet, topodatapb.TabletType_PRIMARY) + err = shard.tmc.ChangeType(ctx, candidate.tablet, topodatapb.TabletType_PRIMARY, false) if err != nil { shard.logger.Errorf("Failed to failover Vitess %v", candidate.alias) return err diff --git a/go/vt/vttablet/faketmclient/fake_client.go b/go/vt/vttablet/faketmclient/fake_client.go index eb6bc014bf6..3080c3122c0 100644 --- a/go/vt/vttablet/faketmclient/fake_client.go +++ b/go/vt/vttablet/faketmclient/fake_client.go @@ -118,7 +118,7 @@ func (client *FakeTabletManagerClient) SetReadWrite(ctx context.Context, tablet } // ChangeType is part of the tmclient.TabletManagerClient interface. -func (client *FakeTabletManagerClient) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType) error { +func (client *FakeTabletManagerClient) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType, semiSync bool) error { return nil } @@ -202,7 +202,7 @@ func (client *FakeTabletManagerClient) PrimaryStatus(ctx context.Context, tablet } // StartReplication is part of the tmclient.TabletManagerClient interface. -func (client *FakeTabletManagerClient) StartReplication(ctx context.Context, tablet *topodatapb.Tablet) error { +func (client *FakeTabletManagerClient) StartReplication(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error { return nil } @@ -217,7 +217,7 @@ func (client *FakeTabletManagerClient) GetReplicas(ctx context.Context, tablet * } // InitReplica is part of the tmclient.TabletManagerClient interface. -func (client *FakeTabletManagerClient) InitReplica(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, replicationPosition string, timeCreatedNS int64) error { +func (client *FakeTabletManagerClient) InitReplica(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, replicationPosition string, timeCreatedNS int64, semiSync bool) error { return nil } @@ -281,12 +281,12 @@ func (client *FakeTabletManagerClient) ResetReplication(ctx context.Context, tab } // InitMaster is part of the tmclient.TabletManagerClient interface. -func (client *FakeTabletManagerClient) InitMaster(ctx context.Context, tablet *topodatapb.Tablet) (string, error) { +func (client *FakeTabletManagerClient) InitMaster(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) { return "", nil } // InitPrimary is part of the tmclient.TabletManagerClient interface. -func (client *FakeTabletManagerClient) InitPrimary(ctx context.Context, tablet *topodatapb.Tablet) (string, error) { +func (client *FakeTabletManagerClient) InitPrimary(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) { return "", nil } @@ -301,7 +301,7 @@ func (client *FakeTabletManagerClient) DemoteMaster(ctx context.Context, tablet } // UndoDemoteMaster is part of the tmclient.TabletManagerClient interface. -func (client *FakeTabletManagerClient) UndoDemoteMaster(ctx context.Context, tablet *topodatapb.Tablet) error { +func (client *FakeTabletManagerClient) UndoDemoteMaster(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error { return nil } @@ -311,17 +311,17 @@ func (client *FakeTabletManagerClient) DemotePrimary(ctx context.Context, tablet } // UndoDemotePrimary is part of the tmclient.TabletManagerClient interface. -func (client *FakeTabletManagerClient) UndoDemotePrimary(ctx context.Context, tablet *topodatapb.Tablet) error { +func (client *FakeTabletManagerClient) UndoDemotePrimary(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error { return nil } // SetMaster is part of the tmclient.TabletManagerClient interface. -func (client *FakeTabletManagerClient) SetMaster(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error { +func (client *FakeTabletManagerClient) SetMaster(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error { return nil } // SetReplicationSource is part of the tmclient.TabletManagerClient interface. -func (client *FakeTabletManagerClient) SetReplicationSource(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error { +func (client *FakeTabletManagerClient) SetReplicationSource(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error { return nil } @@ -331,7 +331,7 @@ func (client *FakeTabletManagerClient) StopReplicationAndGetStatus(ctx context.C } // PromoteReplica is part of the tmclient.TabletManagerClient interface. -func (client *FakeTabletManagerClient) PromoteReplica(ctx context.Context, tablet *topodatapb.Tablet) (string, error) { +func (client *FakeTabletManagerClient) PromoteReplica(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) { return "", nil } diff --git a/go/vt/vttablet/grpctmclient/client.go b/go/vt/vttablet/grpctmclient/client.go index 2072d54bfe0..39e2dd4827a 100644 --- a/go/vt/vttablet/grpctmclient/client.go +++ b/go/vt/vttablet/grpctmclient/client.go @@ -290,7 +290,7 @@ func (client *Client) SetReadWrite(ctx context.Context, tablet *topodatapb.Table } // ChangeType is part of the tmclient.TabletManagerClient interface. -func (client *Client) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType) error { +func (client *Client) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType, semiSync bool) error { c, closer, err := client.dialer.dial(ctx, tablet) if err != nil { return err @@ -298,6 +298,7 @@ func (client *Client) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, defer closer.Close() _, err = c.ChangeType(ctx, &tabletmanagerdatapb.ChangeTypeRequest{ TabletType: dbType, + SemiSync: semiSync, }) return err } @@ -637,13 +638,15 @@ func (client *Client) StopReplicationMinimum(ctx context.Context, tablet *topoda } // StartReplication is part of the tmclient.TabletManagerClient interface. -func (client *Client) StartReplication(ctx context.Context, tablet *topodatapb.Tablet) error { +func (client *Client) StartReplication(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error { c, closer, err := client.dialer.dial(ctx, tablet) if err != nil { return err } defer closer.Close() - _, err = c.StartReplication(ctx, &tabletmanagerdatapb.StartReplicationRequest{}) + _, err = c.StartReplication(ctx, &tabletmanagerdatapb.StartReplicationRequest{ + SemiSync: semiSync, + }) return err } @@ -732,14 +735,16 @@ func (client *Client) ResetReplication(ctx context.Context, tablet *topodatapb.T } // InitMaster is part of the tmclient.TabletManagerClient interface. -func (client *Client) InitMaster(ctx context.Context, tablet *topodatapb.Tablet) (string, error) { +func (client *Client) InitMaster(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) { c, closer, err := client.dialer.dial(ctx, tablet) if err != nil { return "", err } defer closer.Close() - response, err := c.InitMaster(ctx, &tabletmanagerdatapb.InitPrimaryRequest{}) + response, err := c.InitMaster(ctx, &tabletmanagerdatapb.InitPrimaryRequest{ + SemiSync: semiSync, + }) if err != nil { return "", err } @@ -747,14 +752,16 @@ func (client *Client) InitMaster(ctx context.Context, tablet *topodatapb.Tablet) } // InitPrimary is part of the tmclient.TabletManagerClient interface. -func (client *Client) InitPrimary(ctx context.Context, tablet *topodatapb.Tablet) (string, error) { +func (client *Client) InitPrimary(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) { c, closer, err := client.dialer.dial(ctx, tablet) if err != nil { return "", err } defer closer.Close() - response, err := c.InitPrimary(ctx, &tabletmanagerdatapb.InitPrimaryRequest{}) + response, err := c.InitPrimary(ctx, &tabletmanagerdatapb.InitPrimaryRequest{ + SemiSync: semiSync, + }) if err != nil { return "", err } @@ -778,7 +785,7 @@ func (client *Client) PopulateReparentJournal(ctx context.Context, tablet *topod } // InitReplica is part of the tmclient.TabletManagerClient interface. -func (client *Client) InitReplica(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, replicationPosition string, timeCreatedNS int64) error { +func (client *Client) InitReplica(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, replicationPosition string, timeCreatedNS int64, semiSync bool) error { c, closer, err := client.dialer.dial(ctx, tablet) if err != nil { return err @@ -788,6 +795,7 @@ func (client *Client) InitReplica(ctx context.Context, tablet *topodatapb.Tablet Parent: parent, ReplicationPosition: replicationPosition, TimeCreatedNs: timeCreatedNS, + SemiSync: semiSync, }) return err } @@ -838,24 +846,28 @@ func (client *Client) DemotePrimary(ctx context.Context, tablet *topodatapb.Tabl } // UndoDemoteMaster is part of the tmclient.TabletManagerClient interface. -func (client *Client) UndoDemoteMaster(ctx context.Context, tablet *topodatapb.Tablet) error { +func (client *Client) UndoDemoteMaster(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error { c, closer, err := client.dialer.dial(ctx, tablet) if err != nil { return err } defer closer.Close() - _, err = c.UndoDemoteMaster(ctx, &tabletmanagerdatapb.UndoDemotePrimaryRequest{}) + _, err = c.UndoDemoteMaster(ctx, &tabletmanagerdatapb.UndoDemotePrimaryRequest{ + SemiSync: semiSync, + }) return err } // UndoDemotePrimary is part of the tmclient.TabletManagerClient interface. -func (client *Client) UndoDemotePrimary(ctx context.Context, tablet *topodatapb.Tablet) error { +func (client *Client) UndoDemotePrimary(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error { c, closer, err := client.dialer.dial(ctx, tablet) if err != nil { return err } defer closer.Close() - _, err = c.UndoDemotePrimary(ctx, &tabletmanagerdatapb.UndoDemotePrimaryRequest{}) + _, err = c.UndoDemotePrimary(ctx, &tabletmanagerdatapb.UndoDemotePrimaryRequest{ + SemiSync: semiSync, + }) return err } @@ -871,7 +883,7 @@ func (client *Client) ReplicaWasPromoted(ctx context.Context, tablet *topodatapb } // SetMaster is part of the tmclient.TabletManagerClient interface. -func (client *Client) SetMaster(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error { +func (client *Client) SetMaster(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error { c, closer, err := client.dialer.dial(ctx, tablet) if err != nil { return err @@ -882,12 +894,13 @@ func (client *Client) SetMaster(ctx context.Context, tablet *topodatapb.Tablet, TimeCreatedNs: timeCreatedNS, WaitPosition: waitPosition, ForceStartReplication: forceStartReplication, + SemiSync: semiSync, }) return err } // SetReplicationSource is part of the tmclient.TabletManagerClient interface. -func (client *Client) SetReplicationSource(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error { +func (client *Client) SetReplicationSource(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error { c, closer, err := client.dialer.dial(ctx, tablet) if err != nil { return err @@ -898,6 +911,7 @@ func (client *Client) SetReplicationSource(ctx context.Context, tablet *topodata TimeCreatedNs: timeCreatedNS, WaitPosition: waitPosition, ForceStartReplication: forceStartReplication, + SemiSync: semiSync, }) return err } @@ -935,14 +949,16 @@ func (client *Client) StopReplicationAndGetStatus(ctx context.Context, tablet *t } // PromoteReplica is part of the tmclient.TabletManagerClient interface. -func (client *Client) PromoteReplica(ctx context.Context, tablet *topodatapb.Tablet) (string, error) { +func (client *Client) PromoteReplica(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) { c, closer, err := client.dialer.dial(ctx, tablet) if err != nil { return "", err } defer closer.Close() - response, err := c.PromoteReplica(ctx, &tabletmanagerdatapb.PromoteReplicaRequest{}) + response, err := c.PromoteReplica(ctx, &tabletmanagerdatapb.PromoteReplicaRequest{ + SemiSync: semiSync, + }) if err != nil { return "", err } diff --git a/go/vt/vttablet/grpctmserver/server.go b/go/vt/vttablet/grpctmserver/server.go index a41e460495f..aebac897a15 100644 --- a/go/vt/vttablet/grpctmserver/server.go +++ b/go/vt/vttablet/grpctmserver/server.go @@ -119,7 +119,7 @@ func (s *server) ChangeType(ctx context.Context, request *tabletmanagerdatapb.Ch defer s.tm.HandleRPCPanic(ctx, "ChangeType", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdatapb.ChangeTypeResponse{} - return response, s.tm.ChangeType(ctx, request.TabletType) + return response, s.tm.ChangeType(ctx, request.TabletType, request.GetSemiSync()) } func (s *server) RefreshState(ctx context.Context, request *tabletmanagerdatapb.RefreshStateRequest) (response *tabletmanagerdatapb.RefreshStateResponse, err error) { @@ -333,7 +333,7 @@ func (s *server) StartReplication(ctx context.Context, request *tabletmanagerdat defer s.tm.HandleRPCPanic(ctx, "StartReplication", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdatapb.StartReplicationResponse{} - return response, s.tm.StartReplication(ctx) + return response, s.tm.StartReplication(ctx, request.GetSemiSync()) } func (s *server) StartReplicationUntilAfter(ctx context.Context, request *tabletmanagerdatapb.StartReplicationUntilAfterRequest) (response *tabletmanagerdatapb.StartReplicationUntilAfterResponse, err error) { @@ -392,7 +392,7 @@ func (s *server) InitMaster(ctx context.Context, request *tabletmanagerdatapb.In defer s.tm.HandleRPCPanic(ctx, "InitMaster", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdatapb.InitPrimaryResponse{} - position, err := s.tm.InitPrimary(ctx) + position, err := s.tm.InitPrimary(ctx, request.GetSemiSync()) if err == nil { response.Position = position } @@ -403,7 +403,7 @@ func (s *server) InitPrimary(ctx context.Context, request *tabletmanagerdatapb.I defer s.tm.HandleRPCPanic(ctx, "InitPrimary", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdatapb.InitPrimaryResponse{} - position, err := s.tm.InitPrimary(ctx) + position, err := s.tm.InitPrimary(ctx, request.GetSemiSync()) if err == nil { response.Position = position } @@ -421,7 +421,7 @@ func (s *server) InitReplica(ctx context.Context, request *tabletmanagerdatapb.I defer s.tm.HandleRPCPanic(ctx, "InitReplica", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdatapb.InitReplicaResponse{} - return response, s.tm.InitReplica(ctx, request.Parent, request.ReplicationPosition, request.TimeCreatedNs) + return response, s.tm.InitReplica(ctx, request.Parent, request.ReplicationPosition, request.TimeCreatedNs, request.GetSemiSync()) } func (s *server) DemoteMaster(ctx context.Context, request *tabletmanagerdatapb.DemotePrimaryRequest) (response *tabletmanagerdatapb.DemotePrimaryResponse, err error) { @@ -452,7 +452,7 @@ func (s *server) UndoDemoteMaster(ctx context.Context, request *tabletmanagerdat defer s.tm.HandleRPCPanic(ctx, "UndoDemoteMaster", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdatapb.UndoDemotePrimaryResponse{} - err = s.tm.UndoDemotePrimary(ctx) + err = s.tm.UndoDemotePrimary(ctx, request.GetSemiSync()) return response, err } @@ -460,7 +460,7 @@ func (s *server) UndoDemotePrimary(ctx context.Context, request *tabletmanagerda defer s.tm.HandleRPCPanic(ctx, "UndoDemotePrimary", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdatapb.UndoDemotePrimaryResponse{} - err = s.tm.UndoDemotePrimary(ctx) + err = s.tm.UndoDemotePrimary(ctx, request.GetSemiSync()) return response, err } @@ -475,14 +475,14 @@ func (s *server) SetMaster(ctx context.Context, request *tabletmanagerdatapb.Set defer s.tm.HandleRPCPanic(ctx, "SetMaster", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdatapb.SetReplicationSourceResponse{} - return response, s.tm.SetReplicationSource(ctx, request.Parent, request.TimeCreatedNs, request.WaitPosition, request.ForceStartReplication) + return response, s.tm.SetReplicationSource(ctx, request.Parent, request.TimeCreatedNs, request.WaitPosition, request.ForceStartReplication, request.GetSemiSync()) } func (s *server) SetReplicationSource(ctx context.Context, request *tabletmanagerdatapb.SetReplicationSourceRequest) (response *tabletmanagerdatapb.SetReplicationSourceResponse, err error) { defer s.tm.HandleRPCPanic(ctx, "SetReplicationSource", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdatapb.SetReplicationSourceResponse{} - return response, s.tm.SetReplicationSource(ctx, request.Parent, request.TimeCreatedNs, request.WaitPosition, request.ForceStartReplication) + return response, s.tm.SetReplicationSource(ctx, request.Parent, request.TimeCreatedNs, request.WaitPosition, request.ForceStartReplication, request.GetSemiSync()) } func (s *server) ReplicaWasRestarted(ctx context.Context, request *tabletmanagerdatapb.ReplicaWasRestartedRequest) (response *tabletmanagerdatapb.ReplicaWasRestartedResponse, err error) { @@ -509,7 +509,7 @@ func (s *server) PromoteReplica(ctx context.Context, request *tabletmanagerdatap defer s.tm.HandleRPCPanic(ctx, "PromoteReplica", request, response, true /*verbose*/, &err) ctx = callinfo.GRPCCallInfo(ctx) response = &tabletmanagerdatapb.PromoteReplicaResponse{} - position, err := s.tm.PromoteReplica(ctx) + position, err := s.tm.PromoteReplica(ctx, request.GetSemiSync()) if err == nil { response.Position = position } diff --git a/go/vt/vttablet/tabletmanager/restore.go b/go/vt/vttablet/tabletmanager/restore.go index 2fe77203375..ccc1b0f68d8 100644 --- a/go/vt/vttablet/tabletmanager/restore.go +++ b/go/vt/vttablet/tabletmanager/restore.go @@ -527,7 +527,7 @@ func (tm *TabletManager) startReplication(ctx context.Context, pos mysql.Positio } // If using semi-sync, we need to enable it before connecting to primary. - if err := tm.fixSemiSync(tabletType); err != nil { + if err := tm.fixSemiSync(tabletType, SemiSyncActionNone); err != nil { return err } diff --git a/go/vt/vttablet/tabletmanager/rpc_actions.go b/go/vt/vttablet/tabletmanager/rpc_actions.go index 4c913a2f0f1..3ffa5f2a37e 100644 --- a/go/vt/vttablet/tabletmanager/rpc_actions.go +++ b/go/vt/vttablet/tabletmanager/rpc_actions.go @@ -43,6 +43,17 @@ const ( DBActionSetReadWrite ) +// SemiSyncAction is used to tell fixSemiSync whether to change the semi-sync +// settings or not. +type SemiSyncAction int + +// Allowed values for SemiSyncAction +const ( + SemiSyncActionNone = SemiSyncAction(iota) + SemiSyncActionSet + SemiSyncActionUnset +) + // This file contains the implementations of RPCTM methods. // Major groups of methods are broken out into files named "rpc_*.go". @@ -67,16 +78,16 @@ func (tm *TabletManager) SetReadOnly(ctx context.Context, rdonly bool) error { } // ChangeType changes the tablet type -func (tm *TabletManager) ChangeType(ctx context.Context, tabletType topodatapb.TabletType) error { +func (tm *TabletManager) ChangeType(ctx context.Context, tabletType topodatapb.TabletType, semiSync bool) error { if err := tm.lock(ctx); err != nil { return err } defer tm.unlock() - return tm.changeTypeLocked(ctx, tabletType, DBActionNone) + return tm.changeTypeLocked(ctx, tabletType, DBActionNone, convertBoolToSemiSyncAction(semiSync)) } // ChangeType changes the tablet type -func (tm *TabletManager) changeTypeLocked(ctx context.Context, tabletType topodatapb.TabletType, action DBAction) error { +func (tm *TabletManager) changeTypeLocked(ctx context.Context, tabletType topodatapb.TabletType, action DBAction, semiSync SemiSyncAction) error { // We don't want to allow multiple callers to claim a tablet as drained. There is a race that could happen during // horizontal resharding where two vtworkers will try to DRAIN the same tablet. This check prevents that race from // causing errors. @@ -89,7 +100,7 @@ func (tm *TabletManager) changeTypeLocked(ctx context.Context, tabletType topoda } // Let's see if we need to fix semi-sync acking. - if err := tm.fixSemiSyncAndReplication(tm.Tablet().Type); err != nil { + if err := tm.fixSemiSyncAndReplication(tm.Tablet().Type, semiSync); err != nil { return vterrors.Wrap(err, "fixSemiSyncAndReplication failed, may not ack correctly") } return nil @@ -138,3 +149,10 @@ func (tm *TabletManager) RunHealthCheck(ctx context.Context) { func (tm *TabletManager) IgnoreHealthError(ctx context.Context, pattern string) error { return vterrors.New(vtrpcpb.Code_INVALID_ARGUMENT, "deprecated") } + +func convertBoolToSemiSyncAction(semiSync bool) SemiSyncAction { + if semiSync { + return SemiSyncActionSet + } + return SemiSyncActionUnset +} diff --git a/go/vt/vttablet/tabletmanager/rpc_agent.go b/go/vt/vttablet/tabletmanager/rpc_agent.go index 7f96145fb9a..bd6fa0c301e 100644 --- a/go/vt/vttablet/tabletmanager/rpc_agent.go +++ b/go/vt/vttablet/tabletmanager/rpc_agent.go @@ -48,7 +48,7 @@ type RPCTM interface { SetReadOnly(ctx context.Context, rdonly bool) error - ChangeType(ctx context.Context, tabletType topodatapb.TabletType) error + ChangeType(ctx context.Context, tabletType topodatapb.TabletType, semiSync bool) error Sleep(ctx context.Context, duration time.Duration) @@ -90,7 +90,7 @@ type RPCTM interface { StopReplicationMinimum(ctx context.Context, position string, waitTime time.Duration) (string, error) - StartReplication(ctx context.Context) error + StartReplication(ctx context.Context, semiSync bool) error StartReplicationUntilAfter(ctx context.Context, position string, waitTime time.Duration) error @@ -114,36 +114,36 @@ type RPCTM interface { ResetReplication(ctx context.Context) error // Deprecated, use InitPrimary instead - InitMaster(ctx context.Context) (string, error) + InitMaster(ctx context.Context, semiSync bool) (string, error) - InitPrimary(ctx context.Context) (string, error) + InitPrimary(ctx context.Context, semiSync bool) (string, error) PopulateReparentJournal(ctx context.Context, timeCreatedNS int64, actionName string, tabletAlias *topodatapb.TabletAlias, pos string) error - InitReplica(ctx context.Context, parent *topodatapb.TabletAlias, replicationPosition string, timeCreatedNS int64) error + InitReplica(ctx context.Context, parent *topodatapb.TabletAlias, replicationPosition string, timeCreatedNS int64, semiSync bool) error // Deprecated, use DemotePrimary instead DemoteMaster(ctx context.Context) (*replicationdatapb.PrimaryStatus, error) // Deprecated, use UndoDemotePrimary instead - UndoDemoteMaster(ctx context.Context) error + UndoDemoteMaster(ctx context.Context, semiSync bool) error DemotePrimary(ctx context.Context) (*replicationdatapb.PrimaryStatus, error) - UndoDemotePrimary(ctx context.Context) error + UndoDemotePrimary(ctx context.Context, semiSync bool) error ReplicaWasPromoted(ctx context.Context) error // Deprecated, use SetReplicationSource instead - SetMaster(ctx context.Context, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error + SetMaster(ctx context.Context, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error - SetReplicationSource(ctx context.Context, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error + SetReplicationSource(ctx context.Context, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error StopReplicationAndGetStatus(ctx context.Context, stopReplicationMode replicationdatapb.StopReplicationMode) (StopReplicationAndGetStatusResponse, error) ReplicaWasRestarted(ctx context.Context, parent *topodatapb.TabletAlias) error - PromoteReplica(ctx context.Context) (string, error) + PromoteReplica(ctx context.Context, semiSync bool) (string, error) // Backup / restore related methods diff --git a/go/vt/vttablet/tabletmanager/rpc_backup.go b/go/vt/vttablet/tabletmanager/rpc_backup.go index 9c9ff6e4b04..30c7cf867f2 100644 --- a/go/vt/vttablet/tabletmanager/rpc_backup.go +++ b/go/vt/vttablet/tabletmanager/rpc_backup.go @@ -85,7 +85,7 @@ func (tm *TabletManager) Backup(ctx context.Context, concurrency int, logger log } originalType = tablet.Type // update our type to BACKUP - if err := tm.changeTypeLocked(ctx, topodatapb.TabletType_BACKUP, DBActionNone); err != nil { + if err := tm.changeTypeLocked(ctx, topodatapb.TabletType_BACKUP, DBActionNone, SemiSyncActionUnset); err != nil { return err } // Tell Orchestrator we're stopped on purpose for some Vitess task. @@ -126,7 +126,7 @@ func (tm *TabletManager) Backup(ctx context.Context, concurrency int, logger log // Change our type back to the original value. // Original type could be primary so pass in a real value for PrimaryTermStartTime - if err := tm.changeTypeLocked(bgCtx, originalType, DBActionNone); err != nil { + if err := tm.changeTypeLocked(bgCtx, originalType, DBActionNone, SemiSyncActionNone); err != nil { // failure in changing the topology type is probably worse, // so returning that (we logged the snapshot error anyway) if returnErr != nil { diff --git a/go/vt/vttablet/tabletmanager/rpc_replication.go b/go/vt/vttablet/tabletmanager/rpc_replication.go index ea29e58b73e..96ca76f09e6 100644 --- a/go/vt/vttablet/tabletmanager/rpc_replication.go +++ b/go/vt/vttablet/tabletmanager/rpc_replication.go @@ -173,7 +173,7 @@ func (tm *TabletManager) StopReplicationMinimum(ctx context.Context, position st // StartReplication will start the mysql. Works both when Vitess manages // replication or not (using hook if not). -func (tm *TabletManager) StartReplication(ctx context.Context) error { +func (tm *TabletManager) StartReplication(ctx context.Context, semiSync bool) error { log.Infof("StartReplication") if err := tm.lock(ctx); err != nil { return err @@ -193,7 +193,7 @@ func (tm *TabletManager) StartReplication(ctx context.Context) error { } }() - if err := tm.fixSemiSync(tm.Tablet().Type); err != nil { + if err := tm.fixSemiSync(tm.Tablet().Type, convertBoolToSemiSyncAction(semiSync)); err != nil { return err } return tm.MysqlDaemon.StartReplication(tm.hookExtraEnv()) @@ -238,12 +238,12 @@ func (tm *TabletManager) ResetReplication(ctx context.Context) error { } // InitMaster is the old version of InitPrimary. Deprecated. -func (tm *TabletManager) InitMaster(ctx context.Context) (string, error) { - return tm.InitPrimary(ctx) +func (tm *TabletManager) InitMaster(ctx context.Context, semiSync bool) (string, error) { + return tm.InitPrimary(ctx, semiSync) } // InitPrimary enables writes and returns the replication position. -func (tm *TabletManager) InitPrimary(ctx context.Context) (string, error) { +func (tm *TabletManager) InitPrimary(ctx context.Context, semiSync bool) (string, error) { log.Infof("InitPrimary") if err := tm.lock(ctx); err != nil { return "", err @@ -284,13 +284,13 @@ func (tm *TabletManager) InitPrimary(ctx context.Context) (string, error) { // Set the server read-write, from now on we can accept real // client writes. Note that if semi-sync replication is enabled, // we'll still need some replicas to be able to commit transactions. - if err := tm.changeTypeLocked(ctx, topodatapb.TabletType_PRIMARY, DBActionSetReadWrite); err != nil { + if err := tm.changeTypeLocked(ctx, topodatapb.TabletType_PRIMARY, DBActionSetReadWrite, convertBoolToSemiSyncAction(semiSync)); err != nil { return "", err } // Enforce semi-sync after changing the tablet)type to PRIMARY. Otherwise, the // primary will hang while trying to create the database. - if err := tm.fixSemiSync(topodatapb.TabletType_PRIMARY); err != nil { + if err := tm.fixSemiSync(topodatapb.TabletType_PRIMARY, convertBoolToSemiSyncAction(semiSync)); err != nil { return "", err } @@ -320,7 +320,7 @@ func (tm *TabletManager) PopulateReparentJournal(ctx context.Context, timeCreate // InitReplica sets replication primary and position, and waits for the // reparent_journal table entry up to context timeout -func (tm *TabletManager) InitReplica(ctx context.Context, parent *topodatapb.TabletAlias, position string, timeCreatedNS int64) error { +func (tm *TabletManager) InitReplica(ctx context.Context, parent *topodatapb.TabletAlias, position string, timeCreatedNS int64, semiSync bool) error { log.Infof("InitReplica: parent: %v position: %v", parent, position) if err := tm.lock(ctx); err != nil { return err @@ -331,7 +331,7 @@ func (tm *TabletManager) InitReplica(ctx context.Context, parent *topodatapb.Tab // is used on the old primary when using InitShardPrimary with // -force, and the new primary is different from the old primary. if tm.Tablet().Type == topodatapb.TabletType_PRIMARY { - if err := tm.changeTypeLocked(ctx, topodatapb.TabletType_REPLICA, DBActionNone); err != nil { + if err := tm.changeTypeLocked(ctx, topodatapb.TabletType_REPLICA, DBActionNone, convertBoolToSemiSyncAction(semiSync)); err != nil { return err } } @@ -354,7 +354,7 @@ func (tm *TabletManager) InitReplica(ctx context.Context, parent *topodatapb.Tab if tt == topodatapb.TabletType_PRIMARY { tt = topodatapb.TabletType_REPLICA } - if err := tm.fixSemiSync(tt); err != nil { + if err := tm.fixSemiSync(tt, convertBoolToSemiSyncAction(semiSync)); err != nil { return err } @@ -475,18 +475,22 @@ func (tm *TabletManager) demotePrimary(ctx context.Context, revertPartialFailure } }() - // If using semi-sync, we need to disable primary-side. - if err := tm.fixSemiSync(topodatapb.TabletType_REPLICA); err != nil { - return nil, err - } - defer func() { - if finalErr != nil && revertPartialFailure && wasPrimary { - // enable primary-side semi-sync again - if err := tm.fixSemiSync(topodatapb.TabletType_PRIMARY); err != nil { - log.Warningf("fixSemiSync(PRIMARY) failed during revert: %v", err) - } + // Here, we check if the primary side semi sync is enabled or not. If it isn't enabled then we do not need to take any action. + // If it is enabled then we should turn it off and revert in case of failure. + if tm.isPrimarySideSemiSyncEnabled() { + // If using semi-sync, we need to disable primary-side. + if err := tm.fixSemiSync(topodatapb.TabletType_REPLICA, SemiSyncActionSet); err != nil { + return nil, err } - }() + defer func() { + if finalErr != nil && revertPartialFailure && wasPrimary { + // enable primary-side semi-sync again + if err := tm.fixSemiSync(topodatapb.TabletType_PRIMARY, SemiSyncActionSet); err != nil { + log.Warningf("fixSemiSync(PRIMARY) failed during revert: %v", err) + } + } + }() + } // Return the current replication position. status, err := tm.MysqlDaemon.PrimaryStatus(ctx) @@ -497,14 +501,14 @@ func (tm *TabletManager) demotePrimary(ctx context.Context, revertPartialFailure } // UndoDemoteMaster is the old version of UndoDemotePrimary. Deprecated. -func (tm *TabletManager) UndoDemoteMaster(ctx context.Context) error { - return tm.UndoDemotePrimary(ctx) +func (tm *TabletManager) UndoDemoteMaster(ctx context.Context, semiSync bool) error { + return tm.UndoDemotePrimary(ctx, semiSync) } // UndoDemotePrimary reverts a previous call to DemotePrimary // it sets read-only to false, fixes semi-sync // and returns its primary position. -func (tm *TabletManager) UndoDemotePrimary(ctx context.Context) error { +func (tm *TabletManager) UndoDemotePrimary(ctx context.Context, semiSync bool) error { log.Infof("UndoDemotePrimary") if err := tm.lock(ctx); err != nil { return err @@ -512,7 +516,7 @@ func (tm *TabletManager) UndoDemotePrimary(ctx context.Context) error { defer tm.unlock() // If using semi-sync, we need to enable source-side. - if err := tm.fixSemiSync(topodatapb.TabletType_PRIMARY); err != nil { + if err := tm.fixSemiSync(topodatapb.TabletType_PRIMARY, convertBoolToSemiSyncAction(semiSync)); err != nil { return err } @@ -543,13 +547,17 @@ func (tm *TabletManager) UndoDemotePrimary(ctx context.Context) error { // ReplicaWasPromoted promotes a replica to primary, no questions asked. func (tm *TabletManager) ReplicaWasPromoted(ctx context.Context) error { log.Infof("ReplicaWasPromoted") - return tm.ChangeType(ctx, topodatapb.TabletType_PRIMARY) + if err := tm.lock(ctx); err != nil { + return err + } + defer tm.unlock() + return tm.changeTypeLocked(ctx, topodatapb.TabletType_PRIMARY, DBActionNone, SemiSyncActionNone) } // SetReplicationSource sets replication primary, and waits for the // reparent_journal table entry up to context timeout -func (tm *TabletManager) SetReplicationSource(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error { - log.Infof("SetReplicationSource: parent: %v position: %v force: %v", parentAlias, waitPosition, forceStartReplication) +func (tm *TabletManager) SetReplicationSource(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error { + log.Infof("SetReplicationSource: parent: %v position: %v force: %v semiSync: %v", parentAlias, waitPosition, forceStartReplication, semiSync) if err := tm.lock(ctx); err != nil { return err } @@ -557,12 +565,12 @@ func (tm *TabletManager) SetReplicationSource(ctx context.Context, parentAlias * // setReplicationSourceLocked also fixes the semi-sync. In case the tablet type is primary it assumes that it will become a replica if SetReplicationSource // is called, so we always call fixSemiSync with a non-primary tablet type. This will always set the source side replication to false. - return tm.setReplicationSourceLocked(ctx, parentAlias, timeCreatedNS, waitPosition, forceStartReplication) + return tm.setReplicationSourceLocked(ctx, parentAlias, timeCreatedNS, waitPosition, forceStartReplication, convertBoolToSemiSyncAction(semiSync)) } // SetMaster is the old version of SetReplicationSource. Deprecated. -func (tm *TabletManager) SetMaster(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error { - return tm.SetReplicationSource(ctx, parentAlias, timeCreatedNS, waitPosition, forceStartReplication) +func (tm *TabletManager) SetMaster(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error { + return tm.SetReplicationSource(ctx, parentAlias, timeCreatedNS, waitPosition, forceStartReplication, semiSync) } func (tm *TabletManager) setReplicationSourceRepairReplication(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) (err error) { @@ -578,10 +586,20 @@ func (tm *TabletManager) setReplicationSourceRepairReplication(ctx context.Conte defer unlock(&err) - return tm.setReplicationSourceLocked(ctx, parentAlias, timeCreatedNS, waitPosition, forceStartReplication) + return tm.setReplicationSourceLocked(ctx, parentAlias, timeCreatedNS, waitPosition, forceStartReplication, SemiSyncActionNone) +} + +func (tm *TabletManager) setReplicationSourceSemiSyncNoAction(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error { + log.Infof("SetReplicationSource: parent: %v position: %v force: %v", parentAlias, waitPosition, forceStartReplication) + if err := tm.lock(ctx); err != nil { + return err + } + defer tm.unlock() + + return tm.setReplicationSourceLocked(ctx, parentAlias, timeCreatedNS, waitPosition, forceStartReplication, SemiSyncActionNone) } -func (tm *TabletManager) setReplicationSourceLocked(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) (err error) { +func (tm *TabletManager) setReplicationSourceLocked(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync SemiSyncAction) (err error) { // End orchestrator maintenance at the end of fixing replication. // This is a best effort operation, so it should happen in a goroutine defer func() { @@ -639,7 +657,7 @@ func (tm *TabletManager) setReplicationSourceLocked(ctx context.Context, parentA if tabletType == topodatapb.TabletType_PRIMARY { tabletType = topodatapb.TabletType_REPLICA } - if err := tm.fixSemiSync(tabletType); err != nil { + if err := tm.fixSemiSync(tabletType, semiSync); err != nil { return err } // Update the primary/source address only if needed. @@ -808,7 +826,7 @@ type StopReplicationAndGetStatusResponse struct { } // PromoteReplica makes the current tablet the primary -func (tm *TabletManager) PromoteReplica(ctx context.Context) (string, error) { +func (tm *TabletManager) PromoteReplica(ctx context.Context, semiSync bool) (string, error) { log.Infof("PromoteReplica") if err := tm.lock(ctx); err != nil { return "", err @@ -832,11 +850,11 @@ func (tm *TabletManager) PromoteReplica(ctx context.Context) (string, error) { } // If using semi-sync, we need to enable it before going read-write. - if err := tm.fixSemiSync(topodatapb.TabletType_PRIMARY); err != nil { + if err := tm.fixSemiSync(topodatapb.TabletType_PRIMARY, convertBoolToSemiSyncAction(semiSync)); err != nil { return "", err } - if err := tm.changeTypeLocked(ctx, topodatapb.TabletType_PRIMARY, DBActionSetReadWrite); err != nil { + if err := tm.changeTypeLocked(ctx, topodatapb.TabletType_PRIMARY, DBActionSetReadWrite, SemiSyncActionNone); err != nil { return "", err } @@ -868,24 +886,38 @@ func isPrimaryEligible(tabletType topodatapb.TabletType) bool { return false } -func (tm *TabletManager) fixSemiSync(tabletType topodatapb.TabletType) error { +func (tm *TabletManager) fixSemiSync(tabletType topodatapb.TabletType, semiSync SemiSyncAction) error { if !*enableSemiSync { // Semi-sync handling is not enabled. + if semiSync == SemiSyncActionSet { + log.Error("invalid configuration - semi-sync should be setup according to durability policies, but enable_semi_sync is not set") + } return nil } // Only enable if we're eligible for becoming primary (REPLICA type). // Ineligible tablets (RDONLY) shouldn't ACK because we'll never promote them. if !isPrimaryEligible(tabletType) { + if semiSync == SemiSyncActionSet { + log.Error("invalid configuration - semi-sync should be setup according to durability policies, but the tablet is not primaryEligible") + } return tm.MysqlDaemon.SetSemiSyncEnabled(false, false) } + if semiSync == SemiSyncActionUnset { + log.Error("invalid configuration - enabling semi sync even though not specified by durability policies. Possibly in the process of upgrading.") + } // Always enable replica-side since it doesn't hurt to keep it on for a primary. // The primary-side needs to be off for a replica, or else it will get stuck. return tm.MysqlDaemon.SetSemiSyncEnabled(tabletType == topodatapb.TabletType_PRIMARY, true) } -func (tm *TabletManager) fixSemiSyncAndReplication(tabletType topodatapb.TabletType) error { +func (tm *TabletManager) isPrimarySideSemiSyncEnabled() bool { + semiSyncEnabled, _ := tm.MysqlDaemon.SemiSyncEnabled() + return semiSyncEnabled +} + +func (tm *TabletManager) fixSemiSyncAndReplication(tabletType topodatapb.TabletType, semiSync SemiSyncAction) error { if !*enableSemiSync { // Semi-sync handling is not enabled. return nil @@ -898,7 +930,7 @@ func (tm *TabletManager) fixSemiSyncAndReplication(tabletType topodatapb.TabletT return nil } - if err := tm.fixSemiSync(tabletType); err != nil { + if err := tm.fixSemiSync(tabletType, semiSync); err != nil { return vterrors.Wrapf(err, "failed to fixSemiSync(%v)", tabletType) } diff --git a/go/vt/vttablet/tabletmanager/rpc_replication_test.go b/go/vt/vttablet/tabletmanager/rpc_replication_test.go index 95fbb51831d..9b5ff03959c 100644 --- a/go/vt/vttablet/tabletmanager/rpc_replication_test.go +++ b/go/vt/vttablet/tabletmanager/rpc_replication_test.go @@ -17,11 +17,16 @@ limitations under the License. package tabletmanager import ( + "bytes" "context" + "io" + "os" "testing" "github.com/stretchr/testify/require" + "vitess.io/vitess/go/vt/mysqlctl/fakemysqldaemon" + "vitess.io/vitess/go/vt/proto/topodata" "vitess.io/vitess/go/vt/topo/memorytopo" ) @@ -34,7 +39,121 @@ func TestPromoteReplicaHealthTicksStopped(t *testing.T) { tm := newTestTM(t, ts, 100, keyspace, shard) defer tm.Stop() - _, err := tm.PromoteReplica(ctx) + _, err := tm.PromoteReplica(ctx, false) require.NoError(t, err) require.False(t, tm.replManager.ticks.Running()) } + +func captureStderr(f func()) (string, error) { + old := os.Stderr // keep backup of the real stderr + r, w, err := os.Pipe() + if err != nil { + return "", err + } + os.Stderr = w + + outC := make(chan string) + // copy the output in a separate goroutine so printing can't block indefinitely + go func() { + var buf bytes.Buffer + io.Copy(&buf, r) + outC <- buf.String() + }() + + // calling function which stderr we are going to capture: + f() + + // back to normal state + w.Close() + os.Stderr = old // restoring the real stderr + return <-outC, nil +} + +func TestTabletManager_fixSemiSync(t *testing.T) { + tests := []struct { + name string + tabletType topodata.TabletType + semiSync SemiSyncAction + logOutput string + shouldEnableSemiSync bool + }{ + { + name: "enableSemiSync=true(primary eligible),durabilitySemiSync=true", + tabletType: topodata.TabletType_REPLICA, + semiSync: SemiSyncActionSet, + logOutput: "", + shouldEnableSemiSync: true, + }, { + name: "enableSemiSync=true(primary eligible),durabilitySemiSync=false", + tabletType: topodata.TabletType_REPLICA, + semiSync: SemiSyncActionUnset, + logOutput: "invalid configuration - enabling semi sync even though not specified by durability policies.", + shouldEnableSemiSync: true, + }, { + name: "enableSemiSync=true(primary eligible),durabilitySemiSync=none", + tabletType: topodata.TabletType_REPLICA, + semiSync: SemiSyncActionNone, + logOutput: "", + shouldEnableSemiSync: true, + }, { + name: "enableSemiSync=true(primary not-eligible),durabilitySemiSync=true", + tabletType: topodata.TabletType_DRAINED, + semiSync: SemiSyncActionSet, + logOutput: "invalid configuration - semi-sync should be setup according to durability policies, but the tablet is not primaryEligible", + shouldEnableSemiSync: true, + }, { + name: "enableSemiSync=true(primary not-eligible),durabilitySemiSync=false", + tabletType: topodata.TabletType_DRAINED, + semiSync: SemiSyncActionUnset, + logOutput: "", + shouldEnableSemiSync: true, + }, { + name: "enableSemiSync=true(primary not-eligible),durabilitySemiSync=none", + tabletType: topodata.TabletType_DRAINED, + semiSync: SemiSyncActionNone, + logOutput: "", + shouldEnableSemiSync: true, + }, { + name: "enableSemiSync=false,durabilitySemiSync=true", + tabletType: topodata.TabletType_REPLICA, + semiSync: SemiSyncActionSet, + logOutput: "invalid configuration - semi-sync should be setup according to durability policies, but enable_semi_sync is not set", + shouldEnableSemiSync: false, + }, { + name: "enableSemiSync=false,durabilitySemiSync=false", + tabletType: topodata.TabletType_REPLICA, + semiSync: SemiSyncActionUnset, + logOutput: "", + shouldEnableSemiSync: false, + }, { + name: "enableSemiSync=false,durabilitySemiSync=none", + tabletType: topodata.TabletType_REPLICA, + semiSync: SemiSyncActionNone, + logOutput: "", + shouldEnableSemiSync: false, + }, + } + oldEnableSemiSync := *enableSemiSync + defer func() { + *enableSemiSync = oldEnableSemiSync + }() + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + *enableSemiSync = tt.shouldEnableSemiSync + fakeMysql := fakemysqldaemon.NewFakeMysqlDaemon(nil) + tm := &TabletManager{ + MysqlDaemon: fakeMysql, + } + logOutput, err := captureStderr(func() { + err := tm.fixSemiSync(tt.tabletType, tt.semiSync) + require.NoError(t, err) + }) + require.NoError(t, err) + if tt.logOutput != "" { + require.Contains(t, logOutput, tt.logOutput) + } else { + require.Equal(t, "", logOutput) + } + }) + } +} diff --git a/go/vt/vttablet/tabletmanager/shard_sync.go b/go/vt/vttablet/tabletmanager/shard_sync.go index 66fb0661fbb..0b257537b4b 100644 --- a/go/vt/vttablet/tabletmanager/shard_sync.go +++ b/go/vt/vttablet/tabletmanager/shard_sync.go @@ -213,7 +213,7 @@ func (tm *TabletManager) endPrimaryTerm(ctx context.Context, primaryAlias *topod log.Infof("Active reparents are disabled; updating tablet state only.") changeTypeCtx, cancel := context.WithTimeout(ctx, *topo.RemoteOperationTimeout) defer cancel() - if err := tm.ChangeType(changeTypeCtx, tm.baseTabletType); err != nil { + if err := tm.tmState.ChangeTabletType(changeTypeCtx, tm.baseTabletType, DBActionNone); err != nil { return vterrors.Wrapf(err, "failed to change type to %v", tm.baseTabletType) } return nil @@ -238,7 +238,7 @@ func (tm *TabletManager) endPrimaryTerm(ctx context.Context, primaryAlias *topod return err } } else { - if err := tm.SetReplicationSource(setPrimaryCtx, primaryAlias, 0, "", true); err != nil { + if err := tm.setReplicationSourceSemiSyncNoAction(setPrimaryCtx, primaryAlias, 0, "", true); err != nil { return vterrors.Wrap(err, "failed to reparent self to new primary") } } diff --git a/go/vt/vttablet/tmclient/rpc_client_api.go b/go/vt/vttablet/tmclient/rpc_client_api.go index b78b532617c..eb1355419ec 100644 --- a/go/vt/vttablet/tmclient/rpc_client_api.go +++ b/go/vt/vttablet/tmclient/rpc_client_api.go @@ -63,7 +63,7 @@ type TabletManagerClient interface { SetReadWrite(ctx context.Context, tablet *topodatapb.Tablet) error // ChangeType asks the remote tablet to change its type - ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType) error + ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType, semiSync bool) error // Sleep will sleep for a duration (used for tests) Sleep(ctx context.Context, tablet *topodatapb.Tablet, duration time.Duration) error @@ -129,7 +129,7 @@ type TabletManagerClient interface { StopReplicationMinimum(ctx context.Context, tablet *topodatapb.Tablet, stopPos string, waitTime time.Duration) (string, error) // StartReplication starts the mysql replication - StartReplication(ctx context.Context, tablet *topodatapb.Tablet) error + StartReplication(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error // StartReplicationUntilAfter starts replication until after the position specified StartReplicationUntilAfter(ctx context.Context, tablet *topodatapb.Tablet, position string, duration time.Duration) error @@ -165,12 +165,12 @@ type TabletManagerClient interface { // Deprecated InitMaster tells a tablet to make itself the new primary, // and return the replication position the replicas should use to // reparent to it. - InitMaster(ctx context.Context, tablet *topodatapb.Tablet) (string, error) + InitMaster(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) // InitPrimary tells a tablet to make itself the new primary, // and return the replication position the replicas should use to // reparent to it. - InitPrimary(ctx context.Context, tablet *topodatapb.Tablet) (string, error) + InitPrimary(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) // PopulateReparentJournal asks the primary to insert a row in // its reparent_journal table. @@ -179,7 +179,7 @@ type TabletManagerClient interface { // InitReplica tells a tablet to start replicating from the // passed in primary tablet alias, and wait for the row in the // reparent_journal table. - InitReplica(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, replicationPosition string, timeCreatedNS int64) error + InitReplica(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, replicationPosition string, timeCreatedNS int64, semiSync bool) error // Deprecated DemoteMaster tells the soon-to-be-former primary it's going to change, // and it should go read-only and return its current position. @@ -187,7 +187,7 @@ type TabletManagerClient interface { // Deprecated UndoDemoteMaster reverts all changes made by DemoteMaster // To be used if we are unable to promote the chosen new primary - UndoDemoteMaster(ctx context.Context, tablet *topodatapb.Tablet) error + UndoDemoteMaster(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error // DemotePrimary tells the soon-to-be-former primary it's going to change, // and it should go read-only and return its current position. @@ -195,7 +195,7 @@ type TabletManagerClient interface { // UndoDemotePrimary reverts all changes made by DemotePrimary // To be used if we are unable to promote the chosen new primary - UndoDemotePrimary(ctx context.Context, tablet *topodatapb.Tablet) error + UndoDemotePrimary(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) error // ReplicaWasPromoted tells the remote tablet it is now the primary ReplicaWasPromoted(ctx context.Context, tablet *topodatapb.Tablet) error @@ -203,12 +203,12 @@ type TabletManagerClient interface { // Deprecated SetMaster tells a tablet to start replicating from the // passed in primary tablet alias, and wait for the row in the // reparent_journal table (if timeCreatedNS is non-zero). - SetMaster(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error + SetMaster(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error // SetReplicationSource tells a tablet to start replicating from the // passed in tablet alias, and wait for the row in the // reparent_journal table (if timeCreatedNS is non-zero). - SetReplicationSource(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error + SetReplicationSource(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool, semiSync bool) error // ReplicaWasRestarted tells the replica tablet its primary has changed ReplicaWasRestarted(ctx context.Context, tablet *topodatapb.Tablet, parent *topodatapb.TabletAlias) error @@ -218,7 +218,7 @@ type TabletManagerClient interface { StopReplicationAndGetStatus(ctx context.Context, tablet *topodatapb.Tablet, stopReplicationMode replicationdatapb.StopReplicationMode) (*replicationdatapb.Status, *replicationdatapb.StopReplicationStatus, error) // PromoteReplica makes the tablet the new primary - PromoteReplica(ctx context.Context, tablet *topodatapb.Tablet) (string, error) + PromoteReplica(ctx context.Context, tablet *topodatapb.Tablet, semiSync bool) (string, error) // // Backup / restore related methods diff --git a/go/vt/vttablet/tmrpctest/test_tm_rpc.go b/go/vt/vttablet/tmrpctest/test_tm_rpc.go index 7d95ef8d041..4ac34b9b19d 100644 --- a/go/vt/vttablet/tmrpctest/test_tm_rpc.go +++ b/go/vt/vttablet/tmrpctest/test_tm_rpc.go @@ -373,7 +373,7 @@ func tmRPCTestSetReadOnlyPanic(ctx context.Context, t *testing.T, client tmclien var testChangeTypeValue = topodatapb.TabletType_REPLICA -func (fra *fakeRPCTM) ChangeType(ctx context.Context, tabletType topodatapb.TabletType) error { +func (fra *fakeRPCTM) ChangeType(ctx context.Context, tabletType topodatapb.TabletType, semiSync bool) error { if fra.panics { panic(fmt.Errorf("test-triggered panic")) } @@ -382,14 +382,14 @@ func (fra *fakeRPCTM) ChangeType(ctx context.Context, tabletType topodatapb.Tabl } func tmRPCTestChangeType(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - err := client.ChangeType(ctx, tablet, testChangeTypeValue) + err := client.ChangeType(ctx, tablet, testChangeTypeValue, false) if err != nil { t.Errorf("ChangeType failed: %v", err) } } func tmRPCTestChangeTypePanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - err := client.ChangeType(ctx, tablet, testChangeTypeValue) + err := client.ChangeType(ctx, tablet, testChangeTypeValue, false) expectHandleRPCPanic(t, "ChangeType", true /*verbose*/, err) } @@ -822,7 +822,7 @@ func tmRPCTestStopReplicationMinimumPanic(ctx context.Context, t *testing.T, cli var testStartReplicationCalled = false -func (fra *fakeRPCTM) StartReplication(ctx context.Context) error { +func (fra *fakeRPCTM) StartReplication(ctx context.Context, semiSync bool) error { if fra.panics { panic(fmt.Errorf("test-triggered panic")) } @@ -831,12 +831,12 @@ func (fra *fakeRPCTM) StartReplication(ctx context.Context) error { } func tmRPCTestStartReplication(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - err := client.StartReplication(ctx, tablet) + err := client.StartReplication(ctx, tablet, false) compareError(t, "StartReplication", err, true, testStartReplicationCalled) } func tmRPCTestStartReplicationPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - err := client.StartReplication(ctx, tablet) + err := client.StartReplication(ctx, tablet, false) expectHandleRPCPanic(t, "StartReplication", true /*verbose*/, err) } @@ -950,7 +950,7 @@ func tmRPCTestResetReplicationPanic(ctx context.Context, t *testing.T, client tm expectHandleRPCPanic(t, "ResetReplication", true /*verbose*/, err) } -func (fra *fakeRPCTM) InitPrimary(ctx context.Context) (string, error) { +func (fra *fakeRPCTM) InitPrimary(ctx context.Context, semiSync bool) (string, error) { if fra.panics { panic(fmt.Errorf("test-triggered panic")) } @@ -958,7 +958,7 @@ func (fra *fakeRPCTM) InitPrimary(ctx context.Context) (string, error) { } // Deprecated -func (fra *fakeRPCTM) InitMaster(ctx context.Context) (string, error) { +func (fra *fakeRPCTM) InitMaster(ctx context.Context, semiSync bool) (string, error) { if fra.panics { panic(fmt.Errorf("test-triggered panic")) } @@ -966,12 +966,12 @@ func (fra *fakeRPCTM) InitMaster(ctx context.Context) (string, error) { } func tmRPCTestInitMaster(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - rp, err := client.InitMaster(ctx, tablet) + rp, err := client.InitMaster(ctx, tablet, false) compareError(t, "InitMaster", err, rp, testReplicationPosition) } func tmRPCTestInitMasterPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - _, err := client.InitMaster(ctx, tablet) + _, err := client.InitMaster(ctx, tablet, false) expectHandleRPCPanic(t, "InitMaster", true /*verbose*/, err) } @@ -1008,7 +1008,7 @@ func tmRPCTestPopulateReparentJournalPanic(ctx context.Context, t *testing.T, cl var testInitReplicaCalled = false -func (fra *fakeRPCTM) InitReplica(ctx context.Context, parent *topodatapb.TabletAlias, position string, timeCreatedNS int64) error { +func (fra *fakeRPCTM) InitReplica(ctx context.Context, parent *topodatapb.TabletAlias, position string, timeCreatedNS int64, semiSync bool) error { if fra.panics { panic(fmt.Errorf("test-triggered panic")) } @@ -1020,12 +1020,12 @@ func (fra *fakeRPCTM) InitReplica(ctx context.Context, parent *topodatapb.Tablet } func tmRPCTestInitReplica(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - err := client.InitReplica(ctx, tablet, testPrimaryAlias, testReplicationPosition, testTimeCreatedNS) + err := client.InitReplica(ctx, tablet, testPrimaryAlias, testReplicationPosition, testTimeCreatedNS, false) compareError(t, "InitReplica", err, true, testInitReplicaCalled) } func tmRPCTestInitReplicaPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - err := client.InitReplica(ctx, tablet, testPrimaryAlias, testReplicationPosition, testTimeCreatedNS) + err := client.InitReplica(ctx, tablet, testPrimaryAlias, testReplicationPosition, testTimeCreatedNS, false) expectHandleRPCPanic(t, "InitReplica", true /*verbose*/, err) } @@ -1056,7 +1056,7 @@ func tmRPCTestDemoteMasterPanic(ctx context.Context, t *testing.T, client tmclie var testUndoDemoteMasterCalled = false -func (fra *fakeRPCTM) UndoDemotePrimary(ctx context.Context) error { +func (fra *fakeRPCTM) UndoDemotePrimary(ctx context.Context, semiSync bool) error { if fra.panics { panic(fmt.Errorf("test-triggered panic")) } @@ -1064,7 +1064,7 @@ func (fra *fakeRPCTM) UndoDemotePrimary(ctx context.Context) error { } // Deprecated -func (fra *fakeRPCTM) UndoDemoteMaster(ctx context.Context) error { +func (fra *fakeRPCTM) UndoDemoteMaster(ctx context.Context, semiSync bool) error { if fra.panics { panic(fmt.Errorf("test-triggered panic")) } @@ -1072,13 +1072,13 @@ func (fra *fakeRPCTM) UndoDemoteMaster(ctx context.Context) error { } func tmRPCTestUndoDemoteMaster(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - err := client.UndoDemoteMaster(ctx, tablet) + err := client.UndoDemoteMaster(ctx, tablet, false) testUndoDemoteMasterCalled = true compareError(t, "UndoDemoteMaster", err, true, testUndoDemoteMasterCalled) } func tmRPCTestUndoDemoteMasterPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - err := client.UndoDemoteMaster(ctx, tablet) + err := client.UndoDemoteMaster(ctx, tablet, false) expectHandleRPCPanic(t, "UndoDemoteMaster", true /*verbose*/, err) } @@ -1107,7 +1107,7 @@ func tmRPCTestReplicaWasPromotedPanic(ctx context.Context, t *testing.T, client var testSetMasterCalled = false var testForceStartReplica = true -func (fra *fakeRPCTM) SetReplicationSource(ctx context.Context, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplica bool) error { +func (fra *fakeRPCTM) SetReplicationSource(ctx context.Context, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplica bool, semiSync bool) error { if fra.panics { panic(fmt.Errorf("test-triggered panic")) } @@ -1120,7 +1120,7 @@ func (fra *fakeRPCTM) SetReplicationSource(ctx context.Context, parent *topodata } // Deprecated -func (fra *fakeRPCTM) SetMaster(ctx context.Context, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplica bool) error { +func (fra *fakeRPCTM) SetMaster(ctx context.Context, parent *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplica bool, semiSync bool) error { if fra.panics { panic(fmt.Errorf("test-triggered panic")) } @@ -1133,12 +1133,12 @@ func (fra *fakeRPCTM) SetMaster(ctx context.Context, parent *topodatapb.TabletAl } func tmRPCTestSetMaster(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - err := client.SetMaster(ctx, tablet, testPrimaryAlias, testTimeCreatedNS, testWaitPosition, testForceStartReplica) + err := client.SetMaster(ctx, tablet, testPrimaryAlias, testTimeCreatedNS, testWaitPosition, testForceStartReplica, false) compareError(t, "SetMaster", err, true, testSetMasterCalled) } func tmRPCTestSetMasterPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - err := client.SetMaster(ctx, tablet, testPrimaryAlias, testTimeCreatedNS, testWaitPosition, testForceStartReplica) + err := client.SetMaster(ctx, tablet, testPrimaryAlias, testTimeCreatedNS, testWaitPosition, testForceStartReplica, false) expectHandleRPCPanic(t, "SetMaster", true /*verbose*/, err) } @@ -1192,7 +1192,7 @@ func tmRPCTestStopReplicationAndGetStatusPanic(ctx context.Context, t *testing.T expectHandleRPCPanic(t, "StopReplicationAndGetStatus", true /*verbose*/, err) } -func (fra *fakeRPCTM) PromoteReplica(ctx context.Context) (string, error) { +func (fra *fakeRPCTM) PromoteReplica(ctx context.Context, semiSync bool) (string, error) { if fra.panics { panic(fmt.Errorf("test-triggered panic")) } @@ -1200,12 +1200,12 @@ func (fra *fakeRPCTM) PromoteReplica(ctx context.Context) (string, error) { } func tmRPCTestPromoteReplica(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - rp, err := client.PromoteReplica(ctx, tablet) + rp, err := client.PromoteReplica(ctx, tablet, false) compareError(t, "PromoteReplica", err, rp, testReplicationPosition) } func tmRPCTestPromoteReplicaPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) { - _, err := client.PromoteReplica(ctx, tablet) + _, err := client.PromoteReplica(ctx, tablet, false) expectHandleRPCPanic(t, "PromoteReplica", true /*verbose*/, err) } diff --git a/go/vt/worker/multi_split_diff.go b/go/vt/worker/multi_split_diff.go index d2cabbb5cb4..0f5d1cf6123 100644 --- a/go/vt/worker/multi_split_diff.go +++ b/go/vt/worker/multi_split_diff.go @@ -407,7 +407,7 @@ func (msdw *MultiSplitDiffWorker) stopReplicationOnSourceTabletAt(ctx context.Co msdw.wr.Logger().Infof("stopping Replication %v at a minimum of %v", msdw.sourceAlias, vreplicationPos) shortCtx, cancel = context.WithTimeout(ctx, *remoteActionsTimeout) - msdw.wr.TabletManagerClient().StartReplication(shortCtx, sourceTablet.Tablet) + msdw.wr.StartReplication(shortCtx, sourceTablet.Tablet) cancel() if err != nil { return "", err diff --git a/go/vt/worker/split_clone_flaky_test.go b/go/vt/worker/split_clone_flaky_test.go index 45a9f1b6259..2295c875e38 100644 --- a/go/vt/worker/split_clone_flaky_test.go +++ b/go/vt/worker/split_clone_flaky_test.go @@ -1058,7 +1058,7 @@ func TestSplitCloneV2_NoPrimaryAvailable(t *testing.T) { } // Make leftReplica the new PRIMARY. - tc.leftReplica.TM.ChangeType(ctx, topodatapb.TabletType_PRIMARY) + tc.leftReplica.TM.ChangeType(ctx, topodatapb.TabletType_PRIMARY, false) t.Logf("resetting tablet back to PRIMARY") tc.leftReplicaQs.UpdateType(topodatapb.TabletType_PRIMARY) tc.leftReplicaQs.AddDefaultHealthResponse() diff --git a/go/vt/worker/utils_test.go b/go/vt/worker/utils_test.go index 2c7a9d3bee2..966e27199ad 100644 --- a/go/vt/worker/utils_test.go +++ b/go/vt/worker/utils_test.go @@ -102,7 +102,7 @@ func newFakeTMCTopo(ts *topo.Server) tmclient.TabletManagerClient { } // ChangeType is part of the tmclient.TabletManagerClient interface. -func (f *fakeTMCTopo) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType) error { +func (f *fakeTMCTopo) ChangeType(ctx context.Context, tablet *topodatapb.Tablet, dbType topodatapb.TabletType, semiSync bool) error { _, err := f.server.UpdateTabletFields(ctx, tablet.Alias, func(t *topodatapb.Tablet) error { t.Type = dbType return nil diff --git a/go/vt/worker/vertical_split_clone_test.go b/go/vt/worker/vertical_split_clone_test.go index ef309536539..cc643793b3d 100644 --- a/go/vt/worker/vertical_split_clone_test.go +++ b/go/vt/worker/vertical_split_clone_test.go @@ -28,6 +28,7 @@ import ( "vitess.io/vitess/go/vt/topo/memorytopo" "vitess.io/vitess/go/vt/topo/topoproto" "vitess.io/vitess/go/vt/topotools" + "vitess.io/vitess/go/vt/vtctl/reparentutil" "vitess.io/vitess/go/vt/vttablet/grpcqueryservice" "vitess.io/vitess/go/vt/vttablet/queryservice/fakes" "vitess.io/vitess/go/vt/wrangler/testlib" @@ -56,6 +57,10 @@ func createVerticalSplitCloneDestinationFakeDb(t *testing.T, name string, insert return f } +func init() { + _ = reparentutil.SetDurabilityPolicy("none", nil) +} + // TestVerticalSplitClone will run VerticalSplitClone in the combined // online and offline mode. The online phase will copy 100 rows from the source // to the destination and the offline phase won't copy any rows as the source diff --git a/go/vt/wrangler/cleaner.go b/go/vt/wrangler/cleaner.go index 10621b049e6..57940a963a1 100644 --- a/go/vt/wrangler/cleaner.go +++ b/go/vt/wrangler/cleaner.go @@ -135,7 +135,7 @@ func RecordChangeTabletTypeAction(cleaner *Cleaner, tabletAlias *topodatapb.Tabl } // ask the tablet to make the change - return wr.tmc.ChangeType(ctx, ti.Tablet, to) + return wr.ChangeTabletType(ctx, ti.Tablet.Alias, to) }) } @@ -143,7 +143,7 @@ func RecordChangeTabletTypeAction(cleaner *Cleaner, tabletAlias *topodatapb.Tabl // into the specified Cleaner func RecordStartReplicationAction(cleaner *Cleaner, tablet *topodatapb.Tablet) { cleaner.Record(StartReplicationActionName, topoproto.TabletAliasString(tablet.Alias), func(ctx context.Context, wr *Wrangler) error { - return wr.TabletManagerClient().StartReplication(ctx, tablet) + return wr.StartReplication(ctx, tablet) }) } diff --git a/go/vt/wrangler/reparent.go b/go/vt/wrangler/reparent.go index 96fa246f93f..b9fa4384488 100644 --- a/go/vt/wrangler/reparent.go +++ b/go/vt/wrangler/reparent.go @@ -200,7 +200,7 @@ func (wr *Wrangler) TabletExternallyReparented(ctx context.Context, newPrimaryAl }() event.DispatchUpdate(ev, "starting external reparent") - if err := wr.tmc.ChangeType(ctx, tablet, topodatapb.TabletType_PRIMARY); err != nil { + if err := wr.tmc.ChangeType(ctx, tablet, topodatapb.TabletType_PRIMARY, reparentutil.SemiSyncAckers(tablet) > 0); err != nil { log.Warningf("Error calling ChangeType on new primary %v: %v", topoproto.TabletAliasString(newPrimaryAlias), err) return err } diff --git a/go/vt/wrangler/tablet.go b/go/vt/wrangler/tablet.go index 06e41b8c306..af2250d0024 100644 --- a/go/vt/wrangler/tablet.go +++ b/go/vt/wrangler/tablet.go @@ -26,9 +26,12 @@ import ( "vitess.io/vitess/go/vt/key" "vitess.io/vitess/go/vt/logutil" + "vitess.io/vitess/go/vt/proto/vtrpc" "vitess.io/vitess/go/vt/topo" "vitess.io/vitess/go/vt/topo/topoproto" "vitess.io/vitess/go/vt/topotools" + "vitess.io/vitess/go/vt/vtctl/reparentutil" + "vitess.io/vitess/go/vt/vterrors" querypb "vitess.io/vitess/go/vt/proto/query" topodatapb "vitess.io/vitess/go/vt/proto/topodata" @@ -171,8 +174,53 @@ func (wr *Wrangler) ChangeTabletType(ctx context.Context, tabletAlias *topodatap return fmt.Errorf("tablet %v type change %v -> %v is not an allowed transition for ChangeTabletType", tabletAlias, ti.Type, tabletType) } + // We should clone the tablet and change its type to the expected type before checking the durability rules + // Since we want to check the durability rules for the desired state and not before we make that change + expectedTablet := proto.Clone(ti.Tablet).(*topodatapb.Tablet) + expectedTablet.Type = tabletType + semiSync, err := wr.shouldSendSemiSyncAck(ctx, expectedTablet) + + if err != nil { + return err + } // and ask the tablet to make the change - return wr.tmc.ChangeType(ctx, ti.Tablet, tabletType) + return wr.tmc.ChangeType(ctx, ti.Tablet, tabletType, semiSync) +} + +// StartReplication is used to start replication on the specified tablet +// It also finds out if the tablet should be sending semi-sync ACKs or not. +func (wr *Wrangler) StartReplication(ctx context.Context, tablet *topodatapb.Tablet) error { + semiSync, err := wr.shouldSendSemiSyncAck(ctx, tablet) + if err != nil { + return err + } + return wr.TabletManagerClient().StartReplication(ctx, tablet, semiSync) +} + +func (wr *Wrangler) shouldSendSemiSyncAck(ctx context.Context, tablet *topodatapb.Tablet) (bool, error) { + shard, err := wr.ts.GetShard(ctx, tablet.Keyspace, tablet.Shard) + if err != nil { + return false, err + } + + if !shard.HasPrimary() { + return false, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "no primary tablet for shard %v/%v", tablet.Keyspace, tablet.Shard) + } + + shardPrimary, err := wr.ts.GetTablet(ctx, shard.PrimaryAlias) + if err != nil { + return false, fmt.Errorf("cannot lookup primary tablet %v for shard %v/%v: %w", topoproto.TabletAliasString(shard.PrimaryAlias), tablet.Keyspace, tablet.Shard, err) + } + + if shardPrimary.Type != topodatapb.TabletType_PRIMARY { + return false, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "TopologyServer has incosistent state for shard primary %v", topoproto.TabletAliasString(shard.PrimaryAlias)) + } + + if shardPrimary.Keyspace != tablet.Keyspace || shardPrimary.Shard != tablet.Shard { + return false, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "primary %v and potential replica %v not in same keypace shard (%v/%v)", topoproto.TabletAliasString(shard.PrimaryAlias), topoproto.TabletAliasString(tablet.Alias), tablet.Keyspace, tablet.Shard) + } + + return reparentutil.IsReplicaSemiSync(shardPrimary.Tablet, tablet), nil } // RefreshTabletState refreshes tablet state diff --git a/proto/tabletmanagerdata.proto b/proto/tabletmanagerdata.proto index d305f9e483f..c925152bd33 100644 --- a/proto/tabletmanagerdata.proto +++ b/proto/tabletmanagerdata.proto @@ -161,6 +161,7 @@ message SetReadWriteResponse { message ChangeTypeRequest { topodata.TabletType tablet_type = 1; + bool semiSync = 2; } message ChangeTypeResponse { @@ -317,6 +318,7 @@ message StopReplicationMinimumResponse { } message StartReplicationRequest { + bool semiSync = 1; } message StartReplicationResponse { @@ -360,6 +362,7 @@ message VReplicationWaitForPosResponse { } message InitPrimaryRequest { + bool semiSync = 1; } message InitPrimaryResponse { @@ -380,6 +383,7 @@ message InitReplicaRequest { topodata.TabletAlias parent = 1; string replication_position = 2; int64 time_created_ns = 3; + bool semiSync = 4; } message InitReplicaResponse { @@ -397,6 +401,7 @@ message DemotePrimaryResponse { } message UndoDemotePrimaryRequest { + bool semiSync = 1; } message UndoDemotePrimaryResponse { @@ -413,6 +418,7 @@ message SetReplicationSourceRequest { int64 time_created_ns = 2; bool force_start_replication = 3; string wait_position = 4; + bool semiSync = 5; } message SetReplicationSourceResponse { @@ -441,6 +447,7 @@ message StopReplicationAndGetStatusResponse { } message PromoteReplicaRequest { + bool semiSync = 1; } message PromoteReplicaResponse { diff --git a/web/vtadmin/src/proto/vtadmin.d.ts b/web/vtadmin/src/proto/vtadmin.d.ts index 177aa7b7430..3914fc4b7b2 100644 --- a/web/vtadmin/src/proto/vtadmin.d.ts +++ b/web/vtadmin/src/proto/vtadmin.d.ts @@ -12277,6 +12277,9 @@ export namespace tabletmanagerdata { /** ChangeTypeRequest tablet_type */ tablet_type?: (topodata.TabletType|null); + + /** ChangeTypeRequest semiSync */ + semiSync?: (boolean|null); } /** Represents a ChangeTypeRequest. */ @@ -12291,6 +12294,9 @@ export namespace tabletmanagerdata { /** ChangeTypeRequest tablet_type. */ public tablet_type: topodata.TabletType; + /** ChangeTypeRequest semiSync. */ + public semiSync: boolean; + /** * Creates a new ChangeTypeRequest instance using the specified properties. * @param [properties] Properties to set @@ -13327,6 +13333,9 @@ export namespace tabletmanagerdata { /** ApplySchemaRequest after_schema */ after_schema?: (tabletmanagerdata.ISchemaDefinition|null); + + /** ApplySchemaRequest sql_mode */ + sql_mode?: (string|null); } /** Represents an ApplySchemaRequest. */ @@ -13353,6 +13362,9 @@ export namespace tabletmanagerdata { /** ApplySchemaRequest after_schema. */ public after_schema?: (tabletmanagerdata.ISchemaDefinition|null); + /** ApplySchemaRequest sql_mode. */ + public sql_mode: string; + /** * Creates a new ApplySchemaRequest instance using the specified properties. * @param [properties] Properties to set @@ -15688,6 +15700,9 @@ export namespace tabletmanagerdata { /** Properties of a StartReplicationRequest. */ interface IStartReplicationRequest { + + /** StartReplicationRequest semiSync */ + semiSync?: (boolean|null); } /** Represents a StartReplicationRequest. */ @@ -15699,6 +15714,9 @@ export namespace tabletmanagerdata { */ constructor(properties?: tabletmanagerdata.IStartReplicationRequest); + /** StartReplicationRequest semiSync. */ + public semiSync: boolean; + /** * Creates a new StartReplicationRequest instance using the specified properties. * @param [properties] Properties to set @@ -16738,6 +16756,9 @@ export namespace tabletmanagerdata { /** Properties of an InitPrimaryRequest. */ interface IInitPrimaryRequest { + + /** InitPrimaryRequest semiSync */ + semiSync?: (boolean|null); } /** Represents an InitPrimaryRequest. */ @@ -16749,6 +16770,9 @@ export namespace tabletmanagerdata { */ constructor(properties?: tabletmanagerdata.IInitPrimaryRequest); + /** InitPrimaryRequest semiSync. */ + public semiSync: boolean; + /** * Creates a new InitPrimaryRequest instance using the specified properties. * @param [properties] Properties to set @@ -17113,6 +17137,9 @@ export namespace tabletmanagerdata { /** InitReplicaRequest time_created_ns */ time_created_ns?: (number|Long|null); + + /** InitReplicaRequest semiSync */ + semiSync?: (boolean|null); } /** Represents an InitReplicaRequest. */ @@ -17133,6 +17160,9 @@ export namespace tabletmanagerdata { /** InitReplicaRequest time_created_ns. */ public time_created_ns: (number|Long); + /** InitReplicaRequest semiSync. */ + public semiSync: boolean; + /** * Creates a new InitReplicaRequest instance using the specified properties. * @param [properties] Properties to set @@ -17470,6 +17500,9 @@ export namespace tabletmanagerdata { /** Properties of an UndoDemotePrimaryRequest. */ interface IUndoDemotePrimaryRequest { + + /** UndoDemotePrimaryRequest semiSync */ + semiSync?: (boolean|null); } /** Represents an UndoDemotePrimaryRequest. */ @@ -17481,6 +17514,9 @@ export namespace tabletmanagerdata { */ constructor(properties?: tabletmanagerdata.IUndoDemotePrimaryRequest); + /** UndoDemotePrimaryRequest semiSync. */ + public semiSync: boolean; + /** * Creates a new UndoDemotePrimaryRequest instance using the specified properties. * @param [properties] Properties to set @@ -17818,6 +17854,9 @@ export namespace tabletmanagerdata { /** SetReplicationSourceRequest wait_position */ wait_position?: (string|null); + + /** SetReplicationSourceRequest semiSync */ + semiSync?: (boolean|null); } /** Represents a SetReplicationSourceRequest. */ @@ -17841,6 +17880,9 @@ export namespace tabletmanagerdata { /** SetReplicationSourceRequest wait_position. */ public wait_position: string; + /** SetReplicationSourceRequest semiSync. */ + public semiSync: boolean; + /** * Creates a new SetReplicationSourceRequest instance using the specified properties. * @param [properties] Properties to set @@ -18358,6 +18400,9 @@ export namespace tabletmanagerdata { /** Properties of a PromoteReplicaRequest. */ interface IPromoteReplicaRequest { + + /** PromoteReplicaRequest semiSync */ + semiSync?: (boolean|null); } /** Represents a PromoteReplicaRequest. */ @@ -18369,6 +18414,9 @@ export namespace tabletmanagerdata { */ constructor(properties?: tabletmanagerdata.IPromoteReplicaRequest); + /** PromoteReplicaRequest semiSync. */ + public semiSync: boolean; + /** * Creates a new PromoteReplicaRequest instance using the specified properties. * @param [properties] Properties to set @@ -43087,6 +43135,12 @@ export namespace binlogdata { /** VEvent last_p_k_event */ last_p_k_event?: (binlogdata.ILastPKEvent|null); + + /** VEvent keyspace */ + keyspace?: (string|null); + + /** VEvent shard */ + shard?: (string|null); } /** Represents a VEvent. */ @@ -43131,6 +43185,12 @@ export namespace binlogdata { /** VEvent last_p_k_event. */ public last_p_k_event?: (binlogdata.ILastPKEvent|null); + /** VEvent keyspace. */ + public keyspace: string; + + /** VEvent shard. */ + public shard: string; + /** * Creates a new VEvent instance using the specified properties. * @param [properties] Properties to set diff --git a/web/vtadmin/src/proto/vtadmin.js b/web/vtadmin/src/proto/vtadmin.js index cf4aada06c1..58dc9b8b732 100644 --- a/web/vtadmin/src/proto/vtadmin.js +++ b/web/vtadmin/src/proto/vtadmin.js @@ -28631,6 +28631,7 @@ $root.tabletmanagerdata = (function() { * @memberof tabletmanagerdata * @interface IChangeTypeRequest * @property {topodata.TabletType|null} [tablet_type] ChangeTypeRequest tablet_type + * @property {boolean|null} [semiSync] ChangeTypeRequest semiSync */ /** @@ -28656,6 +28657,14 @@ $root.tabletmanagerdata = (function() { */ ChangeTypeRequest.prototype.tablet_type = 0; + /** + * ChangeTypeRequest semiSync. + * @member {boolean} semiSync + * @memberof tabletmanagerdata.ChangeTypeRequest + * @instance + */ + ChangeTypeRequest.prototype.semiSync = false; + /** * Creates a new ChangeTypeRequest instance using the specified properties. * @function create @@ -28682,6 +28691,8 @@ $root.tabletmanagerdata = (function() { writer = $Writer.create(); if (message.tablet_type != null && Object.hasOwnProperty.call(message, "tablet_type")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.tablet_type); + if (message.semiSync != null && Object.hasOwnProperty.call(message, "semiSync")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.semiSync); return writer; }; @@ -28719,6 +28730,9 @@ $root.tabletmanagerdata = (function() { case 1: message.tablet_type = reader.int32(); break; + case 2: + message.semiSync = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -28771,6 +28785,9 @@ $root.tabletmanagerdata = (function() { case 8: break; } + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + if (typeof message.semiSync !== "boolean") + return "semiSync: boolean expected"; return null; }; @@ -28832,6 +28849,8 @@ $root.tabletmanagerdata = (function() { message.tablet_type = 8; break; } + if (object.semiSync != null) + message.semiSync = Boolean(object.semiSync); return message; }; @@ -28848,10 +28867,14 @@ $root.tabletmanagerdata = (function() { if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.tablet_type = options.enums === String ? "UNKNOWN" : 0; + object.semiSync = false; + } if (message.tablet_type != null && message.hasOwnProperty("tablet_type")) object.tablet_type = options.enums === String ? $root.topodata.TabletType[message.tablet_type] : message.tablet_type; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + object.semiSync = message.semiSync; return object; }; @@ -30785,6 +30808,7 @@ $root.tabletmanagerdata = (function() { * @property {boolean|null} [allow_replication] ApplySchemaRequest allow_replication * @property {tabletmanagerdata.ISchemaDefinition|null} [before_schema] ApplySchemaRequest before_schema * @property {tabletmanagerdata.ISchemaDefinition|null} [after_schema] ApplySchemaRequest after_schema + * @property {string|null} [sql_mode] ApplySchemaRequest sql_mode */ /** @@ -30842,6 +30866,14 @@ $root.tabletmanagerdata = (function() { */ ApplySchemaRequest.prototype.after_schema = null; + /** + * ApplySchemaRequest sql_mode. + * @member {string} sql_mode + * @memberof tabletmanagerdata.ApplySchemaRequest + * @instance + */ + ApplySchemaRequest.prototype.sql_mode = ""; + /** * Creates a new ApplySchemaRequest instance using the specified properties. * @function create @@ -30876,6 +30908,8 @@ $root.tabletmanagerdata = (function() { $root.tabletmanagerdata.SchemaDefinition.encode(message.before_schema, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.after_schema != null && Object.hasOwnProperty.call(message, "after_schema")) $root.tabletmanagerdata.SchemaDefinition.encode(message.after_schema, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.sql_mode != null && Object.hasOwnProperty.call(message, "sql_mode")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.sql_mode); return writer; }; @@ -30925,6 +30959,9 @@ $root.tabletmanagerdata = (function() { case 5: message.after_schema = $root.tabletmanagerdata.SchemaDefinition.decode(reader, reader.uint32()); break; + case 6: + message.sql_mode = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -30979,6 +31016,9 @@ $root.tabletmanagerdata = (function() { if (error) return "after_schema." + error; } + if (message.sql_mode != null && message.hasOwnProperty("sql_mode")) + if (!$util.isString(message.sql_mode)) + return "sql_mode: string expected"; return null; }; @@ -31010,6 +31050,8 @@ $root.tabletmanagerdata = (function() { throw TypeError(".tabletmanagerdata.ApplySchemaRequest.after_schema: object expected"); message.after_schema = $root.tabletmanagerdata.SchemaDefinition.fromObject(object.after_schema); } + if (object.sql_mode != null) + message.sql_mode = String(object.sql_mode); return message; }; @@ -31032,6 +31074,7 @@ $root.tabletmanagerdata = (function() { object.allow_replication = false; object.before_schema = null; object.after_schema = null; + object.sql_mode = ""; } if (message.sql != null && message.hasOwnProperty("sql")) object.sql = message.sql; @@ -31043,6 +31086,8 @@ $root.tabletmanagerdata = (function() { object.before_schema = $root.tabletmanagerdata.SchemaDefinition.toObject(message.before_schema, options); if (message.after_schema != null && message.hasOwnProperty("after_schema")) object.after_schema = $root.tabletmanagerdata.SchemaDefinition.toObject(message.after_schema, options); + if (message.sql_mode != null && message.hasOwnProperty("sql_mode")) + object.sql_mode = message.sql_mode; return object; }; @@ -35887,6 +35932,7 @@ $root.tabletmanagerdata = (function() { * Properties of a StartReplicationRequest. * @memberof tabletmanagerdata * @interface IStartReplicationRequest + * @property {boolean|null} [semiSync] StartReplicationRequest semiSync */ /** @@ -35904,6 +35950,14 @@ $root.tabletmanagerdata = (function() { this[keys[i]] = properties[keys[i]]; } + /** + * StartReplicationRequest semiSync. + * @member {boolean} semiSync + * @memberof tabletmanagerdata.StartReplicationRequest + * @instance + */ + StartReplicationRequest.prototype.semiSync = false; + /** * Creates a new StartReplicationRequest instance using the specified properties. * @function create @@ -35928,6 +35982,8 @@ $root.tabletmanagerdata = (function() { StartReplicationRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.semiSync != null && Object.hasOwnProperty.call(message, "semiSync")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.semiSync); return writer; }; @@ -35962,6 +36018,9 @@ $root.tabletmanagerdata = (function() { while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.semiSync = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -35997,6 +36056,9 @@ $root.tabletmanagerdata = (function() { StartReplicationRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + if (typeof message.semiSync !== "boolean") + return "semiSync: boolean expected"; return null; }; @@ -36011,7 +36073,10 @@ $root.tabletmanagerdata = (function() { StartReplicationRequest.fromObject = function fromObject(object) { if (object instanceof $root.tabletmanagerdata.StartReplicationRequest) return object; - return new $root.tabletmanagerdata.StartReplicationRequest(); + var message = new $root.tabletmanagerdata.StartReplicationRequest(); + if (object.semiSync != null) + message.semiSync = Boolean(object.semiSync); + return message; }; /** @@ -36023,8 +36088,15 @@ $root.tabletmanagerdata = (function() { * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - StartReplicationRequest.toObject = function toObject() { - return {}; + StartReplicationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.semiSync = false; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + object.semiSync = message.semiSync; + return object; }; /** @@ -38037,6 +38109,7 @@ $root.tabletmanagerdata = (function() { * Properties of an InitPrimaryRequest. * @memberof tabletmanagerdata * @interface IInitPrimaryRequest + * @property {boolean|null} [semiSync] InitPrimaryRequest semiSync */ /** @@ -38054,6 +38127,14 @@ $root.tabletmanagerdata = (function() { this[keys[i]] = properties[keys[i]]; } + /** + * InitPrimaryRequest semiSync. + * @member {boolean} semiSync + * @memberof tabletmanagerdata.InitPrimaryRequest + * @instance + */ + InitPrimaryRequest.prototype.semiSync = false; + /** * Creates a new InitPrimaryRequest instance using the specified properties. * @function create @@ -38078,6 +38159,8 @@ $root.tabletmanagerdata = (function() { InitPrimaryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.semiSync != null && Object.hasOwnProperty.call(message, "semiSync")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.semiSync); return writer; }; @@ -38112,6 +38195,9 @@ $root.tabletmanagerdata = (function() { while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.semiSync = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -38147,6 +38233,9 @@ $root.tabletmanagerdata = (function() { InitPrimaryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + if (typeof message.semiSync !== "boolean") + return "semiSync: boolean expected"; return null; }; @@ -38161,7 +38250,10 @@ $root.tabletmanagerdata = (function() { InitPrimaryRequest.fromObject = function fromObject(object) { if (object instanceof $root.tabletmanagerdata.InitPrimaryRequest) return object; - return new $root.tabletmanagerdata.InitPrimaryRequest(); + var message = new $root.tabletmanagerdata.InitPrimaryRequest(); + if (object.semiSync != null) + message.semiSync = Boolean(object.semiSync); + return message; }; /** @@ -38173,8 +38265,15 @@ $root.tabletmanagerdata = (function() { * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - InitPrimaryRequest.toObject = function toObject() { - return {}; + InitPrimaryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.semiSync = false; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + object.semiSync = message.semiSync; + return object; }; /** @@ -38820,6 +38919,7 @@ $root.tabletmanagerdata = (function() { * @property {topodata.ITabletAlias|null} [parent] InitReplicaRequest parent * @property {string|null} [replication_position] InitReplicaRequest replication_position * @property {number|Long|null} [time_created_ns] InitReplicaRequest time_created_ns + * @property {boolean|null} [semiSync] InitReplicaRequest semiSync */ /** @@ -38861,6 +38961,14 @@ $root.tabletmanagerdata = (function() { */ InitReplicaRequest.prototype.time_created_ns = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * InitReplicaRequest semiSync. + * @member {boolean} semiSync + * @memberof tabletmanagerdata.InitReplicaRequest + * @instance + */ + InitReplicaRequest.prototype.semiSync = false; + /** * Creates a new InitReplicaRequest instance using the specified properties. * @function create @@ -38891,6 +38999,8 @@ $root.tabletmanagerdata = (function() { writer.uint32(/* id 2, wireType 2 =*/18).string(message.replication_position); if (message.time_created_ns != null && Object.hasOwnProperty.call(message, "time_created_ns")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.time_created_ns); + if (message.semiSync != null && Object.hasOwnProperty.call(message, "semiSync")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.semiSync); return writer; }; @@ -38934,6 +39044,9 @@ $root.tabletmanagerdata = (function() { case 3: message.time_created_ns = reader.int64(); break; + case 4: + message.semiSync = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -38980,6 +39093,9 @@ $root.tabletmanagerdata = (function() { if (message.time_created_ns != null && message.hasOwnProperty("time_created_ns")) if (!$util.isInteger(message.time_created_ns) && !(message.time_created_ns && $util.isInteger(message.time_created_ns.low) && $util.isInteger(message.time_created_ns.high))) return "time_created_ns: integer|Long expected"; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + if (typeof message.semiSync !== "boolean") + return "semiSync: boolean expected"; return null; }; @@ -39011,6 +39127,8 @@ $root.tabletmanagerdata = (function() { message.time_created_ns = object.time_created_ns; else if (typeof object.time_created_ns === "object") message.time_created_ns = new $util.LongBits(object.time_created_ns.low >>> 0, object.time_created_ns.high >>> 0).toNumber(); + if (object.semiSync != null) + message.semiSync = Boolean(object.semiSync); return message; }; @@ -39035,6 +39153,7 @@ $root.tabletmanagerdata = (function() { object.time_created_ns = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.time_created_ns = options.longs === String ? "0" : 0; + object.semiSync = false; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = $root.topodata.TabletAlias.toObject(message.parent, options); @@ -39045,6 +39164,8 @@ $root.tabletmanagerdata = (function() { object.time_created_ns = options.longs === String ? String(message.time_created_ns) : message.time_created_ns; else object.time_created_ns = options.longs === String ? $util.Long.prototype.toString.call(message.time_created_ns) : options.longs === Number ? new $util.LongBits(message.time_created_ns.low >>> 0, message.time_created_ns.high >>> 0).toNumber() : message.time_created_ns; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + object.semiSync = message.semiSync; return object; }; @@ -39603,6 +39724,7 @@ $root.tabletmanagerdata = (function() { * Properties of an UndoDemotePrimaryRequest. * @memberof tabletmanagerdata * @interface IUndoDemotePrimaryRequest + * @property {boolean|null} [semiSync] UndoDemotePrimaryRequest semiSync */ /** @@ -39620,6 +39742,14 @@ $root.tabletmanagerdata = (function() { this[keys[i]] = properties[keys[i]]; } + /** + * UndoDemotePrimaryRequest semiSync. + * @member {boolean} semiSync + * @memberof tabletmanagerdata.UndoDemotePrimaryRequest + * @instance + */ + UndoDemotePrimaryRequest.prototype.semiSync = false; + /** * Creates a new UndoDemotePrimaryRequest instance using the specified properties. * @function create @@ -39644,6 +39774,8 @@ $root.tabletmanagerdata = (function() { UndoDemotePrimaryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.semiSync != null && Object.hasOwnProperty.call(message, "semiSync")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.semiSync); return writer; }; @@ -39678,6 +39810,9 @@ $root.tabletmanagerdata = (function() { while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.semiSync = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -39713,6 +39848,9 @@ $root.tabletmanagerdata = (function() { UndoDemotePrimaryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + if (typeof message.semiSync !== "boolean") + return "semiSync: boolean expected"; return null; }; @@ -39727,7 +39865,10 @@ $root.tabletmanagerdata = (function() { UndoDemotePrimaryRequest.fromObject = function fromObject(object) { if (object instanceof $root.tabletmanagerdata.UndoDemotePrimaryRequest) return object; - return new $root.tabletmanagerdata.UndoDemotePrimaryRequest(); + var message = new $root.tabletmanagerdata.UndoDemotePrimaryRequest(); + if (object.semiSync != null) + message.semiSync = Boolean(object.semiSync); + return message; }; /** @@ -39739,8 +39880,15 @@ $root.tabletmanagerdata = (function() { * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UndoDemotePrimaryRequest.toObject = function toObject() { - return {}; + UndoDemotePrimaryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.semiSync = false; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + object.semiSync = message.semiSync; + return object; }; /** @@ -40247,6 +40395,7 @@ $root.tabletmanagerdata = (function() { * @property {number|Long|null} [time_created_ns] SetReplicationSourceRequest time_created_ns * @property {boolean|null} [force_start_replication] SetReplicationSourceRequest force_start_replication * @property {string|null} [wait_position] SetReplicationSourceRequest wait_position + * @property {boolean|null} [semiSync] SetReplicationSourceRequest semiSync */ /** @@ -40296,6 +40445,14 @@ $root.tabletmanagerdata = (function() { */ SetReplicationSourceRequest.prototype.wait_position = ""; + /** + * SetReplicationSourceRequest semiSync. + * @member {boolean} semiSync + * @memberof tabletmanagerdata.SetReplicationSourceRequest + * @instance + */ + SetReplicationSourceRequest.prototype.semiSync = false; + /** * Creates a new SetReplicationSourceRequest instance using the specified properties. * @function create @@ -40328,6 +40485,8 @@ $root.tabletmanagerdata = (function() { writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force_start_replication); if (message.wait_position != null && Object.hasOwnProperty.call(message, "wait_position")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.wait_position); + if (message.semiSync != null && Object.hasOwnProperty.call(message, "semiSync")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.semiSync); return writer; }; @@ -40374,6 +40533,9 @@ $root.tabletmanagerdata = (function() { case 4: message.wait_position = reader.string(); break; + case 5: + message.semiSync = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -40423,6 +40585,9 @@ $root.tabletmanagerdata = (function() { if (message.wait_position != null && message.hasOwnProperty("wait_position")) if (!$util.isString(message.wait_position)) return "wait_position: string expected"; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + if (typeof message.semiSync !== "boolean") + return "semiSync: boolean expected"; return null; }; @@ -40456,6 +40621,8 @@ $root.tabletmanagerdata = (function() { message.force_start_replication = Boolean(object.force_start_replication); if (object.wait_position != null) message.wait_position = String(object.wait_position); + if (object.semiSync != null) + message.semiSync = Boolean(object.semiSync); return message; }; @@ -40481,6 +40648,7 @@ $root.tabletmanagerdata = (function() { object.time_created_ns = options.longs === String ? "0" : 0; object.force_start_replication = false; object.wait_position = ""; + object.semiSync = false; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = $root.topodata.TabletAlias.toObject(message.parent, options); @@ -40493,6 +40661,8 @@ $root.tabletmanagerdata = (function() { object.force_start_replication = message.force_start_replication; if (message.wait_position != null && message.hasOwnProperty("wait_position")) object.wait_position = message.wait_position; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + object.semiSync = message.semiSync; return object; }; @@ -41448,6 +41618,7 @@ $root.tabletmanagerdata = (function() { * Properties of a PromoteReplicaRequest. * @memberof tabletmanagerdata * @interface IPromoteReplicaRequest + * @property {boolean|null} [semiSync] PromoteReplicaRequest semiSync */ /** @@ -41465,6 +41636,14 @@ $root.tabletmanagerdata = (function() { this[keys[i]] = properties[keys[i]]; } + /** + * PromoteReplicaRequest semiSync. + * @member {boolean} semiSync + * @memberof tabletmanagerdata.PromoteReplicaRequest + * @instance + */ + PromoteReplicaRequest.prototype.semiSync = false; + /** * Creates a new PromoteReplicaRequest instance using the specified properties. * @function create @@ -41489,6 +41668,8 @@ $root.tabletmanagerdata = (function() { PromoteReplicaRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.semiSync != null && Object.hasOwnProperty.call(message, "semiSync")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.semiSync); return writer; }; @@ -41523,6 +41704,9 @@ $root.tabletmanagerdata = (function() { while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.semiSync = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -41558,6 +41742,9 @@ $root.tabletmanagerdata = (function() { PromoteReplicaRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + if (typeof message.semiSync !== "boolean") + return "semiSync: boolean expected"; return null; }; @@ -41572,7 +41759,10 @@ $root.tabletmanagerdata = (function() { PromoteReplicaRequest.fromObject = function fromObject(object) { if (object instanceof $root.tabletmanagerdata.PromoteReplicaRequest) return object; - return new $root.tabletmanagerdata.PromoteReplicaRequest(); + var message = new $root.tabletmanagerdata.PromoteReplicaRequest(); + if (object.semiSync != null) + message.semiSync = Boolean(object.semiSync); + return message; }; /** @@ -41584,8 +41774,15 @@ $root.tabletmanagerdata = (function() { * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PromoteReplicaRequest.toObject = function toObject() { - return {}; + PromoteReplicaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.semiSync = false; + if (message.semiSync != null && message.hasOwnProperty("semiSync")) + object.semiSync = message.semiSync; + return object; }; /** @@ -101946,6 +102143,8 @@ $root.binlogdata = (function() { * @property {string|null} [dml] VEvent dml * @property {number|Long|null} [current_time] VEvent current_time * @property {binlogdata.ILastPKEvent|null} [last_p_k_event] VEvent last_p_k_event + * @property {string|null} [keyspace] VEvent keyspace + * @property {string|null} [shard] VEvent shard */ /** @@ -102051,6 +102250,22 @@ $root.binlogdata = (function() { */ VEvent.prototype.last_p_k_event = null; + /** + * VEvent keyspace. + * @member {string} keyspace + * @memberof binlogdata.VEvent + * @instance + */ + VEvent.prototype.keyspace = ""; + + /** + * VEvent shard. + * @member {string} shard + * @memberof binlogdata.VEvent + * @instance + */ + VEvent.prototype.shard = ""; + /** * Creates a new VEvent instance using the specified properties. * @function create @@ -102097,6 +102312,10 @@ $root.binlogdata = (function() { writer.uint32(/* id 20, wireType 0 =*/160).int64(message.current_time); if (message.last_p_k_event != null && Object.hasOwnProperty.call(message, "last_p_k_event")) $root.binlogdata.LastPKEvent.encode(message.last_p_k_event, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.keyspace != null && Object.hasOwnProperty.call(message, "keyspace")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.keyspace); + if (message.shard != null && Object.hasOwnProperty.call(message, "shard")) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.shard); return writer; }; @@ -102164,6 +102383,12 @@ $root.binlogdata = (function() { case 21: message.last_p_k_event = $root.binlogdata.LastPKEvent.decode(reader, reader.uint32()); break; + case 22: + message.keyspace = reader.string(); + break; + case 23: + message.shard = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -102265,6 +102490,12 @@ $root.binlogdata = (function() { if (error) return "last_p_k_event." + error; } + if (message.keyspace != null && message.hasOwnProperty("keyspace")) + if (!$util.isString(message.keyspace)) + return "keyspace: string expected"; + if (message.shard != null && message.hasOwnProperty("shard")) + if (!$util.isString(message.shard)) + return "shard: string expected"; return null; }; @@ -102411,6 +102642,10 @@ $root.binlogdata = (function() { throw TypeError(".binlogdata.VEvent.last_p_k_event: object expected"); message.last_p_k_event = $root.binlogdata.LastPKEvent.fromObject(object.last_p_k_event); } + if (object.keyspace != null) + message.keyspace = String(object.keyspace); + if (object.shard != null) + message.shard = String(object.shard); return message; }; @@ -102447,6 +102682,8 @@ $root.binlogdata = (function() { } else object.current_time = options.longs === String ? "0" : 0; object.last_p_k_event = null; + object.keyspace = ""; + object.shard = ""; } if (message.type != null && message.hasOwnProperty("type")) object.type = options.enums === String ? $root.binlogdata.VEventType[message.type] : message.type; @@ -102476,6 +102713,10 @@ $root.binlogdata = (function() { object.current_time = options.longs === String ? $util.Long.prototype.toString.call(message.current_time) : options.longs === Number ? new $util.LongBits(message.current_time.low >>> 0, message.current_time.high >>> 0).toNumber() : message.current_time; if (message.last_p_k_event != null && message.hasOwnProperty("last_p_k_event")) object.last_p_k_event = $root.binlogdata.LastPKEvent.toObject(message.last_p_k_event, options); + if (message.keyspace != null && message.hasOwnProperty("keyspace")) + object.keyspace = message.keyspace; + if (message.shard != null && message.hasOwnProperty("shard")) + object.shard = message.shard; return object; };