apache/cassandra · error

Segmented checksum validation failed for index component {}

Error message

Segmented checksum validation failed for index component {} on SSTable {}

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/index/sai/disk/v1/V1OnDiskFormat.java:316

                if (frameEnd > fileLength || frameEnd < frameStart)
                    throw new CorruptIndexException(String.format("Segment frame [%d, %d) is inconsistent with component file length %d",
                                                                  frameStart, frameEnd, fileLength),
                                                    indexComponent.name + '@' + frameStart);

                IndexInput slice = input.slice(indexComponent.name + '@' + frameStart, frameStart, frameEnd - frameStart);
                SAICodecUtils.validateChecksum(slice);
                frameStart = frameEnd;
            }

            if (frameStart != fileLength)
                throw new CorruptIndexException(String.format("Component file length %d does not match combined frame length of all segments %d",
                                                              fileLength, frameStart),
                                                indexComponent.name);
        }
        catch (Exception e)
        {
            logger.warn(indexDescriptor.logMessage("Segmented checksum validation failed for index component {} on SSTable {}"),
                        indexComponent, indexDescriptor.sstableDescriptor);
            rethrowIOException(e);
        }
    }

    private static void validateIndexComponent(IndexDescriptor indexDescriptor,
                                               IndexIdentifier indexContext,
                                               IndexComponent indexComponent,
                                               boolean checksum)
    {
        try (IndexInput input = indexContext == null
                                ? indexDescriptor.openPerSSTableInput(indexComponent)
                                : indexDescriptor.openPerIndexInput(indexComponent, indexContext))
        {
            if (checksum)
                SAICodecUtils.validateChecksum(input);
            else
                SAICodecUtils.validate(input);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Identify the affected component and SSTable from the log line, then run `nodetool verify` / scrub to confirm corruption extent.
  2. Rebuild the affected SAI index: DROP INDEX and CREATE INDEX (or `nodetool scsirebuild`) so components are regenerated from live data.
  3. If corruption is from a restore, re-copy the complete SSTable set including all SAI component files (do not partially restore index components).
  4. Check disk health (fsck, SMART) if corruption recurs; a failing disk is a common root cause.

Example fix

// before: partially restored SSTable dir missing checksumed index components
/var/lib/cassandra/data/ks/tbl-abc/: Data.db, Index.db  # missing SAI .db components
// after: restore all components then rebuild
# copy ALL files for the descriptor, then:
# cqlsh> DROP INDEX ks.idx; CREATE INDEX idx ON ks.tbl(col);
# or: nodetool scsirebuild
Defensive patterns

Strategy: try-catch

Validate before calling

// proactively validate components after a restore
IndexDescriptor.validateComponentChecks(...) // or run `nodetool verify` on the node

Try / catch

// callers of openIndex see IOException from rethrowIOException
try { format.openPerColumnIndexReaders(descriptor); }
catch (IOException e) {
    logger.error("SAI component corrupt; scheduling index rebuild", e);
    rebuildIndex(descriptor);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/45d7ee921cf06b72. Report an issue: GitHub.