Practice Question on Write Concern

One of the practice question points out that when we change the write concern of an operation from 1 to majority, the operation is more likely to block other operations in the application? How is that possible?

I understand that a write concern of majority can take longer than write concern of 1, as the write needs to propogate and get committed to a majority of the members in the RS.

Moreover, a write concern of majority has the potential to indefinitely block the current instance of the application, provided majority of the members of the RS are down. In this situation, the write won’t be able to propogate to the majority of members, leading the current instance of the application to wait indefinitely for an acknowledgement (provided a wtimeout was not specified with the write concern).

But how can a write concern of majority increase the likelihood of blocking other operations in the application? Another users performing various operations on the same application, should not be blocked.

Can you please clarify?

Hi @PuneetC,

When you set write concern to majority, then acknowledgement of write operation to the majority of voting nodes is requested. So, if the write operation is not successful and wtimeout limit is also not specified, then the operations will get blocked on the database level.

Please refer to the following documentation for more details:

Please let me know, if you have any further questions.

Thanks,
Sonali