{"record":{"id":"da68393c59f1026e","repo":"apache/cassandra","slug":"sstables-import-has-been-aborted","errorCode":null,"errorMessage":"SSTables import has been aborted","messagePattern":"SSTables import has been aborted","errorType":"exception","errorClass":"InterruptedException","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/db/SSTableImporter.java","lineNumber":256,"sourceCode":"        catch (Throwable t)\n        {\n            logger.error(\"[{}] Failed adding SSTables\", importID, t);\n            throw new RuntimeException(\"Failed adding SSTables\", t);\n        }\n\n        logger.info(\"[{}] Done loading load new SSTables for {}/{}\", importID, cfs.getKeyspaceName(), cfs.getTableName());\n        return failedDirectories;\n    }\n\n    /**\n     * Check the state of this node and throws an {@link InterruptedException} if it is currently draining\n     *\n     * @throws InterruptedException if the node is draining\n     */\n    private static void abortIfDraining() throws InterruptedException\n    {\n        if (StorageService.instance.isDraining())\n            throw new InterruptedException(\"SSTables import has been aborted\");\n    }\n\n    private void logLeveling(UUID importID, Set<SSTableReader> newSSTables)\n    {\n        StringBuilder sb = new StringBuilder();\n        for (SSTableReader sstable : cfs.getSSTables(SSTableSet.CANONICAL))\n            sb.append(formatMetadata(sstable));\n        logger.debug(\"[{}] Current sstables: {}\", importID, sb);\n        sb = new StringBuilder();\n        for (SSTableReader sstable : newSSTables)\n            sb.append(formatMetadata(sstable));\n        logger.debug(\"[{}] New sstables: {}\", importID, sb);\n    }\n\n    private static String formatMetadata(SSTableReader sstable)\n    {\n        return String.format(\"{[%s, %s], %d, %s, %d}\",\n                             sstable.getFirst().getToken(),","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/SSTableImporter.java#L238-L274","documentation":"abortIfDraining checks StorageService.instance.isDraining() before each phase of an SSTable import and throws InterruptedException 'SSTables import has been aborted' to stop the import if the node has started draining (e.g., shutdown, decommission, nodetool drain). It is a deliberate cooperative-abort mechanism, not a fault.","triggerScenarios":"A long-running `nodetool import` is in progress and the node begins draining (nodetool drain/decommission/stop); the next abortIfDraining() call inside importNewSSTables throws InterruptedException.","commonSituations":"Automated shutdown/decommission scripts racing with a manual SSTable import; operators starting an import right before a rolling restart; kubernetes/prestop hooks draining the node.","solutions":["Nothing is broken: rerun the import after the node restarts and is fully up (UT are safe; already-imported SSTables are ignored on retry)","Schedule imports outside maintenance windows and check `nodetool status`/drain state before starting","Ensure decommission/drain automation does not overlap with data-staging jobs that run nodetool import"],"exampleFix":"// before: import racing with drain\nnodetool import -- ks table /data/import &; nodetool drain\n// after: drain first, then import after restart\nnodetool drain && (restart) && nodetool status && nodetool import -- ks table /data/import","handlingStrategy":"try-catch","validationCode":"// check node state before starting an import\nif (storageService.isDraining() || storageService.isStartingMode()) {\n    throw new IllegalStateException(\"cannot import while node is draining/bootstrapping\");\n}","typeGuard":null,"tryCatchPattern":"try (InterruptedException ignored = runImport()) {\n    // 'SSTables import has been aborted' is expected if the node drained mid-import\n} catch (InterruptedException e) {\n    logger.info(\"Import aborted by drain/shutdown; will re-run after restart\");\n}","preventionTips":["Check node status (nodetool status / drain state) before launching imports","Coordinate import jobs with maintenance and drain/decommission automation","Make imports idempotent so reruns after an abort are safe (they are by design)","Avoid starting imports near scheduled restarts or k8s preStop windows"],"tags":["sstable","import","drain","shutdown","interrupt"],"backgroundTag":"operation-aborted","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"}