{"record":{"id":"bff61bab4d9d0ca6","repo":"apache/cassandra","slug":"session-failed-acquiring-sstables-retrying","errorCode":null,"errorMessage":"Session {} failed acquiring sstables: {}, retrying every {}ms for another {}s","messagePattern":"Session (.+?) failed acquiring sstables: (.+?), retrying every (.+?)ms for another (.+?)s","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/db/repair/PendingAntiCompaction.java","lineNumber":243,"sourceCode":"            // try to modify after cancelling running compactions. This will attempt to cancel in flight compactions including the given sstables for\n            // up to a minute, after which point, null will be returned\n            long start = currentTimeMillis();\n            long delay = TimeUnit.SECONDS.toMillis(acquireRetrySeconds);\n            // Note that it is `predicate` throwing SSTableAcquisitionException if it finds a conflicting sstable\n            // and we only retry when runWithCompactionsDisabled throws when uses the predicate, not when acquireTuple is.\n            // This avoids the case when we have an sstable [0, 100] and a user starts a repair on [0, 50] and then [51, 100] before\n            // anticompaction has finished but not when the second repair is [25, 75] for example - then we will fail it without retry.\n            do\n            {\n                try\n                {\n                    // Note that anticompactions are not disabled when running this. This is safe since runWithCompactionsDisabled\n                    // is synchronized - acquireTuple and predicate can only be run by a single thread (for the given cfs).\n                    return acquireSSTables();\n                }\n                catch (SSTableAcquisitionException e)\n                {\n                    logger.warn(\"Session {} failed acquiring sstables: {}, retrying every {}ms for another {}s\",\n                                sessionID,\n                                e.getMessage(),\n                                acquireSleepMillis,\n                                TimeUnit.SECONDS.convert(delay + start - currentTimeMillis(), TimeUnit.MILLISECONDS));\n                    Uninterruptibles.sleepUninterruptibly(acquireSleepMillis, TimeUnit.MILLISECONDS);\n\n                    if (currentTimeMillis() - start > delay)\n                        logger.warn(\"{} Timed out waiting to acquire sstables\", sessionID, e);\n\n                }\n                catch (Throwable t)\n                {\n                    logger.error(\"Got exception disabling compactions for session {}\", sessionID, t);\n                    throw t;\n                }\n            } while (currentTimeMillis() - start < delay);\n            return null;\n        }","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/repair/PendingAntiCompaction.java#L225-L261","documentation":"PendingAntiCompaction's background task attempts to acquire sstables for each repair session. When an attempt fails with SSTableAcquisitionException, it logs which session failed, the reason, the retry interval (acquireSleepMillis), and the remaining wait time, then sleeps and retries until the repair deadline expires.","triggerScenarios":"Repeated inability to mark sstables compacting during repair because compaction or competing repair sessions keep holding them; occurs on each retry iteration until either acquisition succeeds or the anticompaction task's time budget (delay) is exhausted.","commonSituations":"Long-running compactions overlapping a repair; nodes with many pending compactions; incremental repair on hot tables; repair timeouts ultimately surfacing as repair failures if retries run out.","solutions":["Let compactions finish or stop them temporarily (nodetool stop compaction / disable) during the repair window","Reduce compaction pressure (compaction_throughput, pending compactions) before running repair","Increase the repair/anticompaction time budget so retries have room to succeed","Retry the repair when the node is quieter; check the logged reason for the specific sstables involved"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure enough time budget for anticompaction retries\nif (deadline - System.currentTimeMillis() < minAcquireWindowMs)\n    throw new IllegalStateException(\"Insufficient anticompaction time budget\");","typeGuard":null,"tryCatchPattern":"try { repairFuture.get(); } catch (ExecutionException e) { logger.warn(\"Acquire retries exhausted: {}\", e.getCause()); scheduleRepairRetry(); }","preventionTips":["Reduce compaction backlog before repairs","Increase repair/anticompaction budgets on large tables","Schedule repairs in low-traffic windows","Read the logged remaining-seconds to size retry expectations"],"tags":["repair","compaction","retry"],"backgroundTag":"request-timeout","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"}