polardbxengine/mysql-test/suite/xengine/r/add_unique_index_online.result

426 lines
14 KiB
Plaintext

drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
insert into t1 values(2,1);
alter table t1 add index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
alter table succeed
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Establish connection con1 (user=root)
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert';
insert into t1 values(6,1);
SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish';
# Switch to connection default
ERROR 23000: Duplicate entry '1' for key 't1_c22'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert';
insert into t1 values(6,2);
insert into t1 values(7,2);
SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish';
# Switch to connection default
ERROR 23000: Duplicate entry '2' for key 't1_c22'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
delete from t1;
insert into t1 values(1,1);
SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
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;
a b
1 2
6 2
SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish';
# Switch to connection default
ERROR 23000: Duplicate entry '2' for key 't1_c22'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
insert into t1 values(2,2);
SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
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;
a b
1 1
2 1
6 2
SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish';
# Switch to connection default
ERROR 23000: Duplicate entry '1' for key 't1_c22'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
SET DEBUG_SYNC= 'xengine.inplace_create_sk_check_constraint_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert';
insert into t1 values(6,1);
SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish';
# Switch to connection default
ERROR 23000: Duplicate entry '1' for key 't1_c22'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
insert into t1 values(2,2);
SET DEBUG_SYNC= 'xengine.inplace_create_sk_check_constraint_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert';
update t1 set b = 1 where a = 2;
SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish';
# Switch to connection default
ERROR 23000: Duplicate entry '1' for key 't1_c22'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
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';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR d1_dml';
insert into t1 values(1,1);
SET DEBUG_SYNC= 'now SIGNAL d1_dml_end';
SET DEBUG_SYNC= 'now WAIT_FOR d2_dml';
insert into t1 values(2,1);
SET DEBUG_SYNC= 'now SIGNAL d2_dml_end';
# Switch to connection default
ERROR 23000: Duplicate entry '1' for key 't1_c22'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(2,2);
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';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR d1_dml';
insert into t1 values(1,1);
SET DEBUG_SYNC= 'now SIGNAL d1_dml_end';
SET DEBUG_SYNC= 'now WAIT_FOR d2_dml';
update t1 set b = 1 where a = 2;
SET DEBUG_SYNC= 'now SIGNAL d2_dml_end';
# Switch to connection default
ERROR 23000: Duplicate entry '1' for key 't1_c22'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert';
insert into t1 values(6,1);
select * from t1;
a b
1 1
6 1
delete from t1 where a = 6;
select * from t1;
a b
1 1
SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish';
# Switch to connection default
ERROR 23000: Duplicate entry '1' for key 't1_c22'
select * from t1;
a b
1 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert';
insert into t1 values(6,1);
select * from t1;
a b
1 1
6 1
delete from t1 where a = 1;
select * from t1;
a b
6 1
SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish';
# Switch to connection default
ERROR 23000: Duplicate entry '1' for key 't1_c22'
select * from t1;
a b
6 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
insert into t1 values(2,2);
SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert';
update t1 set b = 1 where a = 2;
select * from t1;
a b
1 1
2 1
delete from t1 where a = 2;
select * from t1;
a b
1 1
SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish';
# Switch to connection default
ERROR 23000: Duplicate entry '1' for key 't1_c22'
select * from t1;
a b
1 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
insert into t1 values(2,2);
SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml_insert WAIT_FOR start_dml_insert_finish';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR start_dml_insert';
update t1 set b = 1 where a = 2;
select * from t1;
a b
1 1
2 1
delete from t1 where a = 1;
select * from t1;
a b
2 1
SET DEBUG_SYNC= 'now SIGNAL start_dml_insert_finish';
# Switch to connection default
ERROR 23000: Duplicate entry '1' for key 't1_c22'
select * from t1;
a b
2 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
insert into t1 values(1,1);
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';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR d1_dml';
delete from t1 where a = 1;
SET DEBUG_SYNC= 'now SIGNAL d1_dml_end';
SET DEBUG_SYNC= 'now WAIT_FOR d2_dml';
insert into t1 values(2,1);
SET DEBUG_SYNC= 'now SIGNAL d2_dml_end';
# Switch to connection default
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT * FROM t1;
a b
2 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `t1_c22` (`b`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
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';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR d1_dml';
insert into t1 values(1,1);
SET DEBUG_SYNC= 'now SIGNAL d1_dml_end';
SET DEBUG_SYNC= 'now WAIT_FOR d2_dml';
delete from t1 where a = 1;
insert into t1 values(1,1);
SET DEBUG_SYNC= 'now SIGNAL d2_dml_end';
# Switch to connection default
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `t1_c22` (`b`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
SELECT * FROM t1 FORCE INDEX(t1_c22) WHERE b > 0;
a b
1 1
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (a INT primary key, b INT)ENGINE=xengine;
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';
alter table t1 add unique index t1_c22 (b) ,ALGORITHM = INPLACE, LOCK=DEFAULT;
# Switch to connection con1
SET DEBUG_SYNC= 'now WAIT_FOR d1_dml';
insert into t1 values(1,1);
SET DEBUG_SYNC= 'now SIGNAL d1_dml_end';
SET DEBUG_SYNC= 'now WAIT_FOR d2_dml';
update t1 set b = 2 where a = 1;
insert into t1 values(2,1);
SET DEBUG_SYNC= 'now SIGNAL d2_dml_end';
# Switch to connection default
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `t1_c22` (`b`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
SELECT * FROM t1 FORCE INDEX(t1_c22) WHERE b > 0;
a b
2 1
1 2
drop table t1;
###################################################################
case bug #24260836
###################################################################
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');
####
prefix index
####
SET DEBUG_SYNC= 'xengine.inplace_create_sk_scan_base_begin SIGNAL start_dml WAIT_FOR dml_done';
ALTER TABLE t1 ADD UNIQUE KEY pre_uk(b(4)), ADD KEY pre_sk(d(4)), ALGORITHM=INPLACE, LOCK=DEFAULT;
# Switch to dml connection
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;
id b c d
1 1111111 2 1a
2 2222222 4 2b
3 3333333 6 3c
4 3333222 8 3c
SET DEBUG_SYNC= 'now SIGNAL dml_done';
# Switch to connection default
ERROR 23000: Duplicate entry '3333' for key 'pre_uk'
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`b` char(10) COLLATE utf8mb4_general_ci DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` char(10) COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=XENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
SELECT * FROM t1;
id b c d
1 1111111 2 1a
2 2222222 4 2b
3 3333333 6 3c
4 3333222 8 3c
drop table t1;