Commit 2492d007 authored by Sergei Golubchik's avatar Sergei Golubchik

fix innodb_mysql_sync test - update from 5.6

parent cf039ec1
......@@ -101,7 +101,7 @@ DROP TABLE IF EXISTS t1;
CREATE DATABASE db1;
CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb;
INSERT INTO db1.t1(value) VALUES (1), (2);
SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
# Sending:
ALTER TABLE db1.t1 ADD INDEX(value);
# Connection con1
......@@ -115,45 +115,47 @@ SET DEBUG_SYNC= "now SIGNAL query";
# Connection default
# Reaping: ALTER TABLE db1.t1 ADD INDEX(value)
DROP DATABASE db1;
# Test 2: Primary index (implicit), should block reads.
# Test 2: Primary index (implicit), should block writes.
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
# Sending:
ALTER TABLE t1 ADD UNIQUE INDEX(a);
ALTER TABLE t1 ADD UNIQUE INDEX(a), LOCK=SHARED;
# Connection con1
SET DEBUG_SYNC= "now WAIT_FOR manage";
USE test;
# Sending:
SELECT * FROM t1;
a b
# Sending:
UPDATE t1 SET a=NULL;
# Connection con2
# Waiting for SELECT to be blocked by the metadata lock on t1
SET DEBUG_SYNC= "now SIGNAL query";
# Connection default
# Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a)
# Connection con1
# Reaping: SELECT * FROM t1
a b
# Test 3: Primary index (explicit), should block reads.
# Reaping: UPDATE t1 SET a=NULL
# Test 3: Primary index (explicit), should block writes.
# Connection default
ALTER TABLE t1 DROP INDEX a;
SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
# Sending:
ALTER TABLE t1 ADD PRIMARY KEY (a);
ALTER TABLE t1 ADD PRIMARY KEY (a), LOCK=SHARED;
# Connection con1
SET DEBUG_SYNC= "now WAIT_FOR manage";
# Sending:
SELECT * FROM t1;
a b
# Sending:
UPDATE t1 SET a=NULL;
# Connection con2
# Waiting for SELECT to be blocked by the metadata lock on t1
SET DEBUG_SYNC= "now SIGNAL query";
# Connection default
# Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a)
# Connection con1
# Reaping: SELECT * FROM t1
a b
# Reaping: UPDATE t1 SET a=NULL
# Test 4: Secondary unique index, should not block reads.
# Connection default
SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
# Sending:
ALTER TABLE t1 ADD UNIQUE (b);
# Connection con1
......@@ -186,3 +188,170 @@ a b
1 12345
2 23456
DROP TABLE t1;
#
# Bug#13417754 ASSERT IN ROW_DROP_DATABASE_FOR_MYSQL DURING DROP SCHEMA
#
DROP TABLE IF EXISTS t1;
DROP DATABASE IF EXISTS db1;
CREATE TABLE t1(a int) engine=InnoDB;
CREATE DATABASE db1;
# Connection con1
SET DEBUG_SYNC= 'after_innobase_rename_table SIGNAL locked WAIT_FOR continue';
# Sending:
ALTER TABLE t1 RENAME db1.t1;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# DROP DATABASE db1 should now be blocked by ALTER TABLE
# Sending:
DROP DATABASE db1;
# Connection default
# Check that DROP DATABASE is blocked by IX lock on db1
# Resume ALTER TABLE
SET DEBUG_SYNC= 'now SIGNAL continue';
# Connection con1
# Reaping: ALTER TABLE t1 RENAME db1.t1;
# Connection con2
# Reaping: DROP DATABASE db1
# Connection default;
SET DEBUG_SYNC= 'RESET';
#
# WL#5534 Online ALTER, Phase 1
#
# Multi thread tests.
# See alter_table.test for single thread tests.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT PRIMARY KEY, b INT) engine=InnoDB;
INSERT INTO t1 VALUES (1,1), (2,2);
SET DEBUG_SYNC= 'RESET';
SET SESSION lock_wait_timeout= 1;
#
# 1: In-place + writes blocked.
#
# Connection default
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue3';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue4';
# Sending:
ALTER TABLE t1 ADD INDEX i1(b), ALGORITHM= INPLACE, LOCK= SHARED;
# Connection con1;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# At this point, neither reads nor writes should be blocked.
SELECT * FROM t1;
a b
1 1
2 2
INSERT INTO t1 VALUES (3,3);
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
# Now both reads and writes should be blocked
SELECT * FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES (4,4);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
# Still both reads and writes should be blocked.
SELECT * FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES (5,5);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue3';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
# Same here.
SELECT * FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES (6,6);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue4';
# Connection default
# Reaping ALTER TABLE ...
SET DEBUG_SYNC= 'RESET';
DELETE FROM t1 WHERE a= 3;
#
# 2: Copy + writes blocked.
#
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue3';
# Sending:
ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= COPY, LOCK= SHARED;
# Connection con1;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# At this point, neither reads nor writes should be blocked.
SELECT * FROM t1;
a b
1 1
2 2
INSERT INTO t1 VALUES (3,3);
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
# Now writes should be blocked, reads still allowed.
SELECT * FROM t1;
a b
1 1
2 2
3 3
INSERT INTO t1 VALUES (4,4);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
# Now both reads and writes should be blocked.
SELECT * FROM t1 limit 1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES (5,5);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue3';
# Connection default
# Reaping ALTER TABLE ...
SET DEBUG_SYNC= 'RESET';
DELETE FROM t1 WHERE a= 3;
#
# 3: In-place + writes allowed.
#
# TODO: Enable this test once WL#5526 is pushed
#
# 4: In-place + reads and writes blocked.
#
# Connection default
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue3';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue4';
# Sending:
ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
# Connection con1;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# At this point, neither reads nor writes should be blocked.
SELECT * FROM t1;
a b
1 1
2 2
INSERT INTO t1 VALUES (3,3);
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
# Now both reads and writes should be blocked.
SELECT * FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES (4,4);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
# Same here.
SELECT * FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES (5,5);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue3';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
# Same here.
SELECT * FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES (6,6);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue4';
# Connection default
# Reaping ALTER TABLE ...
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
......@@ -168,7 +168,7 @@ connection default;
CREATE DATABASE db1;
CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb;
INSERT INTO db1.t1(value) VALUES (1), (2);
SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
--echo # Sending:
--send ALTER TABLE db1.t1 ADD INDEX(value)
......@@ -186,26 +186,27 @@ connection default;
--reap
DROP DATABASE db1;
--echo # Test 2: Primary index (implicit), should block reads.
--echo # Test 2: Primary index (implicit), should block writes.
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
--echo # Sending:
--send ALTER TABLE t1 ADD UNIQUE INDEX(a)
--send ALTER TABLE t1 ADD UNIQUE INDEX(a), LOCK=SHARED
--echo # Connection con1
connection con1;
SET DEBUG_SYNC= "now WAIT_FOR manage";
USE test;
SELECT * FROM t1;
--echo # Sending:
--send SELECT * FROM t1
--send UPDATE t1 SET a=NULL
--echo # Connection con2
connection con2;
--echo # Waiting for SELECT to be blocked by the metadata lock on t1
let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
WHERE state= 'Waiting for table metadata lock'
AND info='SELECT * FROM t1';
AND info='UPDATE t1 SET a=NULL';
--source include/wait_condition.inc
SET DEBUG_SYNC= "now SIGNAL query";
......@@ -216,30 +217,31 @@ connection default;
--echo # Connection con1
connection con1;
--echo # Reaping: SELECT * FROM t1
--echo # Reaping: UPDATE t1 SET a=NULL
--reap
--echo # Test 3: Primary index (explicit), should block reads.
--echo # Test 3: Primary index (explicit), should block writes.
--echo # Connection default
connection default;
ALTER TABLE t1 DROP INDEX a;
SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
--echo # Sending:
--send ALTER TABLE t1 ADD PRIMARY KEY (a)
--send ALTER TABLE t1 ADD PRIMARY KEY (a), LOCK=SHARED
--echo # Connection con1
connection con1;
SET DEBUG_SYNC= "now WAIT_FOR manage";
SELECT * FROM t1;
--echo # Sending:
--send SELECT * FROM t1
--send UPDATE t1 SET a=NULL
--echo # Connection con2
connection con2;
--echo # Waiting for SELECT to be blocked by the metadata lock on t1
let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
WHERE state= 'Waiting for table metadata lock'
AND info='SELECT * FROM t1';
AND info='UPDATE t1 SET a=NULL';
--source include/wait_condition.inc
SET DEBUG_SYNC= "now SIGNAL query";
......@@ -250,14 +252,14 @@ connection default;
--echo # Connection con1
connection con1;
--echo # Reaping: SELECT * FROM t1
--echo # Reaping: UPDATE t1 SET a=NULL
--reap
--echo # Test 4: Secondary unique index, should not block reads.
--echo # Connection default
connection default;
SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
--echo # Sending:
--send ALTER TABLE t1 ADD UNIQUE (b)
......@@ -304,6 +306,292 @@ DROP TABLE t1;
disconnect con1;
--echo #
--echo # Bug#13417754 ASSERT IN ROW_DROP_DATABASE_FOR_MYSQL DURING DROP SCHEMA
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP DATABASE IF EXISTS db1;
--enable_warnings
CREATE TABLE t1(a int) engine=InnoDB;
CREATE DATABASE db1;
connect(con1, localhost, root);
connect(con2, localhost, root);
--echo # Connection con1
connection con1;
SET DEBUG_SYNC= 'after_innobase_rename_table SIGNAL locked WAIT_FOR continue';
--echo # Sending:
--send ALTER TABLE t1 RENAME db1.t1
--echo # Connection con2
connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # DROP DATABASE db1 should now be blocked by ALTER TABLE
--echo # Sending:
--send DROP DATABASE db1
--echo # Connection default
connection default;
--echo # Check that DROP DATABASE is blocked by IX lock on db1
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for schema metadata lock" and
info = "DROP DATABASE db1";
--source include/wait_condition.inc
--echo # Resume ALTER TABLE
SET DEBUG_SYNC= 'now SIGNAL continue';
--echo # Connection con1
connection con1;
--echo # Reaping: ALTER TABLE t1 RENAME db1.t1;
--reap
--echo # Connection con2
connection con2;
--echo # Reaping: DROP DATABASE db1
--reap
--echo # Connection default;
connection default;
SET DEBUG_SYNC= 'RESET';
disconnect con1;
disconnect con2;
--echo #
--echo # WL#5534 Online ALTER, Phase 1
--echo #
--echo # Multi thread tests.
--echo # See alter_table.test for single thread tests.
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1(a INT PRIMARY KEY, b INT) engine=InnoDB;
INSERT INTO t1 VALUES (1,1), (2,2);
SET DEBUG_SYNC= 'RESET';
connect (con1, localhost, root);
SET SESSION lock_wait_timeout= 1;
--echo #
--echo # 1: In-place + writes blocked.
--echo #
--echo # Connection default
--connection default
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue3';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue4';
--echo # Sending:
--send ALTER TABLE t1 ADD INDEX i1(b), ALGORITHM= INPLACE, LOCK= SHARED
--echo # Connection con1;
--connection con1
SET DEBUG_SYNC= 'now WAIT_FOR opened';
--echo # At this point, neither reads nor writes should be blocked.
SELECT * FROM t1;
INSERT INTO t1 VALUES (3,3);
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
--echo # Now both reads and writes should be blocked
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (4,4);
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
--echo # Still both reads and writes should be blocked.
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (5,5);
SET DEBUG_SYNC= 'now SIGNAL continue3';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
--echo # Same here.
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (6,6);
SET DEBUG_SYNC= 'now SIGNAL continue4';
--echo # Connection default
--connection default
--echo # Reaping ALTER TABLE ...
--reap
SET DEBUG_SYNC= 'RESET';
DELETE FROM t1 WHERE a= 3;
--echo #
--echo # 2: Copy + writes blocked.
--echo #
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue3';
--echo # Sending:
--send ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= COPY, LOCK= SHARED
--echo # Connection con1;
--connection con1
SET DEBUG_SYNC= 'now WAIT_FOR opened';
--echo # At this point, neither reads nor writes should be blocked.
SELECT * FROM t1;
INSERT INTO t1 VALUES (3,3);
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
--echo # Now writes should be blocked, reads still allowed.
SELECT * FROM t1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (4,4);
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
--echo # Now both reads and writes should be blocked.
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1 limit 1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (5,5);
SET DEBUG_SYNC= 'now SIGNAL continue3';
--echo # Connection default
--connection default
--echo # Reaping ALTER TABLE ...
--reap
SET DEBUG_SYNC= 'RESET';
DELETE FROM t1 WHERE a= 3;
--echo #
--echo # 3: In-place + writes allowed.
--echo #
--echo # TODO: Enable this test once WL#5526 is pushed
--disable_parsing
--echo # Connection default
--connection default
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue3';
SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue4';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue5';
--echo # Sending:
--send ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= INPLACE, LOCK= NONE
--echo # Connection con1;
--connection con1
SET DEBUG_SYNC= 'now WAIT_FOR opened';
--echo # At this point, neither reads nor writes should be blocked.
SELECT * FROM t1;
INSERT INTO t1 VALUES (3,3);
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
--echo # Now writes should be blocked, reads still allowed.
SELECT * FROM t1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (4,4);
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
--echo # Now writes should be allowed again.
SELECT * FROM t1;
INSERT INTO t1 VALUES (5,5);
SET DEBUG_SYNC= 'now SIGNAL continue3';
SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
--echo # Now both reads and writes should be blocked.
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (6,6);
SET DEBUG_SYNC= 'now SIGNAL continue4';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
--echo # Same here.
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (7,7);
SET DEBUG_SYNC= 'now SIGNAL continue5';
--echo # Connection default
--connection default
--echo # Reaping ALTER TABLE ...
--reap
SET DEBUG_SYNC= 'RESET';
DELETE FROM t1 WHERE a= 3 OR a= 4;
--echo # TODO: Enable this test once WL#5526 is pushed
--enable_parsing
--echo #
--echo # 4: In-place + reads and writes blocked.
--echo #
--echo # Connection default
--connection default
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue3';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue4';
--echo # Sending:
--send ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE, LOCK= EXCLUSIVE
--echo # Connection con1;
--connection con1
SET DEBUG_SYNC= 'now WAIT_FOR opened';
--echo # At this point, neither reads nor writes should be blocked.
SELECT * FROM t1;
INSERT INTO t1 VALUES (3,3);
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
--echo # Now both reads and writes should be blocked.
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (4,4);
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
--echo # Same here.
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (5,5);
SET DEBUG_SYNC= 'now SIGNAL continue3';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
--echo # Same here.
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t1;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES (6,6);
SET DEBUG_SYNC= 'now SIGNAL continue4';
--echo # Connection default
--connection default
--echo # Reaping ALTER TABLE ...
--reap
SET DEBUG_SYNC= 'RESET';
--connection default
--disconnect con1
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment