{"record":{"id":"1f3c770bef28b1c2","repo":"apache/cassandra","slug":"some-records-failed-verification-see-earlier-in-l","errorCode":null,"errorMessage":"Some records failed verification. See earlier in log for details.","messagePattern":"Some records failed verification\\. See earlier in log for details\\.","errorType":"exception","errorClass":"LogTransaction.CorruptTransactionLogException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/lifecycle/LogAwareFileLister.java","lineNumber":142,"sourceCode":"\n    /**\n     * We read txn log files, if we fail we throw only if the user has specified\n     * OnTxnErr.THROW, else we log an error and apply the txn log anyway\n     */\n    void classifyFiles(File txnFile)\n    {\n        try (LogFile txn = LogFile.make(txnFile))\n        {\n            readTxnLog(txn);\n            classifyFiles(txn);\n            files.put(txnFile, FileType.TXN_LOG);\n        }\n    }\n\n    void readTxnLog(LogFile txn)\n    {\n        if (!txn.verify() && onTxnErr == OnTxnErr.THROW)\n            throw new LogTransaction.CorruptTransactionLogException(\"Some records failed verification. See earlier in log for details.\", txn);\n    }\n\n    void classifyFiles(LogFile txnFile)\n    {\n        Map<LogRecord, Set<File>> oldFiles = txnFile.getFilesOfType(folder, files.navigableKeySet(), LogRecord.Type.REMOVE);\n        Map<LogRecord, Set<File>> newFiles = txnFile.getFilesOfType(folder, files.navigableKeySet(), LogRecord.Type.ADD);\n\n        if (txnFile.completed())\n        { // last record present, filter regardless of disk status\n            setTemporary(txnFile, oldFiles.values(), newFiles.values());\n            return;\n        }\n\n        if (allFilesPresent(oldFiles))\n        {  // all old files present, transaction is in progress, this will filter as aborted\n            setTemporary(txnFile, oldFiles.values(), newFiles.values());\n            return;\n        }","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/lifecycle/LogAwareFileLister.java#L124-L160","documentation":"While listing files, LogAwareFileLister replays each transaction log and calls LogFile.verify(). If records fail verification (checksum/ordering problems) and onTxnErr is THROW (the default), a CorruptTransactionLogException with this message is thrown to abort listing rather than silently misclassifying files.","triggerScenarios":"Startup or LifecycleTransaction.getFiles() encountering a txn_compaction_<id>.log whose records fail verification (CRC mismatch, incomplete records, missing files referenced by records) while OnTxnErr.THROW is set.","commonSituations":"Unclean shutdown / power loss leaving partial transaction log writes; disk corruption; manually edited or truncated log files; copying a data directory mid-compaction without the complete txn logs.","solutions":["Inspect the earlier log lines — LogFile.verify() logs which records failed and why","Set onTxnErr=IGNORE (e.g. via DatabaseDescriptor or startup flags) to skip bad transaction logs if the data is acceptable, after backing up","Restore the affected files from a backup or repair with scrub after startup completes","Ensure the whole directory contents (sstables AND their .log files) are copied together when migrating nodes","Check disk/filesystem health (dmesg, smartctl) for corruption sources"],"exampleFix":"// before: default THROW behavior on corrupt txn log\nDatabaseDescriptor.setOnTxnErr(OnTxnErr.THROW);\n// after: tolerate corrupt transaction logs after backup\nDatabaseDescriptor.setOnTxnErr(OnTxnErr.IGNORE);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    files = lister.list();\n} catch (LogTransaction.CorruptTransactionLogException e) {\n    logger.error(\"Corrupt txn log {} — restore from backup or set onTxnErr=IGNORE\", e.txn);\n}","preventionTips":["Always drain (nodetool drain) before planned restarts","Use UPS/shutdown hygiene to avoid partial writes to transaction logs","Copy sstables and their txn logs together when migrating data directories","Tune onTxnErr deliberately: THROW (default) for correctness, IGNORE only after backup"],"tags":["sstable","transaction-log","startup","corruption"],"backgroundTag":"checksum-mismatch","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"}