在eXtremeDB中,MVCC模式Read Committed隔离级别的问题

来源:互联网 发布:mysql可以不要主键吗 编辑:程序博客网 时间:2024/05/18 16:55

场景如下:

       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). 


 To get a consistent snapshot of the table, you need to use “repeatable-read” isolation level. 

0 0