-
Notifications
You must be signed in to change notification settings - Fork 111
[storage/metadata] Improve Delta Write Efficiency for Common Case #1189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds delta‐write support so that when keys and value lengths remain stable, only changed segments are written in-place rather than rewriting the entire blob.
- Tracks each key’s byte offset and length in the blob and marks modified keys
- Implements overwrite vs. full-rewrite logic in
sync()
, plus metrics for overwrites and rewrites - Updates docs, tests, and benchmarks to reflect new behavior and renamed parameters
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
storage/src/metadata/storage.rs | Added lengths and modified tracking, implemented in-place overwrite logic, updated metrics |
storage/src/metadata/mod.rs | Renamed docs and tests to use sync_rewrites /sync_overwrites metrics |
storage/src/metadata/benches/utils.rs | Renamed modified_pct →modified and updated helper function signature |
storage/src/metadata/benches/sync.rs | Updated benchmark loops/labels to use modified count |
Comments suppressed due to low confidence (3)
storage/src/metadata/storage.rs:53
- [nitpick] The field name
key_order_changed
is a bit ambiguous; consider renaming it to something likelast_rewrite_version
orlast_key_order_change_version
for greater clarity.
key_order_changed: u64,
storage/src/metadata/benches/utils.rs:38
- [nitpick] The comment is unclear: consider rephrasing to
Modify the first <count> keys and emit a new set of key-value pairs
or update toModify
modifiedkeys
to match the parameter name.
/// Modify `modified` of keys and emit a new set of keys.
storage/src/metadata/storage.rs:184
- [nitpick] Since
K
implementsArray
and may have a fixed size, consider usingK::SIZE
directly instead ofencode_size()
to avoid potential runtime overhead.
cursor += key.encode_size();
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #1189 +/- ##
==========================================
+ Coverage 91.22% 91.28% +0.05%
==========================================
Files 216 216
Lines 57982 58364 +382
==========================================
+ Hits 52896 53278 +382
Misses 5086 5086
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Modifying 1 key on a 100, 1000, and 10000 key store takes ~roughly the same time (and modifies the same amount of data on disk):