Skip to content

[kv] Keep KV snapshots readable by FRocksDB 6.20.3 for uniform keys - #4598

Merged
platinumhamburg merged 1 commit into
apache:mainfrom
morazow:rocksdb-snapshot-compat-repro
Oct 11, 2026
Merged

platinumhamburg merged 1 commit into
apache:mainfrom
morazow:rocksdb-snapshot-compat-repro

Conversation

@morazow

@morazow morazow commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #4597

#4133 pins format_version=5 and the kCRC32c checksum so that FRocksDB 6.20.3 clients can read KV snapshots. RocksJava 11.8.1 also defaults BlockBasedTableConfig.uniformCvThreshold to 0.2. With that default, RocksDB sets an is_uniform bit (bit 29) in the footer of index blocks whose keys are evenly spaced, such as sequential integer primary keys. FRocksDB 6.20.3 reads that bit as part of the restart count and fails the scan with bad block contents.

Brief change log

  • RocksDBResourceContainer: set uniformCvThreshold(-1) next to the existing FRocksDB compatibility pins, so the bit is never written. Fluss does not configure an index search type, so the threshold has no effect on reads.
  • RocksIncrementalSnapshotTest: add testSnapshotWithUniformKeysCanBeReadByFrocksDB, which snapshots 10,000 sequential big-endian long keys and has FRocksDB scan every row. The existing 2-key test cannot catch this: an index block needs at least 3 restart keys before RocksDB checks the spacing. The snapshot, download and reader-process steps move into a helper shared by both tests.
  • FrocksDBSnapshotReader: add a --count <rows> mode that does a full iterator scan, like the client's SnapshotFilesReader.

Tests

  • RocksIncrementalSnapshotTest#testSnapshotWithUniformKeysCanBeReadByFrocksDB fails with RocksDBException: bad block contents without the fix and passes with it.
  • RocksIncrementalSnapshotTest and RocksDBResourceContainerTest pass.

API and Format

No API change. Snapshot files no longer carry the is_uniform index block flag.

Documentation

None.

Generative AI disclosure: Yes, Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

RocksJava 11.8.1 defaults uniformCvThreshold to 0.2, so RocksDB sets an
is_uniform bit in the footer of index blocks with evenly spaced keys.
FRocksDB 6.20.3 reads that bit as part of the restart count and fails
the scan with "bad block contents". Pin the threshold to -1 next to the
existing format_version and checksum pins.

Extend the FRocksDB compatibility test with a snapshot of sequential
big-endian keys, scanned in full by the FRocksDB reader.

Closes apache#4597.

@platinumhamburg platinumhamburg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @morazow!

@morazow

morazow commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @platinumhamburg for review! Could you please merge once the CI is okay 🤝

@platinumhamburg
platinumhamburg merged commit 9ddf633 into apache:main Oct 11, 2026
20 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.

[kv] KV snapshots written after the RocksDB 11.8.1 fail to read on FRocksDB 6.20.3 clients

2 participants