cockroachdb / cockroachdb/cockroach

storage: adapt MVCCIterator interface to defer decoding MVCCValue

Open
#144,715 3 comments 0 reactions 0 assignees View on GitHub
A-storage C-enhancement T-storage
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Today uses of the MVCCIterator that need to read the MVCCValue.LocalTimestamp for uncertainty interval checks retrieve the MVCCValue, decode it and then extract the local timestamp. Eg:

https://github.com/cockroachdb/cockroach/blob/61868f0ae68a5fb0cadeda92f0be913e53b41c0f/pkg/storage/pebble_mvcc_scanner.go#L923-L929

With Pebble value separation (cockroachdb/pebble#112) retrieval of a value may become more expensive, requiring reads from a separate blob file. To make these uncertainty checks cheap, we plan to introduce a concept of a 'long attribute' (cockroachdb/pebble#4588) that will be used to store the local timestamp inline within the sstable.

To make use of this feature, the MVCCIterator will need to be adapted so that these callers don't need to eagerly retrieve the MVCCValue. When a value is inlined in the sstable (and we must decode the MVCCValue to retrieve the local timestamp), we should ensure we avoid double-decoding if the caller eventually needs the MVCCValue.

Jira issue: CRDB-49499

Epic PEBBLE-1226

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.