{"record":{"id":"7af819b44d361a02","repo":"apache/cassandra","slug":"failed-to-update-per-sstable-components-for-sstabl","errorCode":null,"errorMessage":"Failed to update per-SSTable components for SSTable {}","messagePattern":"Failed to update per-SSTable components for SSTable (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/index/sai/SSTableContextManager.java","lineNumber":94,"sourceCode":"                continue;\n            }\n\n            try\n            {\n                // Only validate on restart or newly refreshed SSTable. Newly built files are unlikely to be corrupted.\n                if (!sstableContexts.containsKey(sstable) && !indexDescriptor.validatePerSSTableComponents(validation, true, false))\n                {\n                    invalid.add(sstable);\n                    removeInvalidSSTableContext(sstable);\n                    continue;\n                }\n                // ConcurrentHashMap#computeIfAbsent guarantees atomicity, so {@link SSTableContext#create(SSTableReader)}}\n                // is called at most once per key.\n                contexts.add(sstableContexts.computeIfAbsent(sstable, SSTableContext::create));\n            }\n            catch (Throwable t)\n            {\n                logger.warn(indexDescriptor.logMessage(\"Failed to update per-SSTable components for SSTable {}\"), sstable.descriptor, t);\n                invalid.add(sstable);\n                removeInvalidSSTableContext(sstable);\n            }\n        }\n\n        return Pair.create(contexts, invalid);\n    }\n\n    public void release(Collection<SSTableReader> toRelease)\n    {\n        toRelease.stream().map(sstableContexts::remove).filter(Objects::nonNull).forEach(SSTableContext::close);\n    }\n\n    /**\n     * @return total number of per-sstable open files for live sstables\n     */\n    int openFiles()\n    {","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sai/SSTableContextManager.java#L76-L112","documentation":"SSTableContextManager.update obtains per-SSTable SAI components (index descriptors, per-column SSTable indexes) via a computeIfAbsent that creates an SSTableContext. If context creation/loading throws, the exception is logged at WARN (with the SAI index descriptor prefix) and the SSTable is added to the `invalid` set and its cached context removed, so queries avoid that SSTable instead of failing.","triggerScenarios":"Opening SAI index components for an SSTable whose segment files are corrupted, were written by an incompatible SAI version, or are missing — raised from SSTableContext.create inside update().","commonSituations":"Upgrading/downgrading between Cassandra versions with changed SAI on-disk format; disk corruption; partial flush/interrupted compaction leaving incomplete SAI components; manually copied SSTables without their .sc component files.","solutions":["Read the attached exception `t` in the log to identify the exact failure (missing file vs format mismatch).","Run `nodetool scrub <keyspace> <table>` or rebuild the affected SSTable's index via nodetool rebuild_index.","If format mismatch after upgrade, run a full index rebuild so SAI components are rewritten in the current format.","Replace the damaged SSTable by running repair to re-replicate its data."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { sstableContextManager.update(sstables); } catch (Throwable t) { logger.warn(\"SSTable context failed; excluding SSTable from SAI queries\", t); }","preventionTips":["Avoid manual copying of SSTables without their SAI .sc components.","Perform full SAI index rebuilds after major version upgrades.","Monitor disk health; SAI component corruption disables index segments.","Use nodetool scrub on suspect SSTables before reopening them."],"tags":["sai","sstable","index-components","corruption"],"backgroundTag":"file-read-failed","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"}