Skip to content

Commit e796a04

Browse files
committed
kvserver: fix data race in RefreshPolicy
Previously, replica.RefreshPolicy accessed r.shMu.state.Desc directly without holding r.raftMu or r.mu. This commit fixes that by using the descriptor obtained earlier from r.DescAndSpanConfig(). Epic: none Release note: none
1 parent 5af8363 commit e796a04

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/kv/kvserver/replica.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ func (r *Replica) RefreshPolicy(latencies map[roachpb.NodeID]time.Duration) {
13661366
// policy bucket. This then controls how far in the future timestamps will
13671367
// be closed for the range.
13681368
maxLatency := time.Duration(-1)
1369-
for _, peer := range r.shMu.state.Desc.InternalReplicas {
1369+
for _, peer := range desc.InternalReplicas {
13701370
peerLatency := closedts.DefaultMaxNetworkRTT
13711371
if latency, ok := latencies[peer.NodeID]; ok {
13721372
peerLatency = latency

0 commit comments

Comments
 (0)