fix: discard RDB data when sync_rdb=false instead of writing to disk#1026
Merged
fix: discard RDB data when sync_rdb=false instead of writing to disk#1026
Conversation
When sync_rdb is set to false, receiveRDB() was still creating a dump.rdb file on disk and writing the full RDB payload into it. The file was simply never read back — but it wasted disk I/O and space, and was never cleaned up. Now, when sync_rdb=false, we write the RDB stream to io.Discard so the replication protocol is satisfied without touching the filesystem. Also refactored all test cases: use `import pybbt` directly instead of `import pybbt as p`, and split monolithic `@pybbt.case() def main()` into individual `@pybbt.case()` functions for better isolation and discoverability. Closes #1015 🤖 Generated with [Qoder][https://qoder.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.
Summary
sync_rdb=false,receiveRDB()was still creating adump.rdbfile on disk. The RDB payload was received and written but never read back — wasting disk I/O / space, and the file was never cleaned up.sync_rdb=false, the RDB stream is written toio.Discardso the Redis replication protocol is satisfied without touching the filesystem.test_sync_rdb_falsethat verifies: nodump.rdbon disk, RDB keys not synced to dst, AOF incremental data synced correctly.import pybbtdirectly (no alias), split@pybbt.case() def main()into individual@pybbt.case()functions for better isolation.Closes #1015
Test plan
test_sync_rdb_false: validates no dump.rdb file exists, RDB data is discarded, AOF data syncs correctlypython -m pybbt cases/— 14/14 passed)go build ./...compiles cleanly🤖 Generated with [Qoder][https://qoder.com]