apache/cassandra · error

An error occurred while scrubbing the partition with key '%s

Error message

An error occurred while scrubbing the partition with key '%s' for an index table. Scrubbing will abort for this table and the index will be rebuilt.

What it means

When scrubbing an SAI/index-backed table, if a partition belonging to the index's base table fails to scrub and the SSTable is an index table, BigTableScrubber warns and aborts the scrub for that table (throws IOError). The rationale is that a corrupt index table should not be 'repaired' by skipping — dropping and rebuilding the index regenerates it correctly from base data.

Source

Thrown at src/java/org/apache/cassandra/io/sstable/format/big/BigTableScrubber.java:271

            catch (Throwable th)
            {
                throwIfFatal(th);
                outputHandler.warn(th, "Failed to seek to next partition position %d", nextPartitionPositionFromIndex);
                badPartitions++;
            }

            updateIndexKey();
        }

        return false;
    }

    @Override
    protected void throwIfCannotContinue(DecoratedKey key, Throwable th)
    {
        if (isIndex)
        {
            outputHandler.warn("An error occurred while scrubbing the partition with key '%s' for an index table. " +
                               "Scrubbing will abort for this table and the index will be rebuilt.", keyString(key));
            throw new IOError(th);
        }

        super.throwIfCannotContinue(key, th);
    }

    @Override
    public void close()
    {
        fileAccessLock.writeLock().lock();
        try
        {
            FileUtils.closeQuietly(dataFile);
            FileUtils.closeQuietly(indexFile);
        }
        finally
        {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Let the abort stand (correct behavior), then rebuild the index: ALTER TABLE ... DROP INDEX and re-CREATE the SAI index, or drop/re-add the index column index.
  2. Scrub the base table separately; index tables are rebuilt from base data so base-table scrubbing should succeed.
  3. Investigate the corruption source (disk, filesystem, version-specific bugs) before re-running the scrub.

Example fix

// before: scrub aborts on corrupt index SSTable
nodetool scrub <keyspace> <table_with_sai>
// after: drop and rebuild the index to regenerate index SSTables
ALTER TABLE ks.tbl DROP INDEX tbl_idx;
CREATE CUSTOM INDEX tbl_idx ON ks.tbl (col) USING 'StorageAttachedIndex';
Defensive patterns

Strategy: fallback

Validate before calling

# Before scrubbing SAI-backed tables, verify index and base SSTables
nodetool verify <keyspace> <table_with_sai>
nodetool snapshot <keyspace> --table <table_with_sai>  # snapshot first

Try / catch

// CLI-level: scrub aborts (IOError) on corrupt index SSTable — expected.
// Fallback: DROP INDEX, scrub base table, re-CREATE index to regenerate index SSTables cleanly
// ALTER TABLE ks.tbl DROP INDEX idx;
// nodetool scrub ks tbl;
// CREATE CUSTOM INDEX idx ON ks.tbl (col) USING 'StorageAttachedIndex';

Prevention

When it happens

Trigger: nodetool scrub on a table with SAI (storage-attached) indexes when a corrupt partition is found in the underlying index SSTable.

Common situations: Disk corruption or torn writes affecting index SSTables; scrubbing after unclean shutdown on tables with SAI indexes.

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/1ef2f91b8581bb6a. Report an issue: GitHub.