{"record":{"id":"a777153f54a00ddc","repo":"apache/cassandra","slug":"interrupted-while-building-indexes-on-sstable","errorCode":null,"errorMessage":"Interrupted while building indexes on SSTable {}","messagePattern":"Interrupted while building indexes on SSTable (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/java/org/apache/cassandra/index/accord/RouteSecondaryIndexBuilder.java","lineNumber":185,"sourceCode":"                    bytesProcessed += bytesRead - previousBytesRead;\n                    previousBytesRead = bytesRead;\n                }\n\n                completeSSTable(indexDescriptor, indexWriter, sstable);\n            }\n\n            return false;\n        }\n        catch (Throwable t)\n        {\n            if (indexWriter != null)\n            {\n                indexWriter.abort(t, true);\n            }\n\n            if (t instanceof InterruptedException)\n            {\n                logger.warn(\"Interrupted while building indexes on SSTable {}\", sstable.descriptor);\n                Thread.currentThread().interrupt();\n                return true;\n            }\n            else if (t instanceof CompactionInterruptedException)\n            {\n                //TODO Shouldn't do this if the stop was interrupted by a truncate\n                if (isInitialBuild)\n                {\n                    logger.error(\"Stop requested while building initial indexes on SSTable {}.\", sstable.descriptor);\n                    throw Throwables.unchecked(t);\n                }\n                else\n                {\n                    logger.info(\"Stop requested while building indexes on SSTable {}.\", sstable.descriptor);\n                    return true;\n                }\n            }\n            else","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/accord/RouteSecondaryIndexBuilder.java#L167-L203","documentation":"During compaction-driven secondary index building on Accord/transactional data (RouteSecondaryIndexBuilder), if index building on an SSTable is aborted with an InterruptedException, the builder logs this warning, restores the interrupt flag, and reports the SSTable as handled so the build can stop cleanly. Indexes are rebuilt later from remaining SSTables.","triggerScenarios":"Index build interrupted while iterating an SSTable: nodetool stop with cancellation, node shutdown, compaction stop, or truncate/drop aborting the index writer mid-build.","commonSituations":"Administrator cancels an index build or stops compaction; node shutdown while a new index was being back-filled over existing SSTables.","solutions":["No action needed if the interruption was intentional (shutdown/stop) — the index build resumes/restarts on next startup or repair.","If unexpected, check what issued the interrupt: recent nodetool operations (stop, drain), truncate, or table drop on the indexed table.","After a cancelled build, verify index health via nodetool tablestats / SSTable-backed index query validation, or rebuild the index explicitly (ALTER TABLE ... DROP/ADD index)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Operator-level: treat interrupted index build as retryable\n// verify index is queryable / complete after restart, else rebuild:\n// ALTER TABLE ks.tbl DROP INDEX idx; CREATE CUSTOM INDEX idx ON ks.tbl (col) USING 'StorageAttachedIndex';","preventionTips":["Avoid stopping the node or cancelling compactions during CREATE INDEX back-fill on large tables.","Add new indexes during low-traffic windows so builds complete without interruption.","Monitor build progress via system_views and logs before issuing shutdowns.","After an interrupted build, verify index completeness before relying on index queries."],"tags":["cassandra","secondary-index","interrupt","sstable"],"backgroundTag":"thread-interrupted","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"}