Skip to content

TransactionManager.applyChanges(ignoreErrors=true) silently skips WAL version gaps on recovery #4331

@ruispereira

Description

@ruispereira

Affected version: 26.4.2 (confirmed still present in 26.5.1)
Component: com.arcadedb.engine.TransactionManager

Summary

Recovery calls applyChanges(... ignoreErrors=true). When the in-WAL page version is more than one ahead of on-disk version, the code logs a WARNING and continues past that page, applying sibling pages of the same multi-page transaction. Result: torn transaction on disk.
After "successful" recovery all WAL files are dropped — the inconsistency is permanent and undiagnosable.

Code

engine/com/arcadedb/engine/TransactionManager.java:346–357 (replay branch),
:250 (recovery call site), :261 (WAL drop after recovery)

applyChanges(walPositions[lowerTx], Collections.emptyMap(), true);       // ignoreErrors=trueif (txPage.currentPageVersion > page.getVersion() + 1) {
  if (!tx.forceApply) {
    LogManager.instance().log(this, Level.WARNING, "Cannot apply changes … version in WAL (%d) does not match existent (%d)", …);
    if (ignoreErrors)
      continue;                                                          // silently skip
    throw new WALVersionGapException(…);
  }
}

Impact

Silent on-disk corruption (split records, broken edges, dangling LSM pointers) after crash recovery.
Compounds with #11, #13, #37.

Suggested fix

Log SEVERE; do not drop the WAL on gap detection; require an explicit --force-recovery flag to proceed past the gap.
Better: persist enough metadata to detect or reconstruct the gap.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions