let t1 = mvcc.begin()?;
let t2 = mvcc.begin()?;
assert_eq!(t1.get(b"a")?, Some(vec![0]));
t2.set(b"a", vec![2])?;
t2.set(b"b", vec![2])?;
t2.commit()?;
assert_eq!(t1.get(b"a")?, Some(vec![0]));
The annotation explanation is:Read skew is when t1 reads a and b, but t2 modifies b in between the reads. Snapshot isolation prevents this.
At the same time, according to the explanation of this document, different read operations are performed before and after, and in the test, a was read before and after.
mvcc.rs: anomaly_read_skew function
The annotation explanation is:Read skew is when t1 reads a and b, but t2 modifies b in between the reads. Snapshot isolation prevents this.
At the same time, according to the explanation of this document, different read operations are performed before and after, and in the test, a was read before and after.
Therefore, we should instead read b last time