The client has an inconsistent view of the server side situation and uses node A for writing which it believes to be the primary, while in reality it's changed its role to a secondary.
If we encounter an error indicating this condition, we now refresh the cluster view, then retry the write once.
The clientside cluster view may become outdated, causing us to erroneously write to non-primary nodes. This is how this can occur (see https://github.com/xp-forge/mongodb/issues/42#issuecomment-1712795735):
The client has an inconsistent view of the server side situation and uses node
A
for writing which it believes to be the primary, while in reality it's changed its role to a secondary.If we encounter an error indicating this condition, we now refresh the cluster view, then retry the write once.