mongodb
runtime_error
ai_generated
partial
MongoServerError: Rollback ID mismatch: expected rollback ID 5 but received 3, aborting operation
ID: mongodb/rollback-id-mismatch
75%Fix Rate
83%Confidence
1Evidence
2024-09-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| MongoDB 5.0 | active | — | — | — |
| MongoDB 6.0 | active | — | — | — |
| MongoDB 7.0 | active | — | — | — |
Root Cause
During a replica set rollback, the operation's recorded rollback ID does not match the current rollback ID, indicating a concurrent rollback or node state change.
generic中文
在副本集回滚期间,操作记录的回滚 ID 与当前回滚 ID 不匹配,表示发生了并发回滚或节点状态更改。
Official Documentation
https://www.mongodb.com/docs/manual/reference/command/replSetRollback/Workarounds
-
80% success Identify the inconsistent node and perform a full resync: remove the data directory, restart mongod, and let it resync from the primary using initial sync: db.adminCommand({replSetResync: 1}).
Identify the inconsistent node and perform a full resync: remove the data directory, restart mongod, and let it resync from the primary using initial sync: db.adminCommand({replSetResync: 1}). -
75% success If the rollback is stuck, manually intervene by running rs.rollback() on the secondary to force a rollback to a consistent point, then re-enable replication.
If the rollback is stuck, manually intervene by running rs.rollback() on the secondary to force a rollback to a consistent point, then re-enable replication.
中文步骤
识别不一致的节点并执行完全重新同步:删除数据目录,重启 mongod,并使用 initial sync 从主节点重新同步:db.adminCommand({replSetResync: 1})。如果回滚卡住,在从节点上手动运行 rs.rollback() 强制回滚到一致点,然后重新启用复制。
Dead Ends
Common approaches that don't work:
-
70% fail
Restarting the secondary node may trigger another rollback with the same mismatch if the primary has diverged.
-
85% fail
Forcing the node to become primary with rs.stepDown() on the current primary can cause data inconsistency.