Skip to content

fix: discard RDB data when sync_rdb=false instead of writing to disk#1026

Merged
suxb201 merged 1 commit intov4from
fix/sync-rdb-false-discard-rdb-data
Mar 2, 2026
Merged

fix: discard RDB data when sync_rdb=false instead of writing to disk#1026
suxb201 merged 1 commit intov4from
fix/sync-rdb-false-discard-rdb-data

Conversation

@suxb201
Copy link
Member

@suxb201 suxb201 commented Mar 2, 2026

Summary

  • When sync_rdb=false, receiveRDB() was still creating a dump.rdb file 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.
  • Now, when sync_rdb=false, the RDB stream is written to io.Discard so the Redis replication protocol is satisfied without touching the filesystem.
  • Added integration test test_sync_rdb_false that verifies: no dump.rdb on disk, RDB keys not synced to dst, AOF incremental data synced correctly.
  • Refactored all test cases: import pybbt directly (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 correctly
  • All existing integration tests pass (python -m pybbt cases/ — 14/14 passed)
  • go build ./... compiles cleanly

🤖 Generated with [Qoder][https://qoder.com]

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]
@suxb201 suxb201 merged commit 358ec12 into v4 Mar 2, 2026
10 checks passed
@suxb201 suxb201 deleted the fix/sync-rdb-false-discard-rdb-data branch March 2, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

如何只做增量同步,关闭全量同步

1 participant