Skip to content

Commit

Permalink
kvserver: plumb a ctx
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
andreimatei committed Mar 2, 2021
1 parent 100cc1d commit 84c137e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/store_create_replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (s *Store) tryGetOrCreateReplica(
repl.mu.destroyStatus.Set(errors.Wrapf(err, "%s: failed to initialize", repl), destroyReasonRemoved)
repl.mu.Unlock()
s.mu.Lock()
s.unlinkReplicaByRangeIDLocked(rangeID)
s.unlinkReplicaByRangeIDLocked(ctx, rangeID)
s.mu.Unlock()
repl.raftMu.Unlock()
return nil, false, err
Expand Down
6 changes: 3 additions & 3 deletions pkg/kv/kvserver/store_remove_replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (s *Store) removeInitializedReplicaRaftMuLocked(

s.mu.Lock()
defer s.mu.Unlock()
s.unlinkReplicaByRangeIDLocked(rep.RangeID)
s.unlinkReplicaByRangeIDLocked(ctx, rep.RangeID)
if it := s.mu.replicasByKey.DeleteReplica(ctx, rep); it.repl != rep {
// We already checked that our replica was present in replicasByKey
// above. Nothing should have been able to change that.
Expand Down Expand Up @@ -239,15 +239,15 @@ func (s *Store) removeUninitializedReplicaRaftMuLocked(
if s.removePlaceholderLocked(ctx, rep.RangeID) {
atomic.AddInt32(&s.counts.droppedPlaceholders, 1)
}
s.unlinkReplicaByRangeIDLocked(rep.RangeID)
s.unlinkReplicaByRangeIDLocked(ctx, rep.RangeID)
}

// unlinkReplicaByRangeIDLocked removes all of the store's references to the
// provided replica that are keyed by its range ID. The replica may also need
// to be removed from the replicasByKey map.
//
// store.mu must be held.
func (s *Store) unlinkReplicaByRangeIDLocked(rangeID roachpb.RangeID) {
func (s *Store) unlinkReplicaByRangeIDLocked(ctx context.Context, rangeID roachpb.RangeID) {
s.mu.AssertHeld()
s.unquiescedReplicas.Lock()
delete(s.unquiescedReplicas.m, rangeID)
Expand Down

0 comments on commit 84c137e

Please sign in to comment.