Skip to content

Commit

Permalink
storage: Fix a discrepancy between quiescent flag and uniquesced map
Browse files Browse the repository at this point in the history
There are two paths by which a replica can become unquiesced, and only
one of them updated the unquiesced map.

Updates cockroachdb#26257

This is probably the underlying issue there, although I'm still
looking for potential synchronization problems coming from the use of
two different locks.

Release note: None
  • Loading branch information
bdarnell committed May 31, 2018
1 parent 09ccc71 commit c6b8f11
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/storage/replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -3425,6 +3425,9 @@ func (r *Replica) unquiesceAndWakeLeaderLocked() {
log.Infof(ctx, "unquiescing: waking leader")
}
r.mu.quiescent = false
r.store.unquiescedReplicas.Lock()
r.store.unquiescedReplicas.m[r.RangeID] = struct{}{}
r.store.unquiescedReplicas.Unlock()
r.maybeCampaignOnWakeLocked(ctx)
// Propose an empty command which will wake the leader.
_ = r.mu.internalRaftGroup.Propose(encodeRaftCommandV1(makeIDKey(), nil))
Expand Down

0 comments on commit c6b8f11

Please sign in to comment.