apache/cassandra · error · LogTransaction.CorruptTransactionLogException
Some records failed verification. See earlier in log for det
Error message
Some records failed verification. See earlier in log for details.
What it means
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.
Source
Thrown at src/java/org/apache/cassandra/db/lifecycle/LogAwareFileLister.java:142
/**
* We read txn log files, if we fail we throw only if the user has specified
* OnTxnErr.THROW, else we log an error and apply the txn log anyway
*/
void classifyFiles(File txnFile)
{
try (LogFile txn = LogFile.make(txnFile))
{
readTxnLog(txn);
classifyFiles(txn);
files.put(txnFile, FileType.TXN_LOG);
}
}
void readTxnLog(LogFile txn)
{
if (!txn.verify() && onTxnErr == OnTxnErr.THROW)
throw new LogTransaction.CorruptTransactionLogException("Some records failed verification. See earlier in log for details.", txn);
}
void classifyFiles(LogFile txnFile)
{
Map<LogRecord, Set<File>> oldFiles = txnFile.getFilesOfType(folder, files.navigableKeySet(), LogRecord.Type.REMOVE);
Map<LogRecord, Set<File>> newFiles = txnFile.getFilesOfType(folder, files.navigableKeySet(), LogRecord.Type.ADD);
if (txnFile.completed())
{ // last record present, filter regardless of disk status
setTemporary(txnFile, oldFiles.values(), newFiles.values());
return;
}
if (allFilesPresent(oldFiles))
{ // all old files present, transaction is in progress, this will filter as aborted
setTemporary(txnFile, oldFiles.values(), newFiles.values());
return;
}View on GitHub (pinned to 88fd0f6a0e)
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
Example fix
// before: default THROW behavior on corrupt txn log DatabaseDescriptor.setOnTxnErr(OnTxnErr.THROW); // after: tolerate corrupt transaction logs after backup DatabaseDescriptor.setOnTxnErr(OnTxnErr.IGNORE);
Defensive patterns
Strategy: try-catch
Try / catch
try {
files = lister.list();
} catch (LogTransaction.CorruptTransactionLogException e) {
logger.error("Corrupt txn log {} — restore from backup or set onTxnErr=IGNORE", e.txn);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.
Related errors
- Corrupted key cache. Failed to deserialize key of key cache
- Multiple sstable format implementations with the same name %
- Failed to instantiate sstable format '%s'
- Corrupt flags value for clustering prefix (isStatic flag set
- ERR_WRONG_DISK_STATE
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/1f3c770bef28b1c2.
Report an issue: GitHub.