Details
-
Bug
-
Resolution: Won't Do
-
Major - P3
-
None
-
None
Description
Description
Hello,
I was trying to understand better how to ensure "read your own writes" consistency when using mongo db, and I believe there may be a mistake on this documentation page: https://docs.mongodb.com/manual/reference/read-concern-majority/#read-your-own-writes
Specifically, the page says this when talking about "read your own writes" consistency:
Prior to MongoDB 3.6, you must have issued your write operation with [{{
Unknown macro: { w}}}|https://docs.mongodb.com/manual/reference/write-concern/#writeconcern.%22majority%22] write concern and then use either "majority" or "linearizable" read concern for the read operations to ensure that a single thread can read its own writes.
However, this information seems to be contradicted by the example provided on the same page about reads with concern `majority` done against the primary or secondaries: (https://docs.mongodb.com/manual/reference/read-concern-majority/#example). Specifically, the example shows this diagram:

The diagram shows, at a high level, that even after a write with `majority` concern is acknowledged, there is a period of time where secondaries may return the old value. So even after the write with `majority` concern is acknowledged at t3, a subsequent read with concern `majority` made to either secondary at t4 would still return an old value (Write_prev). This seems to be in contradiction with the quoted statement above.
If the statement was amended to include that read operations must be made to the primary, I believe it would become correct (and actually, older versions of the documentation seem to have some reference to primary: https://docs.mongodb.com/v3.4/reference/read-concern/#read-your-own-writes)
I apologize if I'm misunderstanding the documentation! Any guidance would be appreciated.
Thanks,
-parth