{"record":{"id":"86b6fa1dd00e313f","repo":"apache/cassandra","slug":"prepare-phase-for-incremental-repair-session-s-wa","errorCode":null,"errorMessage":"Prepare phase for incremental repair session %s was unable to acquire exclusive access to the neccesary sstables. This is usually caused by running multiple incremental repairs on nodes that share token ranges","messagePattern":"Prepare phase for incremental repair session (.+?) was unable to acquire exclusive access to the neccesary sstables\\. This is usually caused by running multiple incremental repairs on nodes that share token ranges","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/repair/PendingAntiCompaction.java","lineNumber":313,"sourceCode":"\n        public Future<List<Void>> apply(List<AcquireResult> results)\n        {\n            if (Iterables.any(results, AcquisitionCallback::shouldAbort))\n            {\n                // Release all sstables, and report failure back to coordinator\n                for (AcquireResult result : results)\n                {\n                    if (result != null)\n                    {\n                        logger.info(\"Releasing acquired sstables for {}.{}\", result.cfs.metadata.keyspace, result.cfs.metadata.name);\n                        result.abort();\n                    }\n                }\n                String message = String.format(\"Prepare phase for incremental repair session %s was unable to \" +\n                                               \"acquire exclusive access to the neccesary sstables. \" +\n                                               \"This is usually caused by running multiple incremental repairs on nodes that share token ranges\",\n                                               parentRepairSession);\n                logger.warn(message);\n                return ImmediateFuture.failure(new SSTableAcquisitionException(message));\n            }\n            else\n            {\n                List<Future<Void>> pendingAntiCompactions = new ArrayList<>(results.size());\n                for (AcquireResult result : results)\n                {\n                    if (result.txn != null)\n                    {\n                        Future<Void> future = submitPendingAntiCompaction(result);\n                        pendingAntiCompactions.add(future);\n                    }\n                }\n\n                return FutureCombiner.allOf(pendingAntiCompactions);\n            }\n        }\n    }","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/repair/PendingAntiCompaction.java#L295-L331","documentation":"During the prepare phase of an incremental repair, PendingAntiCompaction must acquire exclusive access to the sstables being repaired so their contents cannot change mid-repair. If acquisition fails for any of the requested ranges after retries, it logs a warning and fails the prepare step with SSTableAcquisitionException, which aborts the repair session.","triggerScenarios":"apply() runs acquisition tasks for each range; any AcquireResult is a failure, most commonly because another incremental repair already holds exclusive access to the same sstables via anti-compaction.","commonSituations":"Running two incremental repairs in parallel that cover overlapping token ranges on the same node; a previous repair session that did not fully clean up; scripted repair automation kicking off repairs while a prior one is still running.","solutions":["Stop overlapping repair sessions (nodetool repair_admin cancel / list) and ensure only one incremental repair touches a shared range at a time","Serialize repairs that share token ranges, or partition them so ranges do not overlap per node","Retry the repair once the competing session has finished and sstables are released","Check for stale/leaked repair sessions after node restarts and clear them before restarting repairs"],"exampleFix":"// before: concurrent overlapping repairs\nnodetool repair -inc keyspace1 &\nnodetool repair -inc keyspace1 &\n// after: serialized repairs\nnodetool repair -inc keyspace1 && nodetool repair -inc keyspace2","handlingStrategy":"retry","validationCode":"// check for active repair sessions before starting another\n// nodetool repair_admin list  -> must be empty\n// verify no overlapping ranges: confirm token range partitioning of concurrent repairs","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Serialize repair sessions; never run two incremental repairs over the same range on a node","Use repair_admin tooling to detect and clean stale sessions","Automate repairs via a scheduler that enforces single-session-per-range","After node restarts, verify no leaked sessions remain before repairing"],"tags":["repair","incremental-repair","compaction","concurrency"],"backgroundTag":"repair-sstable-acquisition-timeout","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}