# MongoServerError: OplogTruncated: 复制落后太多

- **ID:** `mongodb/oplog-truncated-during-replication`
- **领域:** mongodb
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

从节点的复制延迟超过 oplog 窗口，导致追赶所需的 oplog 条目已被覆盖。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| mongodb-4.4 | active | — | — |
| mongodb-5.0 | active | — | — |
| mongodb-6.0 | active | — | — |
| mongodb-7.0 | active | — | — |

## 解决方案

1. ```
   Resync the secondary from scratch by removing its data directory and allowing initial sync.
   ```
2. ```
   Increase oplog size proactively to prevent future truncation, then resync.
   ```

## 无效尝试

- **** — Restarting the secondary does not recover lost oplog; it will still be behind. (95% 失败率)
- **** — Increasing oplog size after the truncation does not restore already lost entries. (85% 失败率)
