cockroachdb / cockroachdb/cockroach
kv,storage: run migration to strip synthetic bit from MVCC keys
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
In https://github.com/cockroachdb/cockroach/pull/116830, we removed synthetic MVCC timestamps. To make this possible, we first landed https://github.com/cockroachdb/cockroach/pull/105523, which stopped encoding and decoding the synthetic timestamp bit in/from MVCC keys. This limited the reach of previously stored synthetic timestamps in long-lived clusters to just the MVCC decoding layer. We paired this with https://github.com/cockroachdb/cockroach/pull/117304, which avoided mixed-version cluster concerns during replica consistency checks (along with a number of other PRs listed in https://github.com/cockroachdb/cockroach/issues/101938).
However, we never ran a migration to strip the synthetic bit from persistent MVCC keys that have the bit set. We should, as keeping around these keys presents some risk. This will allow us to get rid of the [key decoding logic](https://github.com/cockroachdb/cockroach/blob/a8f64695f5d025a3347c27ed03ee0e36fbdaacd3/pkg/storage/engine_key.go#L161-L162) which deals with the synthetic MVCC key suffix encoding. It will also allow us to get rid of the MVCC key suffix [normalization logic](https://github.com/cockroachdb/cockroach/blob/a8f64695f5d025a3347c27ed03ee0e36fbdaacd3/pkg/storage/pebble.go#L527) in the key [comparator](https://github.com/cockroachdb/cockroach/blob/a8f64695f5d025a3347c27ed03ee0e36fbdaacd3/pkg/storage/pebble.go#L444) and [equality](https://github.com/cockroachdb/cockroach/blob/a8f64695f5d025a3347c27ed03ee0e36fbdaacd3/pkg/storage/pebble.go#L481) functions, which are needed to ensure that read+decode+encode+delete logic works correctly with synthetic timestamps.
Because of the previous work in this area, such a migration can be local to a single replica — it doesn't need to be replicated across all replicas in a range. This simplifies things meaningfully.
Jira issue: CRDB-41621
Contributor guide
Assessment
This issue has not been assessed yet.