Streaming Compression support for RDB#3531
Open
sarthakaggarwal97 wants to merge 3 commits intovalkey-io:unstablefrom
Open
Streaming Compression support for RDB#3531sarthakaggarwal97 wants to merge 3 commits intovalkey-io:unstablefrom
sarthakaggarwal97 wants to merge 3 commits intovalkey-io:unstablefrom
Conversation
c77cc98 to
616d763
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #3531 +/- ##
============================================
+ Coverage 76.21% 76.73% +0.52%
============================================
Files 159 164 +5
Lines 81672 81858 +186
============================================
+ Hits 62243 62815 +572
+ Misses 19429 19043 -386
🚀 New features to boost your workflow:
|
cf051d0 to
e82019b
Compare
Add streaming LZ4-backed RDB compression with rio decorators, stream envelope handling, integration changes, and the follow-up fixes and config cleanup needed on top of unstable. Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
e82019b to
3764776
Compare
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
- Remove dead code: rdbIsValidMagic() and unused #include <string.h> in rdb.h - Remove redundant first RIO_FLAG_SKIP_RDB_CHECKSUM set in rdbSaveInternal - Remove unrelated changes: config_parse_depth, USE_FAST_FLOAT, write-make-settings - Validate full 8-byte VKCS envelope in aof.c rdbFileUsesStreamingCompression - Add SAFETY comment for rdbRioHasCorruptCompressedInput cast invariant - Rename all snake_case identifiers to camelCase per Valkey conventions: types (compression_algo_t -> compressionAlgo, stream_compressor_t -> streamCompressor, compress_rio_t -> compressRio, etc.), functions (stream_writer_create -> streamWriterCreate, compress_rio_finish -> compressRioFinish, write_vkcs_envelope -> writeVkcsEnvelope, etc.), and static variables (compression_lz4_codec_impl -> compressionLz4CodecImpl) - Drop _t suffix from all types to match Valkey convention - Fix typo: streamWriterIsErrord -> streamWriterIsErrored - Replace silent dummy buffer allocation with assert(needed > 0) in streamWriterEnsureOutBuf Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #3195
Overview
Today,
rdbcompressiononly affects individual string payloads inside an otherwise normal RDB stream. This PR adds Valkey Compressed Stream (VKCS) support for RDB persistence, withlz4as the first supported whole-stream codec.The RDB can now be wrapped in a
VKCSenvelope and compressed as a single stream at theriolayer. The default behavior remains unchanged withlzf. On load, the RDB path probes for the envelope first. If present and valid, the input is transparently decompressed before normal RDB parsing continues. If absent, loading falls back to the existing plain RDB path. If the envelope is malformed or incompatible, the load fails early.Architecture
Key Design Decisions
riodecorator rather than as part of object serialization.VKCSadds a small envelope ahead of the compressed payload so loaders can classify the stream before normal RDB parsing begins.lzfremains the default and plain RDB compatibility is preserved.stream_kindvalidation rejects incompatibleVKCSstreams early.rdbLoadandvalkey-check-rdbboth handle plain andVKCS-wrapped inputs transparently.VKCSpath in this PR.Data Flow: Save Path
Important notes:
VKCSheader stores magic, version, codec, flags, andstream_kind.rdbchecksum yesenables codec-native integrity signaling for the compressed stream.LZFpath is bypassed.Data Flow: Load Path
This PR is intentionally scoped to RDB streaming compression and the persistence/load paths that need to understand it. It does not add diskless sync and replication compression APIs.
Benchmarks
Benchmarked on r7g.2xlarge (Graviton, 8 vCPUs, 61GB RAM, NVMe). All results averaged over 3 repeats.
Datasets
Notes: