--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev...@googlegroups.com.
To post to this group, send email to mongo...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/989fd692-7bc7-416f-a113-d3d6df62c0c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The answer to this question is a little tricky. At read concern "majority", in a single replica set, a single query won't observe older state after having observed newer state. At read concern "local", I believe this is also true because we kill running queries before rolling back uncommited (local) state. I don't believe this is sufficient to meet the standard definition of "serializability", though.
Once you issue a second query, however, you're at risk, even if you make a good faith effort to only read from primaries. The problem is that in certain network partitions, you may be able to see a node that does not yet know it has been partitioned. That node may believe it is primary for some time after another primary (which it cannot see) is elected. You might route one read to the partitioned "old" primary and another to the "new" primary. You might route the second read to the "old" primary and the first to the "new" one, and then even at "majority" read concern see a causality violation. Reading with "linearizable" read concern prevents this, by ensuring that the node you're reading from is still primary (by converting reads to writes, essentially). However, IIRC, even this isn't the same as serializability, and it is less powerful than "strict serializability".
If you haven't already, I would recommend reading Kyle Kingsbury's posts about MongoDB. The most recent one covers the 3.4 branch and a number of improvements we made over the last few years. The older ones show a lot of MongoDB's prior warts, and also contain a nice drawing of the "map of consistency models" from Bailis's High Availability Transactions paper. The Bailis paper contains a convenient, not-too-controversial description of the relationship between database and distributed systems consistency concepts.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/d2b8362b-dad8-4242-bfea-f72eda27e384%40googlegroups.com.