CASSANDRA-20012: Add blob type support to SAI (6.0) - #4991
Open
tmoschou wants to merge 3 commits into
Open
Conversation
Add support for the blob CQL type in Storage Attached Index (SAI) as an equality-only (EQ) indexed literal type.
Fix regressions introduced by the cassandra-5.0 -> cassandra-6.0 rebase and address review feedback: * Restore IndexTermType.isEqOnlyType(AbstractType), which the rebase silently dropped. The method is unused in 5.0 but is still called by 6.0 test infrastructure (CreateIndexDDL, SingleNodeSAITestBase), so its removal broke the build. * Fix the sort order of the sai_blob_term_size_* rows in the GuardrailsConfigCommandsTest verbose expected output. * Restore the two trailing blank lines at the end of CHANGES.txt that were accidentally deleted. * Place the CHANGES.txt entry in the middle of the 6.0-alpha2 section rather than the top, which is the most merge-conflict-prone position. * SAI FAQ: note that BLOB support is new in Cassandra 6.0 (was 5.0.7). * Revert the accidental end-of-file newline change in sai-faq.adoc. Assisted-by: Claude:claude-opus-4-8
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
CASSANDRA-20012
Users frequently store fixed-size binary identifiers in blob columns (e.g. SHA-256 hashes, proprietary binary formats) and choose blobs over string representations to reduce disk space. Previously, creating a SAI index on a blob column was rejected with
Unsupported type: blob, forcing workarounds like Base64 encoding.Blob support was originally excluded due to concerns about indexing arbitrarily large blobs (e.g. serialized objects, pagination cursors, or media payloads that could be many kilobytes). This patch introduces a dedicated
sai_blob_term_size_warn_threshold(default 1KiB) /sai_blob_term_size_fail_threshold(default 8KiB) guardrail, following the existing pattern ofsai_string_term_size_*,sai_frozen_term_size_*, andsai_vector_term_size_*. This allows operators to configure blob term size limits independently.Summary
Add support for the
blobCQL type in Storage Attached Index (SAI) as an equality-only (EQ) indexed literal type.Before
After
CQL3Type.Native.BLOBtoStorageAttachedIndex.SUPPORTED_TYPESBytesTypetoEQ_ONLY_TYPESinIndexTermTypeand introduce a newBYTEScapability so blob columns are classified as literal (trie-indexed) typessai_blob_term_size_warn_threshold/sai_blob_term_size_fail_thresholdguardrails (defaults: 1KiB / 8KiB)BlobDataSetand parameterized CQL-level tests for the blob type, both standalone and within all collection variants (list, set, map keys/values/entries, frozen collections)GuardrailSaiBlobTermSizeTestfor the new guardrailsai-concepts.adoc,sai-faq.adoc) andcassandra.yaml/cass_yaml_file.adocto reflect blob supportPerformance
Each new parameterized test class adds ~7 seconds of runtime. With 11 new blob test classes, this adds roughly 75–80 seconds to the SAI type test suite. This follows the existing pattern used by all other SAI type tests (e.g.
BooleanTest,InetTest, etc.).Test plan
BlobTest,ListBlobTest,FrozenListBlobTest,SetBlobTest,FrozenSetBlobTest,MapBlobTest,FrozenMapBlobTest,MapKeysBlobTest,MapValuesBlobTest,MapEntriesBlobTest,MultiMapBlobTestIndexTermTypeTestto assert blob is a literal typeNotes
This is a rebase of #4685 to target
cassandra-6.0instead.