{
  "id": "mongodb/oplog-truncation-during-recovery",
  "signature": "MongoServerError: OplogTruncation: replication recovery failed due to missing oplog entries",
  "signature_zh": "MongoServerError：OplogTruncation：由于缺少 oplog 条目，复制恢复失败",
  "regex": "OplogTruncation.*missing oplog entries",
  "domain": "mongodb",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "The oplog was truncated (e.g., due to replication lag or manual deletion) before a secondary could replay all entries, causing an irrecoverable gap in the replication stream.",
  "root_cause_type": "generic",
  "root_cause_zh": "由于复制延迟或手动删除，oplog 在辅助节点重放所有条目之前被截断，导致复制流中出现无法恢复的间隙。",
  "versions": [],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Increasing oplog size (e.g., via --oplogSizeMB) prevents future truncation but does not recover the lost entries; the secondary remains stuck.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Restarting the secondary node only re-attempts the same recovery, which fails again since the oplog gap persists.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Resync the secondary from scratch: stop the secondary, delete its data directory (e.g., rm -rf /data/db/*), then restart and let it perform an initial sync from the primary.",
      "success_rate": 0.95,
      "how": "Resync the secondary from scratch: stop the secondary, delete its data directory (e.g., rm -rf /data/db/*), then restart and let it perform an initial sync from the primary.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the primary still has the missing oplog entries (e.g., in a backup), restore them manually using mongorestore with --oplogReplay, then restart replication.",
      "success_rate": 0.7,
      "how": "If the primary still has the missing oplog entries (e.g., in a backup), restore them manually using mongorestore with --oplogReplay, then restart replication.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Resync the secondary from scratch: stop the secondary, delete its data directory (e.g., rm -rf /data/db/*), then restart and let it perform an initial sync from the primary.",
    "If the primary still has the missing oplog entries (e.g., in a backup), restore them manually using mongorestore with --oplogReplay, then restart replication."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.mongodb.com/docs/manual/tutorial/resync-replica-set-member/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}