2

Does a hidden member count toward and operate as part of a write_concern majority in MongoDB 2.6?

It states here that for the w option, prior to Mongo 3.0,

"majority" refers to the majority of the replica set’s members.

It seems then that if I have four Mongo 2.6 nodes and one is hidden, then "majority" calculates as w=3, since the hidden node is still a replica-set member. Meanwhile, it's unclear to me whether writing to the hidden member counts toward fulfilling the write concern -- after all, only three nodes are visible for reads.

The concern I have is that with the above example, if one non-hidden node goes down, it becomes impossible to fulfill a write with w="majority".

1 Answer 1

1

Indeed hidden members take part in voting. If your write concern is equals to visible nodes and there is a hidden member who can vote, it shouldn't be an issue. You have to plan write concern carefully.

Please see https://docs.mongodb.org/manual/core/replica-set-hidden-member/

4
  • 1
    Thanks for your answer, but I'm not asking if hidden members can vote -- I know they can. I'm asking if a write to a hidden member counts toward the replication count specified in the w parameter of the write_concern. Voting is how nodes elect a primary in the cluster, and of course is a different process from replicating a write.
    – einnocent
    Commented Mar 1, 2016 at 22:54
  • Well, short answer is yes. Hidden members do participate in write concern. However if your 'w' parameter is 'majority' then you don't need to worry as long as you have odd number of servers (non-arbitors)
    – Saleem
    Commented Mar 1, 2016 at 23:36
  • What kind of problems can result from writing with write concern w="majority" when having an even number of non-arbitor servers? Not including the known issue with electing a primary, which of course can be resolved by having an arbitor.
    – einnocent
    Commented Mar 2, 2016 at 0:49
  • When you have more server failures so that it's not possible to determine majority. e.g. if you have 5 member replica set (including arbiter) and you loose 3 out of 4 secondaries. in this case 1/4 will never be a majority so your write operation will fail. remember majority is anything more than half.
    – Saleem
    Commented Mar 2, 2016 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.