场景如下:
1. Insert 100000 records in database.
2. Then to start 2 threads, one thread is traversing the table and at the same time, the other thread is updating database.
But in read committed isolation, some time, it can get 100001 records from traversing table result. However, I can’t find this phenomenon in Repeatable Read isolation.
表结构如下:
class A {
unsigned<4> ui4;
string tag;
tree <ui4> Idxui4;
/*list;*/
};
"update A set tag=%s where ui4=%
This is the expected behavior. If it is unacceptable for your application, then don’t use the “read-committed” isolation level but instead use the default MVCC “repeatable-read” level (especially taking into account that “read-committed” doesn't provide any significant performance benefits).
Update may change position of record in index and the same object will be traversed twice during index scan.
In MVCC update of the object always cause creation of new version. If there are multiple concurrent threads, there can be more than one version of the same object visible for the current transaction (in different moments of time).