{
  "id": "mongodb/sharded-cluster-orphan-documents",
  "signature": "MongoServerError: orphan documents detected during chunk migration on namespace mydb.mycoll",
  "signature_zh": "MongoServerError: 在命名空间 mydb.mycoll 的块迁移期间检测到孤立文档",
  "regex": "orphan documents detected during chunk migration on namespace",
  "domain": "mongodb",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Chunk migration left behind documents that do not belong to the new shard range due to concurrent writes or a failed migration cleanup.",
  "root_cause_type": "generic",
  "root_cause_zh": "由于并发写入或迁移清理失败，块迁移留下了不属于新分片范围的文档。",
  "versions": [
    {
      "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"
    },
    {
      "version": "MongoDB 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Deletion without verifying shard key ranges can cause data loss.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Orphans persist after restart unless the balancer re-migrates or cleanup runs.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Cleanup may conflict with ongoing balancer operations, requiring repeated runs.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use the cleanupOrphaned command on the affected shard to remove orphan documents: db.adminCommand({ cleanupOrphaned: 'mydb.mycoll' }).",
      "success_rate": 0.8,
      "how": "Use the cleanupOrphaned command on the affected shard to remove orphan documents: db.adminCommand({ cleanupOrphaned: 'mydb.mycoll' }).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Temporarily disable the balancer (sh.stopBalancer()) and manually re-migrate the chunk to ensure consistent range coverage.",
      "success_rate": 0.85,
      "how": "Temporarily disable the balancer (sh.stopBalancer()) and manually re-migrate the chunk to ensure consistent range coverage.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Verify shard key distribution and adjust chunk boundaries using splitChunk to isolate orphan documents.",
      "success_rate": 0.7,
      "how": "Verify shard key distribution and adjust chunk boundaries using splitChunk to isolate orphan documents.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use the cleanupOrphaned command on the affected shard to remove orphan documents: db.adminCommand({ cleanupOrphaned: 'mydb.mycoll' }).",
    "Temporarily disable the balancer (sh.stopBalancer()) and manually re-migrate the chunk to ensure consistent range coverage.",
    "Verify shard key distribution and adjust chunk boundaries using splitChunk to isolate orphan documents."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.75,
  "resolvable": "partial",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}