I am using MongoDB v4.0.10.
I have a multi- data-center deployment with three regions A , B and C. There are two nodes in regions A , B and one another data-bearing member with vote in region C (lower priority) for fail-over scenarios.
Due to priority the primary will be always residing in region A. The latency between regions are 200 milliseconds. By default the write concern is set to majority in the replica set configuration with timeout of 5 secs. Journaling is also enabled.
A bulk write has happened in the primary in region A which inserted 1000 documents and the primary is still waiting for acknowledgement from two other secondaries. During this time if region A goes down then a primary will get elected in region B. Everything happened within 200 milliseconds so the nodes in region B or C didn’t get a chance to replicate the latest write in the primary.
My questions are:
When the primary in region A comes back online will it rollback the write it performed ?
How will the drivers handle this scenario ? Will they retry the write (due to the retryable writes feature) or should the application handle the scenario?