apache/cassandra · warning

Out of order rows found in partition

Error message

Out of order rows found in partition: %s

What it means

During scrubbing, tryAppend inspects the sstable iterator's hasRowsOutOfOrder() flag; when rows within a partition were stored out of clustering order, it warns with the partition key and collects those rows to be written to a separate in-order sstable. It indicates on-disk row ordering violates the expected clustering order.

Solutions

  1. No immediate action: scrub relocates these rows into a properly ordered sstable (see the follow-up warning)
  2. Run nodetool repair to ensure replica consistency
  3. After scrub, consider compacting the repaired sstables so all data is in canonical order
  4. Upgrade Cassandra if this stems from a fixed historical sorting bug
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Scrubbing an sstable whose partition contains rows whose clustering values are not in sorted order — detected per-partition via sstableIterator.hasRowsOutOfOrder() in tryAppend.

Common situations: Legacy sstables written by versions with sorting bugs; partial corruption that shifted row boundaries; sstables migrated from non-Cassandra tooling.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/io/sstable/format/SortedTableScrubber.java:309

        // that one row is out of order, it will stop returning them. The remaining rows will be sorted and added
        // to the outOfOrder set that will be later written to a new SSTable.
        try (OrderCheckerIterator sstableIterator = new OrderCheckerIterator(getIterator(key), cfs.metadata().comparator);
             UnfilteredRowIterator iterator = withValidation(sstableIterator, dataFile.getPath()))
        {
            if (prevKey != null && prevKey.compareTo(key) > 0)
            {
                saveOutOfOrderPartition(prevKey, key, iterator);
                return false;
            }

            if (writer.tryAppend(iterator) == null)
                emptyPartitions++;
            else
                goodPartitions++;

            if (sstableIterator.hasRowsOutOfOrder())
            {
                outputHandler.warn("Out of order rows found in partition: %s", keyString(key));
                outOfOrder.add(sstableIterator.getRowsOutOfOrder());
            }
        }

        return true;
    }

    /**
     * Only wrap with {@link FixNegativeLocalDeletionTimeIterator} if {@link IScrubber.Options#reinsertOverflowedTTLRows} option
     * is specified
     */
    private UnfilteredRowIterator getIterator(DecoratedKey key)
    {
        RowMergingSSTableIterator rowMergingIterator = new RowMergingSSTableIterator(SSTableIdentityIterator.create(sstable,
                                                                                                                    dataFile,
                                                                                                                    key),
                                                                                     outputHandler,
                                                                                     sstable.descriptor.version,

View on GitHub (pinned to 88fd0f6a0e)