{"record":{"id":"fcebee558e84a26f","repo":"apache/cassandra","slug":"d-out-of-order-partition-or-partitions-without-o","errorCode":null,"errorMessage":"%d out of order partition (or partitions without of order rows) found while scrubbing %s; Those have been written (in order) to a new sstable (%s)","messagePattern":"(.+?) out of order partition \\(or partitions without of order rows\\) found while scrubbing (.+?); Those have been written \\(in order\\) to a new sstable \\((.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/io/sstable/format/SortedTableScrubber.java","lineNumber":252,"sourceCode":"                outputHandler.output(\"Scrub of %s complete; looks like all %d partitions were tombstoned\", sstable, emptyPartitions);\n        }\n    }\n\n    private SSTableReader writeOutOfOrderPartitions(StatsMetadata metadata)\n    {\n        // out of order partitions/rows, but no bad partition found - we can keep our repairedAt time\n        long repairedAt = badPartitions > 0 ? ActiveRepairService.UNREPAIRED_SSTABLE : sstable.getSSTableMetadata().repairedAt;\n        SSTableReader newInOrderSstable;\n        try (SSTableWriter inOrderWriter = CompactionManager.createWriter(cfs, destination, expectedBloomFilterSize, repairedAt, metadata.pendingRepair, metadata.isTransient, sstable, transaction))\n        {\n            for (Partition partition : outOfOrder)\n                inOrderWriter.append(partition.unfilteredIterator());\n            inOrderWriter.setRepairedAt(-1);\n            inOrderWriter.setMaxDataAge(sstable.maxDataAge);\n            newInOrderSstable = inOrderWriter.finish(true);\n        }\n        transaction.update(newInOrderSstable, false);\n        outputHandler.warn(\"%d out of order partition (or partitions without of order rows) found while scrubbing %s; \" +\n                           \"Those have been written (in order) to a new sstable (%s)\", outOfOrder.size(), sstable, newInOrderSstable);\n        return newInOrderSstable;\n    }\n\n    protected abstract UnfilteredRowIterator withValidation(UnfilteredRowIterator iter, String filename);\n\n    @Override\n    @VisibleForTesting\n    public ScrubResult scrubWithResult()\n    {\n        scrub();\n        return new ScrubResult(goodPartitions, badPartitions, emptyPartitions);\n    }\n\n    @Override\n    public CompactionInfo.Holder getScrubInfo()\n    {\n        return scrubInfo;","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/format/SortedTableScrubber.java#L234-L270","documentation":"After scrubbing, writeOutOfOrderPartitions writes any partitions (or row groups) whose rows were out of order into a separate, correctly ordered sstable, then warns the operator with the count, source sstable, and destination sstable. This keeps data that could not legally live in the main scrubbed output without discarding it.","triggerScenarios":"nodetool scrub detects outOfOrder entries (populated via saveOutOfOrderPartition or rows-out-of-order detection) and calls writeOutOfOrderPartitions to serialize them into a new sstable during scrub.","commonSituations":"Corruption or old bugs that wrote partitions/rows in wrong comparator order; sstables written by a defective earlier version; manually edited or improperly copied sstables.","solutions":["No action strictly needed: the out-of-order data was preserved in the new sstable named in the message","Run nodetool repair to reconcile the node's data with other replicas","Check the Cassandra version history for known ordering bugs if this recurs on newly written sstables","Verify application writes are not bypassing the normal write path (no manual sstable injection)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Post-scrub hook:\nif (scrubReport.outOfOrderCount > 0) { scheduleRepair(); verifyNewSstablePresent(); }","preventionTips":["Keep Cassandra upgraded past known sstable-ordering bugs","Never hand-edit or partially copy sstable files","Run verify periodically to catch ordering corruption early","Run repair regularly to converge replicas"],"tags":["scrub","sstable","out-of-order","data-integrity"],"backgroundTag":"internal-invariant-violation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}