mongodb data_error ai_generated partial

MongoServerError: OplogTruncationFailed: oplog entry truncated during recovery for namespace local.oplog.rs

ID: mongodb/oplog-truncation-after-point-in-time-recovery

Also available as: JSON · Markdown · 中文
70%Fix Rate
80%Confidence
1Evidence
2024-03-22First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
MongoDB 6.0 active
MongoDB 7.0 active
MongoDB 8.0 active

Root Cause

During point-in-time recovery from a backup, the oplog was truncated because the recovery timestamp exceeded the oplog window or the oplog was corrupted.

generic

中文

从备份进行时间点恢复期间,由于恢复时间戳超出 oplog 窗口或 oplog 损坏,oplog 被截断。

Workarounds

  1. 80% success Perform a full resync of the affected secondary from a healthy primary using rs.reconfig() or initial sync.
    Perform a full resync of the affected secondary from a healthy primary using rs.reconfig() or initial sync.
  2. 75% success Use mongodump/mongorestore with --oplogReplay to restore from a backup that includes a consistent oplog window.
    Use mongodump/mongorestore with --oplogReplay to restore from a backup that includes a consistent oplog window.
  3. 70% success If the primary is affected, promote a secondary with a valid oplog using rs.stepDown() and rs.reconfig().
    If the primary is affected, promote a secondary with a valid oplog using rs.stepDown() and rs.reconfig().

中文步骤

  1. Perform a full resync of the affected secondary from a healthy primary using rs.reconfig() or initial sync.
  2. Use mongodump/mongorestore with --oplogReplay to restore from a backup that includes a consistent oplog window.
  3. If the primary is affected, promote a secondary with a valid oplog using rs.stepDown() and rs.reconfig().

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Oplog size change affects future operations, not past truncation.

  2. 70% fail

    Incompatible backup may have different oplog range, causing further errors.

  3. 100% fail

    Direct modification can corrupt the replica set and cause data loss.