{
  "id": "mongodb/capped-collection-invalid-oplog",
  "signature": "MongoServerError: CappedCollection: invalid oplog entry with timestamp { ts: Timestamp(0, 0) }",
  "signature_zh": "MongoServerError: CappedCollection: 无效的 oplog 条目，时间戳为 { ts: Timestamp(0, 0) }",
  "regex": "CappedCollection: invalid oplog entry with timestamp \\{ ts: Timestamp\\(0, 0\\) \\}",
  "domain": "mongodb",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The oplog contains a corrupted entry with a zero timestamp, likely due to a disk write error or improper shutdown.",
  "root_cause_type": "generic",
  "root_cause_zh": "oplog 包含一个时间戳为零的损坏条目，可能是由于磁盘写入错误或不当关机导致。",
  "versions": [
    {
      "version": "MongoDB 5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MongoDB 6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MongoDB 7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The oplog is a special collection; manual deletion corrupts the storage engine state.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "repairDatabase is not designed for internal system collections like oplog.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The corrupted entry remains in the oplog file after restart.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Restart the MongoDB instance with --repair to reconstruct the oplog: mongod --repair --dbpath /var/lib/mongodb",
      "success_rate": 0.8,
      "how": "Restart the MongoDB instance with --repair to reconstruct the oplog: mongod --repair --dbpath /var/lib/mongodb",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the node is a secondary, resync from the primary by deleting the local database files and restarting: rm -rf /var/lib/mongodb/local/* && systemctl restart mongod",
      "success_rate": 0.95,
      "how": "If the node is a secondary, resync from the primary by deleting the local database files and restarting: rm -rf /var/lib/mongodb/local/* && systemctl restart mongod",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use mongodump with --oplog to export the oplog, then drop and re-import to clean corrupted entries: mongodump --db local --collection oplog.rs --out /tmp/oplog_backup; mongo local --eval 'db.oplog.rs.drop()'; mongorestore --db local --collection oplog.rs /tmp/oplog_backup/local/oplog.rs.bson",
      "success_rate": 0.85,
      "how": "Use mongodump with --oplog to export the oplog, then drop and re-import to clean corrupted entries: mongodump --db local --collection oplog.rs --out /tmp/oplog_backup; mongo local --eval 'db.oplog.rs.drop()'; mongorestore --db local --collection oplog.rs /tmp/oplog_backup/local/oplog.rs.bson",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Restart the MongoDB instance with --repair to reconstruct the oplog: mongod --repair --dbpath /var/lib/mongodb",
    "If the node is a secondary, resync from the primary by deleting the local database files and restarting: rm -rf /var/lib/mongodb/local/* && systemctl restart mongod",
    "Use mongodump with --oplog to export the oplog, then drop and re-import to clean corrupted entries: mongodump --db local --collection oplog.rs --out /tmp/oplog_backup; mongo local --eval 'db.oplog.rs.drop()'; mongorestore --db local --collection oplog.rs /tmp/oplog_backup/local/oplog.rs.bson"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.mongodb.com/docs/manual/core/capped-collections/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-01-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}