When the write concern is set to ``w:2`, how does Mongo decide which node will provide the second write?
For example, I have a replica set consisting of:
- DC1-node1
- DC1-node2
- DC2-node1
- DC2-node2
- DC3-arbiter1
- DC3-client1
If DC1-node1 is the primary, is it more likely to get a second write from DC1-node2?
Does node priority weigh into this?
Supposing there is a large round trip delay between DC1 and DC2 (say, 1000ms), all Majority writes would incurr that delay and every write would take 1000ms longer.
To ensure we get 2 confirmed writes, but avoid crossing DCs, I can only think to use w:2
and hope it somehow chooses the closest one, OR a custom write concern, such as:
{ MySet: { "DC1": 2, "DC2":0 } }
Custom means that in a DC failover, the write concern has to be updated before the cluster will allow writes again - it theoretically should fail over still though.
Is there another option I’ve overlooked?