Reputation: 2729
Given a replica set with 3 data bearing members, and MongoDB 2.6.3 (I'm also interested in the behavior of later versions if they differ) and a default write concern:
Does MongoDB (2.6 or 3.x) lock on updates until all replica sets verify the writes? That seems like a recipe for pretty slow writes.
Upvotes: 0
Views: 80
Reputation: 9208
No; this behaviour is not the default; it is possible to request such a write concern, but only by specifying verification from a number of nodes in the replica set.
The default writeconcern is 1, which means that the update returns an acknowledgement as soon as the primary node has written the update.
Other available writeconcerns are:
If you have a 3-member replica set, then specifying a write concern of 3 will make the primary wait (before acknowledgement to the client) until all 3 nodes have written the update.
The MongoDB site's documentation is pretty clear: - MongoDB v2.6 documentation on writeConcern - MongoDB v3.4 documentation on writeConcern
PS writeConcern affects how the replica set sends an acknowledgement back to the client; however locking is a different matter, and affects the primary only in practice.
Upvotes: 1