cockroachdb / cockroachdb/cockroach
kvserver: store lease history
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
`Replica` maintains a circular buffer of 5 latest lease changes: https://github.com/cockroachdb/cockroach/blob/982decd0807c27e1398aca565615dedd2501fc06/pkg/kv/kvserver/lease_history.go#L16-L22
When the node restarts or crashes, this history is lost, and we only know the latest lease. This is inconvenient when debugging issues related to inconsistent leases, or issues where this history is helpful. For example, if a consistency checker terminates a node which disagrees with other nodes on a lease, there is no easy way to reconstruct this node's view on the lease history.
One solution to this is to maintain the lease history circular buffer in the local unreplicated [key space](https://github.com/cockroachdb/cockroach/blob/3959ada91d6184b5b09b15394925a40f40e79cbf/pkg/keys/constants.go#L102-L137) of the range. Then this history can be a) recovered into memory upon replica restart, b) inspected directly in storage (e.g. in the consistency checker failure case it can be retrieved from the storage checkpoints).
Jira issue: CRDB-44363
Contributor guide
Assessment
This issue has not been assessed yet.