Skip to content

perf(sync): request an empty RDB when sync_rdb is disabled - #1076

Merged
suxb201 merged 1 commit into
tair-opensource:v4from
lvxiaorun:codex/empty-rdb-sync
Nov 12, 2026
Merged

suxb201 merged 1 commit into
tair-opensource:v4from
lvxiaorun:codex/empty-rdb-sync

Conversation

@lvxiaorun

Copy link
Copy Markdown
Contributor

When sync_reader.sync_rdb=false, the source still serializes and transfers its complete dataset before RedisShake discards the RDB. This makes starting incremental-only synchronization unnecessarily expensive for large datasets.

Negotiate EOF capability and request REPLCONF rdb-filter-only "" before PSYNC when RDB synchronization is disabled. Supporting sources send an empty RDB; server-side rejection falls back to receiving and discarding the full snapshot. Connection failures and invalid replies still fail the handshake. EOF is negotiated automatically for this mode, including with the default try_diskless=false.

Also acknowledge replication offset zero after receiving the RDB. A newly created backlog can start at zero, and an EOF-based source waits for that ACK before releasing the incremental stream. The source still forks and sends an empty RDB; the PSYNC starting-point semantics are unchanged.

Validation:

  • go test ./... -count=1
  • go test -race ./internal/reader -run TestSyncReader -count=1
  • Protocol tests cover command ordering, unsupported capabilities, ACL rejection, malformed replies, connection closure, and ACK 0.
  • Six focused integration cases passed on Redis 6.2.24, Redis 7.0.15, and Valkey 8.0.12, each with source repl-diskless-sync=no/yes and try_diskless=false. They verify that existing keys are skipped and subsequent writes reach the target.
  • With an uncompressed 1 MiB value already in the source, startup network output was 3,028 bytes on Redis 7.0 and 3,628–3,630 bytes on Valkey 8.0. Redis 6.2 transferred approximately 1.05 MiB through the fallback path.

Includes configuration comments and English/Chinese documentation for capability negotiation, fallback, and the remaining fork/RDB overhead.

@suxb201
suxb201 merged commit 18977b0 into tair-opensource:v4 Nov 12, 2026
10 checks passed
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.

2 participants