Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion go/vt/wrangler/reparent.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,12 @@ func (wr *Wrangler) plannedReparentShardLocked(ctx context.Context, ev *events.R
if err != nil || (ctx.Err() != nil && ctx.Err() == context.DeadlineExceeded) {
// If we fail to promote the new master, try to roll back to the
// original master before aborting.
undoCtx, undoCancel := context.WithTimeout(ctx, *topo.RemoteOperationTimeout)
// It is possible that we have used up the original context, or that
// not enough time is left on it before it times out.
// But at this point we really need to be able to Undo so as not to
// leave the cluster in a bad state.
// So we create a fresh context based on context.Background().
undoCtx, undoCancel := context.WithTimeout(context.Background(), *topo.RemoteOperationTimeout)
defer undoCancel()
if err1 := wr.tmc.UndoDemoteMaster(undoCtx, oldMasterTabletInfo.Tablet); err1 != nil {
log.Warningf("Encountered error %v while trying to undo DemoteMaster", err1)
Expand Down