216 ElectionInProgress: ElectionInProgress
MongoDBWhat does it mean?
A primary election is currently in progress in the replica set. Until the election completes the primary is undetermined, so writes (and some reads) are temporarily not accepted.
Why does it happen?
The cluster is electing a new primary after the current primary went down, a network partition, a step-down for maintenance, or a node restart. An election usually takes a few seconds; operations arriving within this window hit this condition.
How to fix it
This is transient; enable your driver's retry feature (retryable writes/reads) so the operation is retried automatically once the election finishes. If elections are frequent or long, investigate the root cause: network stability, node health, vote configuration, and election timeout settings (settings.electionTimeoutMillis). Inspect cluster state with rs.status().
More from this engine
- 11602 InterruptedDueToReplStateChangeOperation interrupted due to a replication state change
- 136 CappedPositionLostCapped collection position lost
- 28 PathNotViableCannot use the part of the path to traverse the element
- 225 TransactionTooOldTransactionTooOld
- 246 SnapshotUnavailableSnapshotUnavailable
- 257 TransactionTooLargeTransactionTooLarge
- 276 IndexBuildAbortedIndexBuildAborted