From 24e3c4a8e0c53c0d16eb49caf4d68fced3b3d44e Mon Sep 17 00:00:00 2001 From: Aayush Shah Date: Thu, 20 May 2021 01:16:36 -0400 Subject: [PATCH] kvserver: improve documentation for non-ready nodes This commit improves the comment over the `StorePool`'s `isNodeReadyForRoutineReplicaTransfer` method by clarifying the distinction between such non-ready nodes and "dead" nodes. Release note: None --- pkg/kv/kvserver/store_pool.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/kv/kvserver/store_pool.go b/pkg/kv/kvserver/store_pool.go index dc09ea9b35c0..94c23fd6d34c 100644 --- a/pkg/kv/kvserver/store_pool.go +++ b/pkg/kv/kvserver/store_pool.go @@ -350,10 +350,19 @@ type StorePool struct { nodeLocalities map[roachpb.NodeID]localityWithString } - // isStoreReadyForRoutineReplicaTransfer returns true if the - // store is live and thus a good candidate to receive a replica. - // This is defined as a closure reference here instead + // isStoreReadyForRoutineReplicaTransfer returns true iff the store's node is + // live (as indicated by its `NodeLivenessStatus`) and thus a legal candidate + // to receive a replica. This is defined as a closure reference here instead // of a regular method so it can be overridden in tests. + // + // NB: What this method aims to capture is distinct from "dead" nodes. Nodes + // are classified as "dead" if they haven't successfully heartbeat their + // liveness record in the last `server.time_until_store_dead` seconds. + // + // Functionally, the distinction is that we simply avoid transferring replicas + // to "non-ready" nodes (i.e. nodes that _currently_ have a non-live + // `NodeLivenessStatus`), whereas we _actively move replicas off of "dead" + // nodes_. isStoreReadyForRoutineReplicaTransfer func(context.Context, roachpb.StoreID) bool }