Skip to content

docs: defer compressed on-disk RDB (S3.1/S3.2) to v2#1

Draft
GilboaAWS wants to merge 1 commit into
unstablefrom
gilboa/defer-rdb-compression-v2
Draft

docs: defer compressed on-disk RDB (S3.1/S3.2) to v2#1
GilboaAWS wants to merge 1 commit into
unstablefrom
gilboa/defer-rdb-compression-v2

Conversation

@GilboaAWS

Copy link
Copy Markdown
Owner

Summary

Moves compressed on-disk RDB (the RDB_ENC_COMPRESSED encode/decode path, R2.6.1–R2.6.4) from v1 to v2. Docs-only.

Rationale

Compressed on-disk RDB is a local-snapshot optimization — smaller/faster RDB file and faster warm-up back to the compressed state after a restart. It is not a correctness requirement and not a sync-speed improvement: full-sync replication is uncompressed in v1 regardless (R2.6.8).

v1 is already correct and memory-safe without it:

  • Every RDB save target (disk, full-sync, AOF preamble, DUMP/MIGRATE) emits uncompressed, routing each value through objectGetUncompressedView at save time (PR . valkey-io/valkey#24). Verified: rdbSaveStringObject (rdb.c) and rioWriteBulkObject (aof.c:1909) both decompress.
  • Decompression is transient and per-value — one throwaway scratch sds at a time; the live compressed robj is never mutated. A full-keyspace save never decompresses everything at once; peak overhead is a single value ≤ compression-max-value-size. (This also answers the memory-overflow concern: no overflow risk.)
  • On load there's nothing compressed to read; the sweeper re-compresses in memory afterward.

Changes

  • plan.md: S3.3 (full-sync uncompressed) + S3.4 (AOF uncompressed) marked complete — covered by PR . valkey-io/valkey#24. S3.1/S3.2 marked deferred, added to the §8 v2 out-of-scope list.
  • design §2.6: scope note at the top of Persistence; R2.6.1–R2.6.4 tagged v2; R2.6.8 and the §1 boundary note updated for the v1/v2 split.

In v1, RDB_ENC_COMPRESSED (=4) stays reserved-but-unused and RDB_VERSION is not bumped.

Not changing

R2.6.5–R2.6.8 (AOF / replication / DUMP / full-sync all uncompressed) hold in both v1 and v2 — no behavior change.

Compressed on-disk RDB (RDB_ENC_COMPRESSED encode/decode, R2.6.1-R2.6.4)
is a local-snapshot optimization — smaller/faster RDB and faster
warm-up to the compressed state after a restart. It is NOT a
correctness requirement and NOT a sync-speed improvement: full-sync
replication is uncompressed in v1 regardless (R2.6.8).

v1 is already correct and memory-safe without it:
  - All RDB save targets (disk, full-sync, AOF preamble, DUMP/MIGRATE)
    emit uncompressed, routing each value through
    objectGetUncompressedView at save time (PR valkey-io#24). Decompression is
    transient and per-value (one throwaway scratch sds at a time; the
    live compressed robj is never mutated), so a full-keyspace save
    never decompresses everything at once — peak overhead is a single
    value <= compression-max-value-size.
  - On load there is nothing compressed to read; the sweeper
    re-compresses in memory afterward.

Changes:
  - plan.md: S3.3 (full-sync uncompressed) and S3.4 (AOF uncompressed)
    marked complete — covered by PR valkey-io#24. S3.1/S3.2 marked deferred and
    added to the §8 v2 list.
  - design §2.6: scope note at the top; R2.6.1-R2.6.4 tagged v2;
    R2.6.8 and the §1 boundary note updated for the v1/v2 split.

In v1 RDB_ENC_COMPRESSED (=4) stays reserved-but-unused and
RDB_VERSION is not bumped.
@GilboaAWS GilboaAWS force-pushed the gilboa/defer-rdb-compression-v2 branch from 8b5c876 to 1385234 Compare June 25, 2026 11:07
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