drop table if exists t1; Warnings: Note 1051 Unknown table 'test.t1' set transaction_isolation = 'READ-COMMITTED'; create table t1 (pk int, uk int, sk int, primary key (pk), unique key (uk), key (sk)) engine=xengine; SET DEBUG_SYNC = "xengine.check_and_lock_sk SIGNAL try_insert WAIT_FOR insert_done"; begin; insert into t1 value (1, 2, 3) on duplicate key update sk = 3; SET DEBUG_SYNC = "now WAIT_FOR try_insert"; insert into t1 value (2, 2, 4) on duplicate key update sk = 4; SET DEBUG_SYNC = "now SIGNAL insert_done"; commit; select sk from t1; sk 3 select * from t1; pk uk sk 2 2 3 drop table t1; set transaction_isolation = 'REPEATABLE-READ'; create table t1 (pk int, uk int, sk int, primary key (pk), unique key (uk), key (sk)) engine=xengine; SET DEBUG_SYNC = "xengine.check_and_lock_sk SIGNAL try_insert WAIT_FOR insert_done"; begin; insert into t1 value (1, 2, 3) on duplicate key update sk = 3; SET DEBUG_SYNC = "now WAIT_FOR try_insert"; insert into t1 value (2, 2, 4) on duplicate key update sk = 4; SET DEBUG_SYNC = "now SIGNAL insert_done"; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction commit; select sk from t1; sk 4 select * from t1; pk uk sk 2 2 4 drop table t1; set transaction_isolation = 'READ-COMMITTED'; create table t1 (pk int, uk int, sk int, primary key (pk), unique key (uk), key (sk)) engine=xengine; SET DEBUG_SYNC = "xengine.check_and_lock_unique_pk SIGNAL try_insert WAIT_FOR insert_done"; begin; select * from t1; pk uk sk insert into t1 value (1, 2, 3) on duplicate key update sk = 3; SET DEBUG_SYNC = "now WAIT_FOR try_insert"; insert into t1 value (1, 3, 4) on duplicate key update sk = 4; set global xengine_force_flush_memtable_now=on; SET DEBUG_SYNC = "now SIGNAL insert_done"; commit; select sk from t1; sk 3 select * from t1; pk uk sk 1 3 3 drop table t1; set transaction_isolation = 'REPEATABLE-READ'; create table t1 (pk int, uk int, sk int, primary key (pk), unique key (uk), key (sk)) engine=xengine; SET DEBUG_SYNC = "xengine.check_and_lock_unique_pk SIGNAL try_insert WAIT_FOR insert_done"; begin; select * from t1; pk uk sk insert into t1 value (1, 2, 3) on duplicate key update sk = 3; SET DEBUG_SYNC = "now WAIT_FOR try_insert"; insert into t1 value (1, 3, 4) on duplicate key update sk = 4; set global xengine_force_flush_memtable_now=on; SET DEBUG_SYNC = "now SIGNAL insert_done"; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction commit; select sk from t1; sk 4 select * from t1; pk uk sk 1 3 4 drop table t1; set transaction_isolation = 'READ-COMMITTED'; create table t1 (pk int, uk int, sk int, primary key (pk), unique key (uk), key (sk)) engine=xengine; insert into t1 value (1, 2, 3); SET DEBUG_SYNC = "xengine.check_and_lock_sk SIGNAL try_insert WAIT_FOR insert_done"; begin; insert into t1 value (2, 2, 4) on duplicate key update sk = 4; SET DEBUG_SYNC = "now WAIT_FOR try_insert"; insert into t1 value (3, 2, 5) on duplicate key update sk = 5; set global xengine_force_flush_memtable_now=on; SET DEBUG_SYNC = "now SIGNAL insert_done"; commit; select sk from t1; sk 4 select * from t1; pk uk sk 1 2 4 drop table t1; set transaction_isolation = 'REPEATABLE-READ'; create table t1 (pk int, uk int, sk int, primary key (pk), unique key (uk), key (sk)) engine=xengine; insert into t1 value (1, 2, 3); SET DEBUG_SYNC = "xengine.check_and_lock_sk SIGNAL try_insert WAIT_FOR insert_done"; begin; insert into t1 value (2, 2, 4) on duplicate key update sk = 4; SET DEBUG_SYNC = "now WAIT_FOR try_insert"; insert into t1 value (3, 2, 5) on duplicate key update sk = 5; set global xengine_force_flush_memtable_now=on; SET DEBUG_SYNC = "now SIGNAL insert_done"; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction commit; select sk from t1; sk 5 select * from t1; pk uk sk 1 2 5 drop table t1; set transaction_isolation = 'READ-COMMITTED'; create table t1 (pk int, uk int, sk int, primary key (pk), unique key (uk), key (sk)) engine=xengine; insert into t1 value (1, 2, 3); SET DEBUG_SYNC = "xengine.check_and_lock_sk SIGNAL try_insert WAIT_FOR insert_done"; begin; insert into t1 value (2, 2, 4) on duplicate key update sk = 4; SET DEBUG_SYNC = "now WAIT_FOR try_insert"; delete from t1 where pk = 1; set global xengine_force_flush_memtable_now=on; SET DEBUG_SYNC = "now SIGNAL insert_done"; commit; select sk from t1; sk 4 select * from t1; pk uk sk 2 2 4 drop table t1; set transaction_isolation = 'REPEATABLE-READ'; create table t1 (pk int, uk int, sk int, primary key (pk), unique key (uk), key (sk)) engine=xengine; insert into t1 value (1, 2, 3); SET DEBUG_SYNC = "xengine.check_and_lock_sk SIGNAL try_insert WAIT_FOR insert_done"; begin; insert into t1 value (2, 2, 4) on duplicate key update sk = 4; SET DEBUG_SYNC = "now WAIT_FOR try_insert"; delete from t1 where pk = 1; set global xengine_force_flush_memtable_now=on; SET DEBUG_SYNC = "now SIGNAL insert_done"; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction commit; select sk from t1; sk select * from t1; pk uk sk drop table t1;