Snapshot Engine + flatKV integration: phase 1 - #3902
Conversation
PR SummaryHigh Risk Overview Removes the Pebble Snapshot engine API/lifecycle refactor: ABCI tests for migration batch size split: one test drives Reviewed by Cursor Bugbot for commit c44b7dd. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
This comment was marked as low quality.
This comment was marked as low quality.
| // Set sets the value for the given key at the current version. | ||
| // | ||
| // A write to a shard that is out of service is refused: it would land in versioned data that no |
There was a problem hiding this comment.
What does out of service mean for a shard? When would a shard become out of service?
There was a problem hiding this comment.
Two scenarios qualify as "out of service":
- The shard is shutdown. Only reachable if you call shutdown concurrently with an operation that touches a shard (which is illegal).
- The shard has crashed. Only possible when the DB experiences a crash. DB failures are fatal, so we should never try to recover them.
Updated the doc to spell this out.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c44b7dd. Configure here.
| // Post-Cosmos this goes away along with rootmulti: a single call will supply a block's writes and | ||
| // commit them, and nothing will ask for a hash mid-block. | ||
| func (s *CommitStore) RootHash() []byte { | ||
| if err := s.commitPendingBlock(); err != nil { |
There was a problem hiding this comment.
is looks RootHash commits the pending block. then later composite commit increments FlatKV again? is there a double commits on flatkv?
There was a problem hiding this comment.
This is intentional on my part. The core problem is that comsos wants the hash before the commit, but the proper shape of the storage engine is to provide a hash only after the block is finalized+committed.
I've set it up so that if we call Commit() multiple times for the same block number, later commits become no-ops. If you try to write changes to the block after the commit, you get an error. Previously it was technically possible to write changes after we get the hash but before the commit, but this would either mean the hash is actually an invalid hash for that block.
Worth a discussion in parking lot.
| if c.MetadataDBConfig.DataDir == "" { | ||
| c.MetadataDBConfig.DataDir = filepath.Join(workDir, metadataDir) | ||
| } | ||
| applyPebbleMetricsConfig(c) |
There was a problem hiding this comment.
Config.Fsync is not passed to the five snapshot-engine FlushSync fields. Since FlushSync defaults to false, programmatic callers that set Fsync=true still get unsynchronized normal flushes. can we propagate this value to all five store configurations and add a test.
There was a problem hiding this comment.
good point, fixed
| lowest = height | ||
| } | ||
| } | ||
| // The metadata database records the store-wide committed version, so that is its own height. |
There was a problem hiding this comment.
Shall we just remove the metadata DB?

Describe your changes and provide context
Integrate flatKV and the new snapshot engine.
As part of the pipelining refactor, our goal is to move three things off of the main execution thread:
In order to limit the size of this PR, this PR only moves flushing of data off the main thread, although it does lay the groundwork for moving hashing and checkpointing off-thread.