CNDB-17829: Add possibility to configure the Digest file checksum type#2434
CNDB-17829: Add possibility to configure the Digest file checksum type#2434cbornet wants to merge 7 commits into
Conversation
Checklist before you submit for review
|
|
|
Benchmark results on an AWS writer node: |
|
Is this planned to be upstreamed or always rebased ? (ftr, saying yes to upstreaming doesn't mean do, or block on, it now. but it's worth creating the C* ticket and get the idea of this approach in first. it can also help smoke out critical questions from other sources…) |
|
My current feeling would be to not upstream as I'm not sure there would be an interest in the broader community for this. But I'm happy to do it if there is. |
Can you elaborate on this (please). (No objection, just appreciate having your reasoning, logical or intuition, noted.) |
|
Indeed, in the context of this CEP, that's interesting. Thanks for pointing that out! |
|
PR on main-5.0 branch: #2442 |
There was a problem hiding this comment.
Pull request overview
This PR introduces a configurable checksum algorithm for SSTable digest files, expanding beyond the existing CRC32 digest to support CRC32C and CRC64-NVMe. The goal is to allow operators to select the digest checksum type via a new config property, and have SSTable commit/verification logic read/write the corresponding digest component.
Changes:
- Add
sstable_digest_typeconfiguration (CRC32 default, plus CRC32C and CRC64NVME) and route SSTable digest writing to the selected digest component filename. - Extend checksum support (
ChecksumType) with CRC32C and CRC64NVME (AWS CRT-backed when available, otherwise pure-Java CRC64NVME). - Update verification / validation paths and add new unit + distributed tests and a microbenchmark for the new checksum types.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/java/org/apache/cassandra/config/Config.java |
Adds SSTableDigestType enum and sstable_digest_type config field. |
src/java/org/apache/cassandra/config/DatabaseDescriptor.java |
Adds getter/setter for the new digest type config. |
src/java/org/apache/cassandra/utils/ChecksumType.java |
Adds CRC32C/CRC64NVME checksum types and AWS CRT presence detection. |
src/java/org/apache/cassandra/utils/PureJavaCRC64NVME.java |
Introduces a pure-Java CRC64-NVMe implementation. |
src/java/org/apache/cassandra/io/sstable/format/SortedTableWriter.java |
Selects digest file component + checksum type based on config when constructing data writers. |
src/java/org/apache/cassandra/io/sstable/format/big/BigTableWriter.java |
Updates the Big format writer’s component set for digest component handling. |
src/java/org/apache/cassandra/io/sstable/Component.java |
Adds new digest component types for CRC32C and CRC64NVME. |
src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java |
Adds digest-validator discovery across digest variants. |
src/java/org/apache/cassandra/io/util/DataIntegrityMetadata.java |
Generalizes digest validation to accept digest file + checksum type. |
src/java/org/apache/cassandra/io/util/ChecksumWriter.java |
Generalizes full-file checksum computation to use the selected checksum type. |
src/java/org/apache/cassandra/io/util/ChecksummedSequentialWriter.java |
Threads configured checksum type into digest writing for uncompressed data files. |
src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java |
Threads configured checksum type into digest writing for compressed data files. |
src/java/org/apache/cassandra/io/compress/EncryptedSequentialWriter.java |
Updates ChecksumWriter construction with explicit checksum type. |
src/java/org/apache/cassandra/db/compaction/Verifier.java |
Switches verification to use the digest-validator discovered from available digest component. |
src/java/org/apache/cassandra/db/streaming/ComponentManifest.java |
Includes new digest variants in the set of streamable components (filtered by existence). |
src/java/org/apache/cassandra/io/sstable/format/big/BigFormat.java |
Adds new digest variants to supported/streaming component sets. |
src/java/org/apache/cassandra/io/sstable/format/trieindex/TrieIndexFormat.java |
Adds new digest variants to supported/streaming component sets for BTI format. |
test/unit/org/apache/cassandra/utils/PureJavaCRC64NVMETest.java |
Adds unit tests for the pure-Java CRC64NVME implementation. |
test/unit/org/apache/cassandra/db/VerifyTest.java |
Adds verification tests for CRC32C/CRC64NVME digest files. |
test/distributed/org/apache/cassandra/distributed/test/SSTableDigestTest.java |
Adds distributed test coverage for digest component selection by config. |
test/microbench/org/apache/cassandra/test/microbench/ChecksumBench.java |
Adds JMH benchmarks for CRC32C/CRC64NVME and MD5. |
test/unit/org/apache/cassandra/io/util/ChecksummedSequentialWriterTest.java |
Updates tests for the new ChecksummedSequentialWriter constructor signature. |
test/unit/org/apache/cassandra/io/util/ChecksummedRandomAccessReaderTest.java |
Updates tests for the new ChecksummedSequentialWriter constructor signature. |
test/unit/org/apache/cassandra/io/sstable/ComponentTest.java |
Adds parsing test coverage for new digest component representations. |
test/unit/org/apache/cassandra/db/ScrubTest.java |
Updates scrub test to use maybeGetDigestValidator(). |
src/java/org/apache/cassandra/cache/AutoSavingCache.java |
Updates cache writer creation for new ChecksummedSequentialWriter constructor. |
build.xml |
Adds optional/provided dependency on AWS CRT (aws-crt) for CRC64NVME. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @Override | ||
| public Checksum newInstance() | ||
| { | ||
| if (HAS_AWS_CRT_CRC64NVME) | ||
| return new CRC64NVME(); | ||
| return new PureJavaCRC64NVME(); | ||
| } |
There was a problem hiding this comment.
If software.amazon.awssdk.crt.checksums.CRC64NVME is found but new CRC64NVME() fails, it's probably better to let it crash than fallback...
❌ Build ds-cassandra-pr-gate/PR-2434 rejected by Butler5 regressions found Found 5 new test failures
Found 9 known test failures |



What is the issue
https://github.com/riptano/cndb/issues/17829
What does this PR fix and why was it fixed
This PR adds the possibility to configure the type of checksum written together with SSTables.
The config property
sstable_digest_typecan be set toCRC32,CRC32CandCRC64NVME(defaultCRC32). Respectively, aDigest.crc,Digest.crc32corDigest.crc64nvmefile will be written when an SSTable is committed to disk.PR in CNDB: https://github.com/riptano/cndb/pull/17907