Read Concern: Linearizable vs Majority

I was reading the manual and doing a deep dive into how MongoDB provide consistency.

Regarding read concerns linearizable and majority I can only find one scenario where it would be preferable to use linearizable:

Assuming that writes are made with write concern majority and read preferences to Primary, I want to:

  1. read my own writes
  2. read only commited data (no rollback).

The only reason to use linearizable would be to avoid a double primary situation due to network partition where both primaries would believe to have the latest majority commit

In this scenario, only a linearizable read would be able to return an error if reading from the former primary due to the former primary not being able to reach secondaries to confirm w:majority point.

Is this reasoning correct?

Hey @Adriano_Tirloni,

Yes, in the scenario of a network issue, a "linearizable read" can be more useful. A linearizable read ensures that the latest committed write is returned. Unlike "majority", a linearizable read concern confirms with secondary members that the read operation is reading from a primary that is capable of confirming writes with { w: "majority" } write concern. If a linearizable read is performed on the former primary, it will return an error if the former primary is unable to reach a majority of secondaries to confirm the write concern “majority” point. This helps to ensure that only the latest committed data is returned and that no rolled-back data is seen. Linearizable read concern guarantees only apply if read operations specify a query filter that uniquely identifies a single document.

Please feel free to reach out for anything else as well.


Thanks for the reply Satyam, I was only figuring out the use case for linearizable, due to the speed impact.

So that means, suppose network is not an issue (always only one primary exists which is being read from), linearizable and majority read doesn’t have any difference except performance? (e.g. results in these two would always be the same).

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.