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
12 changes: 1 addition & 11 deletions go/vt/wrangler/reparent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down