cockroachdb / cockroachdb/cockroach

kvserver: timestamp and invalidate storepool estimates

Open
#93,532 0 comments 0 reactions 0 assignees View on GitHub
A-kv C-enhancement T-kv
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Is your feature request related to a problem? Please describe.**
The storepool for each store locally tracks every store's capacity (qps, lease count etc). This capacity is gathered from gossip and used in allocation. When an allocation change occurs, which originates locally, the local store will update the storepool with an estimate of the impact. This is done to allow the local store to continue to make allocation decisions that take into account the recent change.

These local estimates are overridden by gossip, each time a new descriptor is received.

This leads to an issue where an action could take place at `t2`, while the capacity of a store involved in that action could be sent at `t1` and received by another store that originated this action at `t3`. Here, the local update is overridden by the gossip update at `t1`.

The solution is to include time in both local estimate application and when gossip updates are received.

More specifically,
1. when an estimated impact is applied locally to a store capacity, we include the current timestamp.
2. when creating a store capacity to be gossiped, we timestamp it with the current time.
3. when receiving a store capacity from gossip, we invalidate any estimated impacts which have a timestamp less than the timestamp associated with the gossiped capacity.

Jira issue: CRDB-22382

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.