Skip to content

Commit

Permalink
kvserver: (also) pause snapshots to paused followers
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
tbg committed Jul 15, 2022
1 parent 43a37d5 commit 7aa9a2c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/kv/kvserver/raft_snapshot_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ func (rq *raftSnapshotQueue) processRaftSnapshot(
return false, nil
}
}
repl.mu.RLock()
_, destPaused := repl.mu.pausedFollowers[id]
repl.mu.RUnlock()
if ioThresh := repl.store.ioOverloadedStores.Load()[repDesc.StoreID]; ioThresh != nil && destPaused {
// If the destination is paused, be more hesitant to send snapshots. The destination being
// paused implies that we have recently checked that it's not required for quorum, and that
// we wish to conserve I/O on that store, which sending a snapshot counteracts. So hold back on
// the snapshot as well.
err := errors.Errorf("skipping snapshot; %s is overloaded: %s", repDesc, ioThresh)
repl.reportSnapshotStatus(ctx, repDesc.ReplicaID, err)
return false, err
}

err := repl.sendSnapshot(ctx, repDesc, snapType, kvserverpb.SnapshotRequest_RECOVERY)

Expand Down

0 comments on commit 7aa9a2c

Please sign in to comment.