Skip to content

Commit

Permalink
main.alter_table_online_debug: remove explicit innodb
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarrior committed Nov 4, 2023
1 parent 23f9e34 commit f7646d8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 34 deletions.
39 changes: 21 additions & 18 deletions mysql-test/main/alter_table_online_debug.result
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set global default_storage_engine= innodb;
set default_storage_engine= innodb;
connect con2, localhost, root,,;
connection default;
Expand Down Expand Up @@ -289,7 +290,7 @@ set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end';
alter table t1 add b int NULL, algorithm= copy, lock= none;
connection con2;
insert into t1 values (1),(2),(3),(4),(5),(6);
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
Got one of the listed errors
select * from t1;
a
1
Expand Down Expand Up @@ -496,6 +497,7 @@ a b UNIX_TIMESTAMP(row_start) UNIX_TIMESTAMP(row_end)
6 77 1.000000 2147483647.999999
alter table t1 drop system versioning, algorithm= copy, lock= none;
ERROR 0A000: LOCK=NONE is not supported. Reason: DROP SYSTEM VERSIONING. Try LOCK=SHARED
drop table t1;
#
# Test ROLLBACK TO SAVEPOINT
#
Expand Down Expand Up @@ -582,7 +584,7 @@ set debug_sync= 'reset';
drop table t1;
drop table t2;
drop table t3;
create table t1 (a char(6), b int) engine=innodb;
create table t1 (a char(6), b int);
insert t1 values ('abcde1',1),('abcde2',2);
set debug_sync= 'now wait_for downgraded';
connection con2;
Expand Down Expand Up @@ -838,7 +840,7 @@ a b
drop table t1;
set debug_sync= 'reset';
## CHECK, UPDATE
create table t1 (a int) engine=innodb;
create table t1 (a int);
insert t1 values (1),(2),(3),(4);
set debug_sync= 'now wait_for downgraded';
connection con2;
Expand All @@ -863,7 +865,7 @@ a
14
drop table t1;
## DEFAULT, UPDATE
create table t1 (a int) engine=innodb;
create table t1 (a int);
insert t1 values (1),(2),(3),(4);
set debug_sync= 'now wait_for downgraded';
connection con2;
Expand Down Expand Up @@ -892,7 +894,7 @@ a b
drop table t1;
set debug_sync= 'reset';
## VCOL + CHECK
create table t1 (a int) engine=innodb;
create table t1 (a int);
insert t1 values (1),(2),(3),(4);
set debug_sync= 'now wait_for downgraded';
connection con2;
Expand Down Expand Up @@ -939,8 +941,8 @@ connection default;
drop table t1;
set debug_sync= reset;
###
create table t1 (a text, unique(a)) engine=innodb;
create table t2 (b text, unique(b)) engine=innodb;
create table t1 (a text, unique(a));
create table t2 (b text, unique(b));
insert into t2 values (null),(null);
set debug_sync= 'now wait_for downgraded';
connection con2;
Expand All @@ -958,7 +960,7 @@ set debug_sync= reset;
#
# MDEV-29038 XA assertions failing in binlog_rollback and binlog_commit
#
create table t (a int) engine=innodb;
create table t (a int);
insert into t values (1);
xa begin 'xid';
set debug_sync= 'now wait_for downgraded';
Expand Down Expand Up @@ -1303,7 +1305,7 @@ drop table t;
# Test that correct fields are marked as explicit:
# Drop a, reorder b, add new column with default.
#
create table t (a int primary key, b int) engine=innodb;
create table t (a int primary key, b int);
insert into t values (1, 1), (2, 2), (3, 3);
set debug_sync= "alter_table_copy_end signal copy wait_for goon";
alter table t drop primary key, drop a,
Expand Down Expand Up @@ -1334,7 +1336,7 @@ c x
3 123456
drop table t;
# Test that all the fields are unpacked.
create table t (a int, b int) engine=innodb;
create table t (a int, b int);
insert into t values (NULL, 123), (NULL, 456);
set debug_sync= "alter_table_copy_end signal copy wait_for goon";
alter table t drop a, add primary key(b), algorithm=copy;
Expand Down Expand Up @@ -1464,7 +1466,7 @@ INSERT iso_levels VALUES (0, "READ UNCOMMITTED"),
(1, "READ COMMITTED"),
(2, "REPEATABLE READ"),
(3, "SERIALIZABLE");
create table t1 (a int, b int, key(b)) engine=innodb;
create table t1 (a int, b int, key(b));
connection con2;
insert into t1 values (1,1),(null,null),(3,3),(4,null),(null,5);
connection default;
Expand All @@ -1477,7 +1479,7 @@ delete from t1 where b is null;
set debug_sync= "now signal goalters";
connection default;
drop table t1;
create table t1 (a int, b int, key(b)) engine=innodb;
create table t1 (a int, b int, key(b));
connection con2;
insert into t1 values (1,1),(null,null),(3,3),(4,null),(null,5);
connection default;
Expand All @@ -1490,7 +1492,7 @@ delete from t1 where b is null;
set debug_sync= "now signal goalters";
connection default;
drop table t1;
create table t1 (a int, b int, key(b)) engine=innodb;
create table t1 (a int, b int, key(b));
connection con2;
insert into t1 values (1,1),(null,null),(3,3),(4,null),(null,5);
connection default;
Expand All @@ -1503,7 +1505,7 @@ delete from t1 where b is null;
set debug_sync= "now signal goalters";
connection default;
drop table t1;
create table t1 (a int, b int, key(b)) engine=innodb;
create table t1 (a int, b int, key(b));
connection con2;
insert into t1 values (1,1),(null,null),(3,3),(4,null),(null,5);
connection default;
Expand All @@ -1520,8 +1522,8 @@ set debug_sync= reset;
drop table iso_levels;
# MDEV-32126 Assertion fails upon online ALTER and binary log enabled
create temporary table tmp (id int, primary key(id)) engine=innodb;
create table t1 (a int, b text) engine=innodb;
create table t2 (a int, b int, c char(8), d text, unique(a)) engine=innodb;
create table t1 (a int, b text);
create table t2 (a int, b int, c char(8), d text, unique(a));
insert into t2 values (1,1,'f','e'),(1000,1000,'c','b');
connection default;
set debug_sync= 'alter_table_online_before_lock signal go_trx wait_for go_alter';
Expand All @@ -1540,7 +1542,7 @@ truncate t2;
set @@binlog_format=mixed;
connection con2;
start transaction;
create temporary table tmp (id int, primary key(id)) engine=innodb;
create temporary table tmp (id int, primary key(id));
insert into t1 values (1, repeat('x',8000)),(2, repeat('x',8000));
update t2 set b = null order by b limit 2;
insert into t1 values (3, repeat('x',8000));
Expand All @@ -1564,7 +1566,7 @@ drop table t1, t2;
set @@binlog_format=default;
set debug_sync= reset;
# MDEV-32444 Data from orphaned XA transaction is lost after online alter
create table t (a int primary key) engine=innodb;
create table t (a int primary key);
insert into t values (1);
# XA commit
set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for go';
Expand Down Expand Up @@ -1673,6 +1675,7 @@ connect con1, localhost, root,,;
connection default;
drop table t;
set debug_sync= reset;
set global default_storage_engine= MyISAM;
disconnect con1;
disconnect con2;
#
Expand Down
36 changes: 20 additions & 16 deletions mysql-test/main/alter_table_online_debug.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_partition.inc
set default_storage_engine= innodb;

let $default_storage_engine= `select @@global.default_storage_engine`;
set global default_storage_engine= innodb;
set default_storage_engine= innodb;
--connect (con2, localhost, root,,)
--connection default

Expand Down Expand Up @@ -368,7 +370,7 @@ alter table t1 add b int NULL, algorithm= copy, lock= none;

--connection con2
--reap
--error ER_DUP_ENTRY
--error ER_DUP_ENTRY,ER_DUP_KEY
insert into t1 values (1),(2),(3),(4),(5),(6);
select * from t1;
set debug_sync= 'now SIGNAL end';
Expand Down Expand Up @@ -629,6 +631,7 @@ alter table t1 drop system versioning, algorithm= copy, lock= none;
#--reap
#show create table t1;
#select * from t1;
drop table t1;

--echo #
--echo # Test ROLLBACK TO SAVEPOINT
Expand Down Expand Up @@ -730,7 +733,7 @@ drop table t3;
#
# Lossy alter, Update_row_log_event cannot find 'abcde2' in the new table
#
create table t1 (a char(6), b int) engine=innodb;
create table t1 (a char(6), b int);
insert t1 values ('abcde1',1),('abcde2',2);
--send set debug_sync= 'now wait_for downgraded'
--connection con2
Expand Down Expand Up @@ -1007,7 +1010,7 @@ drop table t1;
set debug_sync= 'reset';

--echo ## CHECK, UPDATE
create table t1 (a int) engine=innodb;
create table t1 (a int);
insert t1 values (1),(2),(3),(4);
--send set debug_sync= 'now wait_for downgraded'
--connection con2
Expand All @@ -1026,7 +1029,7 @@ select * from t1;
drop table t1;

--echo ## DEFAULT, UPDATE
create table t1 (a int) engine=innodb;
create table t1 (a int);
insert t1 values (1),(2),(3),(4);
--send set debug_sync= 'now wait_for downgraded'
--connection con2
Expand All @@ -1048,7 +1051,7 @@ drop table t1;
set debug_sync= 'reset';

--echo ## VCOL + CHECK
create table t1 (a int) engine=innodb;
create table t1 (a int);
insert t1 values (1),(2),(3),(4);
--send set debug_sync= 'now wait_for downgraded'
--connection con2
Expand Down Expand Up @@ -1097,8 +1100,8 @@ set debug_sync= reset;

--echo ###

create table t1 (a text, unique(a)) engine=innodb;
create table t2 (b text, unique(b)) engine=innodb;
create table t1 (a text, unique(a));
create table t2 (b text, unique(b));
insert into t2 values (null),(null);
--send
set debug_sync= 'now wait_for downgraded';
Expand Down Expand Up @@ -1126,7 +1129,7 @@ set debug_sync= reset;
--echo #
--echo # MDEV-29038 XA assertions failing in binlog_rollback and binlog_commit
--echo #
create table t (a int) engine=innodb;
create table t (a int);
insert into t values (1);
xa begin 'xid';
--send
Expand Down Expand Up @@ -1513,7 +1516,7 @@ drop table t;
--echo # Test that correct fields are marked as explicit:
--echo # Drop a, reorder b, add new column with default.
--echo #
create table t (a int primary key, b int) engine=innodb;
create table t (a int primary key, b int);
insert into t values (1, 1), (2, 2), (3, 3);

set debug_sync= "alter_table_copy_end signal copy wait_for goon";
Expand All @@ -1539,7 +1542,7 @@ select * from t;
drop table t;

--echo # Test that all the fields are unpacked.
create table t (a int, b int) engine=innodb;
create table t (a int, b int);
insert into t values (NULL, 123), (NULL, 456);

set debug_sync= "alter_table_copy_end signal copy wait_for goon";
Expand Down Expand Up @@ -1711,7 +1714,7 @@ while($tx_iso_id) {
dec $tx_iso_id;
let tx_iso= `select level from iso_levels where id = $tx_iso_id`;

create table t1 (a int, b int, key(b)) engine=innodb;
create table t1 (a int, b int, key(b));

--connection con2
insert into t1 values (1,1),(null,null),(3,3),(4,null),(null,5);
Expand All @@ -1738,8 +1741,8 @@ drop table iso_levels;

--echo # MDEV-32126 Assertion fails upon online ALTER and binary log enabled
create temporary table tmp (id int, primary key(id)) engine=innodb;
create table t1 (a int, b text) engine=innodb;
create table t2 (a int, b int, c char(8), d text, unique(a)) engine=innodb;
create table t1 (a int, b text);
create table t2 (a int, b int, c char(8), d text, unique(a));
insert into t2 values (1,1,'f','e'),(1000,1000,'c','b');
--connection default
set debug_sync= 'alter_table_online_before_lock signal go_trx wait_for go_alter';
Expand All @@ -1760,7 +1763,7 @@ truncate t2;
set @@binlog_format=mixed;
--connection con2
start transaction;
create temporary table tmp (id int, primary key(id)) engine=innodb;
create temporary table tmp (id int, primary key(id));
insert into t1 values (1, repeat('x',8000)),(2, repeat('x',8000));
update t2 set b = null order by b limit 2;
insert into t1 values (3, repeat('x',8000));
Expand Down Expand Up @@ -1793,7 +1796,7 @@ set debug_sync= reset;

--echo # MDEV-32444 Data from orphaned XA transaction is lost after online alter

create table t (a int primary key) engine=innodb;
create table t (a int primary key);
insert into t values (1);

--echo # XA commit
Expand Down Expand Up @@ -1919,6 +1922,7 @@ select * from t;
--connection default
drop table t;
set debug_sync= reset;
eval set global default_storage_engine= $default_storage_engine;

--disconnect con1
--disconnect con2
Expand Down

0 comments on commit f7646d8

Please sign in to comment.