Skip to content

storage: new data type for MVCC range key stacks #83895

@erikgrinaker

Description

@erikgrinaker

SimpleMVCCIterator.RangeKeys() currently returns []MVCCRangeKeyValue. However, this stack has a few special properties: it is ordered by timestamp (descending), and all range keys have the same bounds. We have a fair but of code which assumes []MVCCRangeKeyValue has these properties, so that it can e.g. do binary searches.

We should consider using a distinct type for these, e.g. MVCCRangeKeyStack, which is guaranteed to have these properties. Then e.g. FirstRangeKeyAbove() and HasRangeKeyBetween() would be methods of this type, and we could possibly omit the key bound duplication for each element.

Jira issue: CRDB-17344

Epic CRDB-2624

Metadata

Metadata

Assignees

Labels

A-kv-replicationRelating to Raft, consensus, and coordination.A-storageRelating to our storage engine (Pebble) on-disk storage.C-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions