You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It adds unnecessary latency, e.g. in the case where a scan across many ranges has to sequentially acquire leases for each range, especially under failure modes such as network outages or disk stalls where the lease acquisition has to wait for network timeouts.
When only using expiration leases, we want to ensure ranges have a lease even when there is no traffic on the ranges, to avoid lease acquisition latencies on the next request to the range.
A few important aspects to consider:
Some ranges are more important that others. In particular, the meta and liveness range leases must get priority.
Expiration lease extensions are currently expensive (one Raft write per extension per range). We may want to allow very cold ranges to let their leases expire after some period of inactivity (e.g. minutes).
We need a scheduler that eagerly maintains range leases. This should:
There are two motivations for this
We don't want lease acquisition to be lazily driven by client requests.
When only using expiration leases, we want to ensure ranges have a lease even when there is no traffic on the ranges, to avoid lease acquisition latencies on the next request to the range.
A few important aspects to consider:
We have a few similar mechanisms already, that should be mostly be replaced by this scheduler:
The replicate queue acquires leases for ranges that doesn't have one.
cockroach/pkg/kv/kvserver/replicate_queue.go
Lines 989 to 996 in 736a67e
Store.startLeaseRenewer()eagerly renews the expiration leases on the meta and liveness ranges to avoid high tail latencies.cockroach/pkg/kv/kvserver/store.go
Lines 2089 to 2098 in 8add7c5
Replica.maybeExtendLeaseAsyncLocked()will extend an expiration lease when processing a request in the last half of the lease interval.cockroach/pkg/kv/kvserver/replica_range_lease.go
Lines 1437 to 1454 in 736a67e
Jira issue: CRDB-25265
Epic CRDB-25207