@@ -40,9 +40,10 @@ type PolicyRefresher struct {
4040 // when there is a leaseholder change or when there is a span config change.
4141 refreshNotificationCh chan struct {}
4242
43- // getNodeLatencies returns a map of node IDs to their measured latencies
44- // from the current node. Replicas use this information to determine
45- // appropriate closed timestamp policies.
43+ // getNodeLatencies returns a map of node IDs to their observed round-trip
44+ // latencies from the current node. Replicas use this information to determine
45+ // appropriate closed timestamp policies. See rpc.RemoteClockMonitor for more
46+ // details.
4647 getNodeLatencies func () map [roachpb.NodeID ]time.Duration
4748
4849 // latencyCache caches the latency information from getNodeLatencies. This
@@ -85,10 +86,10 @@ func NewPolicyRefresher(
8586// Replica defines a thin interface to update closed timestamp policies.
8687type Replica interface {
8788 // RefreshPolicy informs the replica that it should refresh its closed
88- // timestamp policy. A latency map, which includes observed latency to other
89- // nodes in the system by the PolicyRefresher may be supplied (or may be nil),
90- // in which case it may be used to correctly place a replica in its latency
91- // based global reads bucket.
89+ // timestamp policy. A latency map, which includes round-trip observed latency
90+ // to other nodes in the system by the PolicyRefresher may be supplied (or may
91+ // be nil), in which case it may be used to correctly place a replica in its
92+ // latency based global reads bucket.
9293 RefreshPolicy (map [roachpb.NodeID ]time.Duration )
9394}
9495
@@ -118,17 +119,19 @@ func (pr *PolicyRefresher) EnqueueReplicaForRefresh(replica Replica) {
118119 }
119120}
120121
121- // updateLatencyCache refreshes the cached latency information by fetching fresh
122- // measurements from the actual RPC context. This can be expensive, so we only
123- // do this periodically based on the configured refresh interval.
122+ // updateLatencyCache refreshes the cached round-trip latency information by
123+ // fetching fresh measurements from the actual RPC context. This can be
124+ // expensive, so we only do this periodically based on the configured refresh
125+ // interval.
124126func (pr * PolicyRefresher ) updateLatencyCache () {
125127 pr .mu .Lock ()
126128 defer pr .mu .Unlock ()
127129 pr .mu .latencyCache = pr .getNodeLatencies ()
128130}
129131
130- // getCurrentLatencies returns the current latency information if auto-tuning is
131- // enabled and the cluster has been fully upgraded to v25.2, or nil otherwise.
132+ // getCurrentLatencies returns the current round-trip latency information if
133+ // auto-tuning is enabled and the cluster has been fully upgraded to v25.2, or
134+ // nil otherwise.
132135func (pr * PolicyRefresher ) getCurrentLatencies () map [roachpb.NodeID ]time.Duration {
133136 // Testing knobs only.
134137 if pr .knobs != nil && pr .knobs .InjectedLatencies != nil {
0 commit comments