最近尝试用PostgreSQL写偏序例子,测试opengauss的serializable隔离级别,结果两个事务都成功提交了,opengauss如何解决写偏序问题呢?
create table dots ( id int not null primary key, color text not null ); insert into dots with x(id) as (select generate_series(1,10)) select id, case when id % 2 = 1 then 'black' else 'white' end from x;
事务1 : 事务2 start transaction isolation level serializable; start transaction isolation level serializable; update dots set color = 'black' where color = 'white'; update dots set color = 'white' where color = 'black'; commit; commit; 如果是PostgreSQL其中有一个事务会失败的,但是opengauss都成功了! openGauss=# select * from dots; id | color ----+------- 4 | black 6 | black 8 | black 10 | black 2 | black 3 | white 5 | white 7 | white 9 | white 1 | white
参考:https://wiki.postgresql.org/wiki/SSI#Black_and_White
新大陆软件 秦浩 mobile: 17625988619 e-mail:qinhao@newland.com.cn
您好,openGauss不支持serializable隔离级别,因此,您执行的测试用例实在repeatable read场景下的表现。
---原始邮件--- 发件人: "qinhao@newland.com.cn"<qinhao@newland.com.cn> 发送时间: 2023年3月13日(周一) 晚上6:04 收件人: "storageengine"<storageengine@opengauss.org>; 主题: [StorageEngine] 写偏序问题(write skew)
最近尝试用PostgreSQL写偏序例子,测试opengauss的serializable隔离级别,结果两个事务都成功提交了,opengauss如何解决写偏序问题呢?
create table dots ( id int not null primary key, color text not null ); insert into dots with x(id) as (select generate_series(1,10)) select id, case when id % 2 = 1 then 'black' else 'white' end from x;
事务1 : 事务2 start transaction isolation level serializable; start transaction isolation level serializable; update dots set color = 'black' where color = 'white'; update dots set color = 'white' where color = 'black'; commit; commit; 如果是PostgreSQL其中有一个事务会失败的,但是opengauss都成功了! openGauss=# select * from dots; id | color ----+------- 4 | black 6 | black 8 | black 10 | black 2 | black 3 | white 5 | white 7 | white 9 | white 1 | white
参考:https://wiki.postgresql.org/wiki/SSI#Black_and_White
新大陆软件 秦浩 mobile: 17625988619 e-mail:qinhao@newland.com.cn
_______________________________________________ StorageEngine mailing list -- storageengine@opengauss.org To unsubscribe send an email to storageengine-leave@opengauss.org