cockroachdb / cockroachdb/cockroach

kvserver: avoid using wide Pebble snapshots

Open
#104,661 1 comment 0 reactions 0 assignees View on GitHub
C-performance T-kv
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

We sometimes use Pebble snapshots, via `storage.NewSnapshot()`, for a consistent view of the engine: MVCC GC, Raft snapshot sending, consistency checks, loss of quorum recovery, etc. However, these snapshots can prevent Pebble compactions, especially if they're held for long.

We should consider a couple of other approaches:

* [Keyspan snapshots](https://github.com/cockroachdb/pebble/issues/1810): we usually only care about the keyspan of a single range, so limiting snapshots to this keyspan would significantly reduce the impact of snapshots.

* Consistent iterators: iterators have a consistent view of the engine, and can be cloned. They don't affect compactions, but will pin memtables in memory and prevent SST deletion.

Jira issue: CRDB-28659

Contributor guide

Open the contributing guide

Research direction

Start by tracing the storage.NewSnapshot() call sites involved in MVCC GC, Raft snapshot sending, consistency checks, and loss-of-quorum recovery. Read the linked Pebble keyspan snapshots issue and compare that approach with consistent iterators, including their compaction, memtable, and SST-deletion tradeoffs. Done requires a decided replacement approach and corresponding validation for these uses.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases, distributed-systems
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.