I have found a clue to let this be a necessary condition, But I can not tell if this is a necessary and sufficient condition.
This condition makes sense in distributed-txn. I draw a picture to describe:
TxnA ----(W)----> MongoS -------> (node1) ----------[A start] ---------------[B start] -------------[A prepare] ------------------[B read]
| |
TxnB -----(R)----------| |--------> (node2) ----------[A start] --------------[A prepare] ----------[B start] ---------------[B read]
There are two txns, TxnA only writes, and TxnB only reads.
There are two nodes node1 and node2.
The wall-clock events in node1 and node2 happen in the sequence describe in the pic above.
In node1, B starts before A prepares. So from the aspect of SI, The prepare action is invisible to B.
In node2, B starts after A prepares, as wiredTiger releases snapshots after prepare finishes, so B will see A's prepare action.
The distributed txn must obeys SI, and in node1, A is invisible to B from SI's aspect. So in node2, there should be some mechanism to make A invisible to B.
That has to be the timestamp mechanism.
When A prepares, it negotiates the greatest HLC in all nodes as the prepare timestamp,so it definitely is larger than B's read timestamp.
If this is violated, A will be partially visible to B, which violates SI.
I wonder if this is sufficient , I wonder how mongo guarantees this.
More or less, I made progress on this puzzle.
在 2020年3月18日星期三 UTC+8下午8:55:08,孔德雨写道: