Skip to content

Commit

Permalink
kvserver: defer unlock in maybeCoalesceHeartbeat
Browse files Browse the repository at this point in the history
Release note: None

Part of: cockroachdb#105366
  • Loading branch information
andrewbaptist committed May 14, 2024
1 parent 564793c commit da9eadd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/kv/kvserver/replica_raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -1588,9 +1588,11 @@ func (r *Replica) maybeCoalesceHeartbeat(
switch msg.Type {
case raftpb.MsgHeartbeat:
r.store.coalescedMu.Lock()
defer r.store.coalescedMu.Unlock()
hbMap = r.store.coalescedMu.heartbeats
case raftpb.MsgHeartbeatResp:
r.store.coalescedMu.Lock()
defer r.store.coalescedMu.Unlock()
hbMap = r.store.coalescedMu.heartbeatResponses
default:
return false
Expand All @@ -1613,7 +1615,6 @@ func (r *Replica) maybeCoalesceHeartbeat(
NodeID: toReplica.NodeID,
}
hbMap[toStore] = append(hbMap[toStore], beat)
r.store.coalescedMu.Unlock()
return true
}

Expand Down

0 comments on commit da9eadd

Please sign in to comment.