mongodb
system_error
ai_generated
true
MongoServerError: OplogTruncated: replication has fallen too far behind
ID: mongodb/oplog-truncated-during-replication
90%Fix Rate
85%Confidence
1Evidence
2023-09-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| mongodb-4.4 | active | — | — | — |
| mongodb-5.0 | active | — | — | — |
| mongodb-6.0 | active | — | — | — |
| mongodb-7.0 | active | — | — | — |
Root Cause
A secondary member's replication lag exceeds the oplog window, so the oplog entries needed for catch-up have been overwritten.
generic中文
从节点的复制延迟超过 oplog 窗口,导致追赶所需的 oplog 条目已被覆盖。
Official Documentation
https://www.mongodb.com/docs/manual/replication/#oplog-sizeWorkarounds
-
95% success Resync the secondary from scratch by removing its data directory and allowing initial sync.
Resync the secondary from scratch by removing its data directory and allowing initial sync.
-
80% success Increase oplog size proactively to prevent future truncation, then resync.
Increase oplog size proactively to prevent future truncation, then resync.
中文步骤
Resync the secondary from scratch by removing its data directory and allowing initial sync.
Increase oplog size proactively to prevent future truncation, then resync.
Dead Ends
Common approaches that don't work:
-
95% fail
Restarting the secondary does not recover lost oplog; it will still be behind.
-
85% fail
Increasing oplog size after the truncation does not restore already lost entries.