--source suite/xengine/include/have_xengine.inc --source include/have_debug.inc ################################################################### # test the has dup key in base data ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; insert into t1 values(1,1); # has a dup key on col b insert into t1 values(2,1); # expected dup key has been checked, add index fail alter table t1 add index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo alter table succeed ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # this test case test a sk has dup conflict # case1: key1 in [t0-t1] which in base data conflict with # key2 in [t1-t2] which was insert by concurrent DML # simple presentation # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key1 in d1 conflict with insert key2 in d2 # ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # key1 insert into t1 values(1,1); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Establish connection con1 (user=root) connect (con1,localhost,root,,); --echo # Switch to connection con1 connection con1; # insert key2 # wait the create sk ddl enter the inplace_create_sk_scan_base_begin point SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert'; insert into t1 values(6,1); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail --error 1062 reap; show create table t1; drop table t1; ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # this test case test a sk has dup conflict # key1 key2 conflict at [t1-t2] # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key1 in d2 conflict with insert key2 in d2 ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # key1 insert into t1 values(1,1); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; # con1 --echo # Switch to connection con1 connection con1; # insert key2 # wait the create sk ddl enter the inplace_create_sk_scan_base_begin point SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert'; insert into t1 values(6,2); insert into t1 values(7,2); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail --error 1062 reap; show create table t1; ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # this test case test a sk has dup conflict # key1 key2 conflict at [t1-t2] : use a updated key # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key1 in d2 conflict with updated key2 in d2 ################################################################### delete from t1; # key1 insert into t1 values(1,1); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; # con1 --echo # Switch to connection con1 connection con1; # insert key2 # wait the create sk ddl enter the inplace_create_sk_scan_base_begin point SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert'; insert into t1 values(6,2); update t1 set b = 2 where a = 1; select * from t1; # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail --error 1062 reap; show create table t1; drop table t1; ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # this test case test a sk has dup conflict # key1 conflict with key2 # key1[t0-t1] key2 [t1-t2] # key2 is a updated sk # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key1 in d1 conflict with updated key2 in d2 # expected there has a dup key error ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # key1 insert into t1 values(1,1); insert into t1 values(2,2); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; # con1 --echo # Switch to connection con1 connection con1; # insert key2 # wait the create sk ddl enter the inplace_create_sk_scan_base_begin point SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert'; insert into t1 values(6,2); update t1 set b = 1 where a = 2; select * from t1; # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail --error 1062 reap; show create table t1; drop table t1; ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # this test case test a sk has dup conflict # case1: key1 in [t0-t1] which in base data conflict with # key2 in [t1-t2] which was insert by concurrent DML # simple presentation # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key1 in d1 conflict with insert key2 in d3 # ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # key1 insert into t1 values(1,1); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_check_constraint_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; # insert key2 # wait the create sk ddl enter the inplace_create_sk_scan_base_begin point SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert'; insert into t1 values(6,1); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail --error 1062 reap; show create table t1; drop table t1; ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key1 in d1 conflict with update key2 in d3 # ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # key1 insert into t1 values(1,1); insert into t1 values(2,2); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_check_constraint_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; # insert key2 # wait the create sk ddl enter the inplace_create_sk_scan_base_begin point SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert'; update t1 set b = 1 where a = 2; # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail --error 1062 reap; show create table t1; drop table t1; ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key1 in d2 conflict with insert key2 in d3 # ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL d1_dml WAIT_FOR d1_dml_end'; SET DEBUG_SYNC= 'xengine.inplace_create_sk_check_constraint_begin SIGNAL d2_dml WAIT_FOR d2_dml_end'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; SET DEBUG_SYNC= 'now WAIT_FOR d1_dml'; # key1 insert into t1 values(1,1); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL d1_dml_end'; SET DEBUG_SYNC= 'now WAIT_FOR d2_dml'; # key2 insert into t1 values(2,1); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL d2_dml_end'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail --error 1062 reap; show create table t1; drop table t1; ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key1 in d2 conflict with update key2 in d3 # ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; insert into t1 values(2,2); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL d1_dml WAIT_FOR d1_dml_end'; SET DEBUG_SYNC= 'xengine.inplace_create_sk_check_constraint_begin SIGNAL d2_dml WAIT_FOR d2_dml_end'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; SET DEBUG_SYNC= 'now WAIT_FOR d1_dml'; # key1 insert into t1 values(1,1); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL d1_dml_end'; SET DEBUG_SYNC= 'now WAIT_FOR d2_dml'; # key2 update t1 set b = 1 where a = 2; # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL d2_dml_end'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail --error 1062 reap; show create table t1; drop table t1; ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # this test case test a sk has dup conflict # case1: key1 in [t0-t1] which in base data conflict with # key2 in [t1-t2] which was insert by concurrent DML # simple presentation # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # d1 add d2 add delete # ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # key1 insert into t1 values(1,1); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; # insert key2 # wait the create sk ddl enter the inplace_create_sk_scan_base_begin point SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert'; insert into t1 values(6,1); select * from t1; delete from t1 where a = 6; select * from t1; # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail --error 1062 reap; select * from t1; show create table t1; drop table t1; ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # this test case test a sk has dup conflict # case1: key1 in [t0-t1] which in base data conflict with # key2 in [t1-t2] which was insert by concurrent DML # simple presentation # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # d1 add d2 add delete(delete the d1 added pk) # ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # key1 insert into t1 values(1,1); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; # insert key2 # wait the create sk ddl enter the inplace_create_sk_scan_base_begin point SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert'; insert into t1 values(6,1); select * from t1; delete from t1 where a = 1; select * from t1; # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail # expected create index succeed. actually create fail because dup key error. # when we check unique constraint, we use a usekey = {uk=1, pk=6} to search is there has a append deleted, # if we want this case create sk succeed, we should use a userkey {prefix uk = 1 } to search is all # prefix with uk=1 has been deleted. zyn todo : make this case create sk succeed. --error 1062 reap; select * from t1; show create table t1; drop table t1; ################################################################### # ref https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # this test case test a sk has dup conflict # case1: key1 in [t0-t1] which in base data conflict with # key2 in [t1-t2] which was insert by concurrent DML # simple presentation # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # d1 add d2 add(by a updated stmt) delete # ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # key1 insert into t1 values(1,1); insert into t1 values(2,2); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; # insert key2 # wait the create sk ddl enter the inplace_create_sk_scan_base_begin point SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert'; update t1 set b = 1 where a = 2; select * from t1; delete from t1 where a = 2; select * from t1; # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail --error 1062 reap; select * from t1; show create table t1; drop table t1; ################################################################### # ref case7 https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # this test case test a sk has dup conflict # case1: key1 in [t0-t1] which in base data conflict with # key2 in [t1-t2] which was insert by concurrent DML # simple presentation # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # d1 add d2 add(by a updated stmt) delete(d1 added key) # ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # key1 insert into t1 values(1,1); insert into t1 values(2,2); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; # insert key2 # wait the create sk ddl enter the inplace_create_sk_scan_base_begin point SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert'; update t1 set b = 1 where a = 2; select * from t1; delete from t1 where a = 1; select * from t1; # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail # expected create index succeed --error 1062 reap; select * from t1; show create table t1; drop table t1; ################################################################### # ref case6 https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key in d1, delete key in d2 and insert the key in d3 # ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; insert into t1 values(1,1); # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL d1_dml WAIT_FOR d1_dml_end'; SET DEBUG_SYNC= 'xengine.inplace_create_sk_check_constraint_begin SIGNAL d2_dml WAIT_FOR d2_dml_end'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; SET DEBUG_SYNC= 'now WAIT_FOR d1_dml'; delete from t1 where a = 1; # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL d1_dml_end'; SET DEBUG_SYNC= 'now WAIT_FOR d2_dml'; # key2 insert into t1 values(2,1); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL d2_dml_end'; --echo # Switch to connection default connection default; reap; check table t1; SELECT * FROM t1; show create table t1; drop table t1; ################################################################### # ref case5 in https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key in d2, delete and add in d3 ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL d1_dml WAIT_FOR d1_dml_end'; SET DEBUG_SYNC= 'xengine.inplace_create_sk_check_constraint_begin SIGNAL d2_dml WAIT_FOR d2_dml_end'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; SET DEBUG_SYNC= 'now WAIT_FOR d1_dml'; #d1 # key1 insert into t1 values(1,1); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL d1_dml_end'; SET DEBUG_SYNC= 'now WAIT_FOR d2_dml'; #d2 # key2 delete from t1 where a = 1; insert into t1 values(1,1); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL d2_dml_end'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail reap; show create table t1; #force to use index to check. wait the storage meta refecotr completed SELECT * FROM t1 FORCE INDEX(t1_c22) WHERE b > 0; drop table t1; ################################################################### # ref case5 in https://yuque.antfin-inc.com/db_core_team/internal_docs/wywa0h#f68c70b7 # t0: create table time # t1: build-sk start time # t2: build-base sk finish, and uk check start # t3: uk-check finish # d1: [t0-t1] # d2: [t1-t2] # d3: [t2-t3] # insert key in d2, delete(by update stmt) and add in d3 ################################################################### --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine; # set the wait point to insert key2 SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL d1_dml WAIT_FOR d1_dml_end'; SET DEBUG_SYNC= 'xengine.inplace_create_sk_check_constraint_begin SIGNAL d2_dml WAIT_FOR d2_dml_end'; send alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT; --echo # Switch to connection con1 connection con1; SET DEBUG_SYNC= 'now WAIT_FOR d1_dml'; #d1 # key1 insert into t1 values(1,1); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL d1_dml_end'; SET DEBUG_SYNC= 'now WAIT_FOR d2_dml'; #d2 # key2 update t1 set b = 2 where a = 1; insert into t1 values(2,1); # signal create sk ddl the key2 has been inserted SET DEBUG_SYNC= 'now SIGNAL d2_dml_end'; --echo # Switch to connection default connection default; # receive the result of alter table, expected create index fail reap; show create table t1; #force to use index to check. wait the storage meta refecotr completed SELECT * FROM t1 FORCE INDEX(t1_c22) WHERE b > 0; drop table t1; --echo ################################################################### --echo case bug #24260836 --echo ################################################################### CREATE TABLE t1(id INT PRIMARY KEY, b char(10), c int, d CHAR(10))ENGINE=XENGINE; INSERT INTO t1 VALUES(1, '1111111', 2, '1a'); INSERT INTO t1 VALUES(2, '2222222', 4, '2b'); --echo #### --echo prefix index --echo #### SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml WAIT_FOR dml_done'; SEND ALTER TABLE t1 ADD UNIQUE KEY pre_uk(b(4)), ADD KEY pre_sk(d(4)), ALGORITHM=INPLACE, LOCK=DEFAULT; --echo # Switch to dml connection connect (dml,localhost,root,,); connection dml; SET DEBUG_SYNC= 'now WAIT_FOR start_dml'; INSERT INTO t1 VALUES(3, '3333333', 6, '3c'); INSERT INTO t1 VALUES(4, '3333222', 8, '3c'); SELECT * FROM t1; SET DEBUG_SYNC= 'now SIGNAL dml_done'; --echo # Switch to connection default connection default; # receive the result of ALTER TABLE, expected adding UNIQUE KEY failed --error 1062 reap; CHECK TABLE t1; SHOW CREATE TABLE t1; SELECT * FROM t1; drop table t1; --source suite/xengine/include/check_xengine_log_error.inc