apache/cassandra · warning

Data file partition position

Error message

Data file partition position %d differs from index file row position %d

What it means

While scrubbing, the partition's actual start position in the -Data.db file is compared with the position recorded in the -Index.db. A mismatch means the index is stale or the data file was modified; the scrubber logs a warning and continues using the data-file-derived position.

Solutions

  1. Let the scrub complete; the warning is informational and the scrubber uses the data-file position
  2. Run `nodetool repair` after scrubbing to re-sync with healthy replicas
  3. Replace the sstable from a healthy replica via repair/rebuild
  4. Check disk/filesystem health (SMART, fsck) before re-adding the node

Example fix

// before: scrub warns on position mismatch
// after: verify component consistency before scrub
File data = sstable.descriptor.fileFor(Components.DATA);
File index = sstable.descriptor.fileFor(Components.PRIMARY_INDEX);
if (data.lastModified() != index.lastModified())
    logger.warn("{} data/index timestamps differ; restore consistent copies before scrub", sstable);
Defensive patterns

Strategy: validation

Validate before calling

long dataLen = sstable.descriptor.fileFor(Components.DATA).length();
long idxLen = sstable.descriptor.fileFor(Components.PRIMARY_INDEX).length();
if (idxLen == 0 || dataLen == 0)
    logger.warn("Empty data or index component; scrub will report position mismatches");

Prevention

When it happens

Trigger: scrubInternal reads a partition whose dataStart differs from dataStartFromIndex — typically when the data file was truncated, partially rewritten, or the index belongs to a different/older version of the sstable.

Common situations: Interrupted writes leaving data/index inconsistency, sstable files restored from mismatched backups, corrupted or truncated -Data.db after a disk failure.

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/4d65ed6a7bfa84ee. Report an issue: GitHub.

Appendix: source

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

            assert currentIndexKey != null || !indexAvailable();

            try
            {
                if (key == null)
                    throw new IOError(new IOException("Unable to read partition key from data file"));

                if (currentIndexKey != null && !key.getKey().equals(currentIndexKey))
                {
                    throw new IOError(new IOException(String.format("Key from data file (%s) does not match key from index file (%s)",
                                                                    //ByteBufferUtil.bytesToHex(key.getKey()), ByteBufferUtil.bytesToHex(currentIndexKey))));
                                                                    "_too big_", ByteBufferUtil.bytesToHex(currentIndexKey))));
                }

                if (indexFile != null && dataSizeFromIndex > dataFile.length())
                    throw new IOError(new IOException("Impossible partition size (greater than file length): " + dataSizeFromIndex));

                if (indexFile != null && dataStart != dataStartFromIndex)
                    outputHandler.warn("Data file partition position %d differs from index file row position %d", dataStart, dataStartFromIndex);

                if (tryAppend(prevKey, key, writer))
                    prevKey = key;
            }
            catch (Throwable th)
            {
                throwIfFatal(th);
                outputHandler.warn(th, "Error reading partition %s (stacktrace follows):", keyName);

                if (currentIndexKey != null
                    && (key == null || !key.getKey().equals(currentIndexKey) || dataStart != dataStartFromIndex))
                {

                    outputHandler.output("Retrying from partition index; data is %s bytes starting at %s",
                                         dataSizeFromIndex, dataStartFromIndex);
                    key = sstable.decorateKey(currentIndexKey);
                    try
                    {

View on GitHub (pinned to 88fd0f6a0e)