From baa15c2571257ed2bd00cc9f38f0d748eeeaa6d2 Mon Sep 17 00:00:00 2001 From: dleibovic Date: Tue, 30 Apr 2019 20:35:37 -0400 Subject: [PATCH] During PlannedReparentShard, use timeouts specified by -wait_slave_timeout for PromoteSlaveWhenCaughtUp Signed-off-by: dleibovic --- go/vt/vtctl/reparent.go | 3 ++- go/vt/wrangler/reparent.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go/vt/vtctl/reparent.go b/go/vt/vtctl/reparent.go index 0ef3b5861e5..d66ec73426b 100644 --- a/go/vt/vtctl/reparent.go +++ b/go/vt/vtctl/reparent.go @@ -22,6 +22,7 @@ import ( "time" "golang.org/x/net/context" + "vitess.io/vitess/go/vt/topo" "vitess.io/vitess/go/vt/topo/topoproto" "vitess.io/vitess/go/vt/wrangler" @@ -100,7 +101,7 @@ func commandPlannedReparentShard(ctx context.Context, wr *wrangler.Wrangler, sub return fmt.Errorf("active reparent commands disabled (unset the -disable_active_reparents flag to enable)") } - waitSlaveTimeout := subFlags.Duration("wait_slave_timeout", 30*time.Second, "time to wait for slaves to catch up in reparenting") + waitSlaveTimeout := subFlags.Duration("wait_slave_timeout", *topo.RemoteOperationTimeout, "time to wait for slaves to catch up in reparenting") keyspaceShard := subFlags.String("keyspace_shard", "", "keyspace/shard of the shard that needs to be reparented") newMaster := subFlags.String("new_master", "", "alias of a tablet that should be the new master") avoidMaster := subFlags.String("avoid_master", "", "alias of a tablet that should not be the master, i.e. reparent to any other tablet if this one is the master") diff --git a/go/vt/wrangler/reparent.go b/go/vt/wrangler/reparent.go index 565023cee4c..88aa0132795 100644 --- a/go/vt/wrangler/reparent.go +++ b/go/vt/wrangler/reparent.go @@ -425,7 +425,7 @@ func (wr *Wrangler) plannedReparentShardLocked(ctx context.Context, ev *events.R return fmt.Errorf("old master tablet %v DemoteMaster failed: %v", topoproto.TabletAliasString(shardInfo.MasterAlias), err) } - remoteCtx, remoteCancel = context.WithTimeout(ctx, *topo.RemoteOperationTimeout) + remoteCtx, remoteCancel = context.WithTimeout(ctx, waitSlaveTimeout) defer remoteCancel() // Wait on the master-elect tablet until it reaches that position,