1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-20 10:24:14 +03:00
Files
mariadb/mysql-test/suite/innodb/t/instant_alter_purge.test
2020-10-29 13:38:38 +02:00

77 lines
1.8 KiB
Plaintext

--source include/have_innodb.inc
--source include/maybe_debug.inc
if ($have_debug) {
--source include/have_debug_sync.inc
}
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
--echo #
--echo # MDEV-17793 Crash in purge after instant DROP and emptying the table
--echo #
connect (prevent_purge,localhost,root);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
CREATE TABLE t1 (f1 INT, f2 INT) ENGINE=InnoDB;
INSERT INTO t1 () VALUES ();
ALTER TABLE t1 DROP f2, ADD COLUMN f2 INT;
ALTER TABLE t1 DROP f1;
DELETE FROM t1;
connection prevent_purge;
COMMIT;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
ALTER TABLE t1 ADD COLUMN extra TINYINT UNSIGNED NOT NULL DEFAULT 42;
let $wait_all_purged= 1;
--source include/wait_all_purged.inc
ALTER TABLE t1 DROP extra;
disconnect prevent_purge;
let $wait_all_purged= 0;
--source include/wait_all_purged.inc
DROP TABLE t1;
--echo #
--echo # MDEV-17813 Crash in instant ALTER TABLE due to purge
--echo # concurrently emptying table
--echo #
CREATE TABLE t1 (f2 INT) ENGINE=InnoDB;
INSERT INTO t1 SET f2=1;
ALTER TABLE t1 ADD COLUMN f1 INT;
connect (purge_control,localhost,root);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
DELETE FROM t1;
if ($have_debug) {
SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL go WAIT_FOR do';
}
send ALTER TABLE t1 ADD COLUMN f3 INT;
connection purge_control;
if ($have_debug) {
SET DEBUG_SYNC='now WAIT_FOR go';
}
COMMIT;
SET GLOBAL innodb_max_purge_lag_wait= 0;
if ($have_debug) {
--source include/wait_all_purged.inc
SET DEBUG_SYNC='now SIGNAL do';
}
disconnect purge_control;
connection default;
reap;
if ($have_debug) {
SET DEBUG_SYNC=RESET;
}
DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;