{"record":{"id":"45d7ee921cf06b72","repo":"apache/cassandra","slug":"segmented-checksum-validation-failed-for-index-com","errorCode":null,"errorMessage":"Segmented checksum validation failed for index component {} on SSTable {}","messagePattern":"Segmented checksum validation failed for index component (.+?) on SSTable (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/index/sai/disk/v1/V1OnDiskFormat.java","lineNumber":316,"sourceCode":"\n                if (frameEnd > fileLength || frameEnd < frameStart)\n                    throw new CorruptIndexException(String.format(\"Segment frame [%d, %d) is inconsistent with component file length %d\",\n                                                                  frameStart, frameEnd, fileLength),\n                                                    indexComponent.name + '@' + frameStart);\n\n                IndexInput slice = input.slice(indexComponent.name + '@' + frameStart, frameStart, frameEnd - frameStart);\n                SAICodecUtils.validateChecksum(slice);\n                frameStart = frameEnd;\n            }\n\n            if (frameStart != fileLength)\n                throw new CorruptIndexException(String.format(\"Component file length %d does not match combined frame length of all segments %d\",\n                                                              fileLength, frameStart),\n                                                indexComponent.name);\n        }\n        catch (Exception e)\n        {\n            logger.warn(indexDescriptor.logMessage(\"Segmented checksum validation failed for index component {} on SSTable {}\"),\n                        indexComponent, indexDescriptor.sstableDescriptor);\n            rethrowIOException(e);\n        }\n    }\n\n    private static void validateIndexComponent(IndexDescriptor indexDescriptor,\n                                               IndexIdentifier indexContext,\n                                               IndexComponent indexComponent,\n                                               boolean checksum)\n    {\n        try (IndexInput input = indexContext == null\n                                ? indexDescriptor.openPerSSTableInput(indexComponent)\n                                : indexDescriptor.openPerIndexInput(indexComponent, indexContext))\n        {\n            if (checksum)\n                SAICodecUtils.validateChecksum(input);\n            else\n                SAICodecUtils.validate(input);","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sai/disk/v1/V1OnDiskFormat.java#L298-L334","documentation":"V1OnDiskFormat.validateSegmentedIndexComponent verifies a SAI on-disk index component by checking each segmented frame's checksum and that the file length matches the combined frame lengths. On any exception (including CorruptIndexException from a checksum or length mismatch) it logs this warning and rethrows as IOException. The failure means the component file on disk is corrupted, truncated, or written by an incompatible format version.","triggerScenarios":"A checksum of a segmented component (e.g. trie, BKD tree, or postings file) does not match the stored checksum; file length differs from the combined frame length (truncated file); the component was written by a crashed node mid-flush; disk/bit-rot corruption.","commonSituations":"Node crash or power loss during SAI flush leaving a partial component; restoring SSTable files from an incomplete backup; filesystem corruption on the data volume; copying SSTables between nodes/versions with mismatched SAI format.","solutions":["Identify the affected component and SSTable from the log line, then run `nodetool verify` / scrub to confirm corruption extent.","Rebuild the affected SAI index: DROP INDEX and CREATE INDEX (or `nodetool scsirebuild`) so components are regenerated from live data.","If corruption is from a restore, re-copy the complete SSTable set including all SAI component files (do not partially restore index components).","Check disk health (fsck, SMART) if corruption recurs; a failing disk is a common root cause."],"exampleFix":"// before: partially restored SSTable dir missing checksumed index components\n/var/lib/cassandra/data/ks/tbl-abc/: Data.db, Index.db  # missing SAI .db components\n// after: restore all components then rebuild\n# copy ALL files for the descriptor, then:\n# cqlsh> DROP INDEX ks.idx; CREATE INDEX idx ON ks.tbl(col);\n# or: nodetool scsirebuild","handlingStrategy":"try-catch","validationCode":"// proactively validate components after a restore\nIndexDescriptor.validateComponentChecks(...) // or run `nodetool verify` on the node","typeGuard":null,"tryCatchPattern":"// callers of openIndex see IOException from rethrowIOException\ntry { format.openPerColumnIndexReaders(descriptor); }\ncatch (IOException e) {\n    logger.error(\"SAI component corrupt; scheduling index rebuild\", e);\n    rebuildIndex(descriptor);\n}","preventionTips":["Always restore complete SSTable sets including all SAI component files.","Run `nodetool verify` after node crashes, restores, or disk incidents.","Monitor disk health; recurring checksum failures usually mean failing hardware.","Never copy SSTable components between nodes or Cassandra versions with mismatched SAI formats."],"tags":["corruption","checksum","index","sstable"],"backgroundTag":"checksum-mismatch","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}