What's the usage and behaviour of w:majority on half cluster down?

mongodb

Solution

With a 5 member (4 data bearing, one arbiter) replica set, each member having one vote, a majority is 3. Therefore, `w : majority` means a write needs to wait for ack from 3 nodes before returning successfully. Only nodes that replicate the write can ack it - the arbiter increases the number of nodes for majority because it has a vote but cannot help fulfill majority because it isn't data bearing. If 2/4 data bearing nodes are down, then you cannot get 3 acks, so writes with `w:majority` cannot succeed and will time out and fail.

Why does the arbiter count for determining majority? Rollback. The key guarantee of `w:majority` is that, if a write is ack'd with `w:majority`, then it will not be rolled back during failover. Including the arbiter in the count for majority is necessary for this guarantee.

Problem

considering a replica set composed of 5 members : - R1,R2,R3,R4 being replicas - A1 being an arbiter If we use w:majority as write concern in our application : - How many replicas will be used before ack write when all members are up and running ? - If 2 replicas out of 4 crash, how is handled 'majority' requirement : - does it mean we still wait for write completion on the same number of replicas, meaning the write is blocked, waiting for a members to turn on. - does arbiter as an effet on this particular writeConcern and downsize the number of replicas required to satisfy w:majority writeConcern ? I understand replication w: but majority seems to be a special case : http://docs.mongodb.org/manual/core/write-concern/#write-operations-write-concern "For the purposes of write concern, majority refers to a majority of the votes in the set. As a result, arbiters affect the definition of majority, in order to help prevent rollback." Thanks for your help.

Original source