From d579f27067b5c325ad7754c864636cbbe18d0c8c Mon Sep 17 00:00:00 2001 From: deepthi Date: Sat, 26 Oct 2019 19:38:24 -0700 Subject: [PATCH] EmergencyReparentShard does not need to update shard master, new master will do it Signed-off-by: deepthi --- go/vt/wrangler/reparent.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/go/vt/wrangler/reparent.go b/go/vt/wrangler/reparent.go index 1badf670787..9b5e4e00ac4 100644 --- a/go/vt/wrangler/reparent.go +++ b/go/vt/wrangler/reparent.go @@ -649,7 +649,7 @@ func (wr *Wrangler) emergencyReparentShardLocked(ctx context.Context, ev *events return err } - // Check corner cases we're going to depend on + // Check invariants we're going to depend on. masterElectTabletAliasStr := topoproto.TabletAliasString(masterElectTabletAlias) masterElectTabletInfo, ok := tabletMap[masterElectTabletAliasStr] if !ok { @@ -794,8 +794,6 @@ func (wr *Wrangler) emergencyReparentShardLocked(ctx context.Context, ev *events } } - // After the master is done, we can update the shard record - // (note with semi-sync, it also means at least one slave is done) wgMaster.Wait() if masterErr != nil { // The master failed, there is no way the @@ -805,14 +803,6 @@ func (wr *Wrangler) emergencyReparentShardLocked(ctx context.Context, ev *events wgSlaves.Wait() return fmt.Errorf("failed to PopulateReparentJournal on master: %v", masterErr) } - wr.logger.Infof("updating shard record with new master %v", topoproto.TabletAliasString(masterElectTabletAlias)) - if _, err := wr.ts.UpdateShardFields(ctx, keyspace, shard, func(si *topo.ShardInfo) error { - si.MasterAlias = masterElectTabletAlias - return nil - }); err != nil { - wgSlaves.Wait() - return fmt.Errorf("failed to update shard master record: %v", err) - } // Wait for the slaves to complete. If some of them fail, we // will rebuild the shard serving graph anyway