diff options
author | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2011-03-09 16:06:13 +0100 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2011-03-09 16:06:13 +0100 |
commit | fc6ef378d4e5172d79cac345652dc4fe5535ad69 (patch) | |
tree | cc2031c4469471ad87026ffe741d3e512d7fa7b3 /mysql-test/t/innodb_mysql_sync.test | |
parent | fe12c639b1eae3fe42664f3817a2677795826888 (diff) | |
download | mariadb-git-fc6ef378d4e5172d79cac345652dc4fe5535ad69.tar.gz |
Bug#11815600 [ERROR] INNODB COULD NOT FIND INDEX PRIMARY
KEY NO 0 FOR TABLE IN ERROR LOG
With the changes made by the patches for Bug#11751388 and
Bug#11784056, concurrent reads are allowed while secondary
indexes are created in InnoDB. This means that the metadata
lock on the affected table is not upgraded to exclusive
until the .FRM is updated at the end of ALTER TABLE processing.
The problem was that if this lock upgrade failed for some
reason (e.g. timeout), the index information in the server
and inside InnoDB would be out of sync. This would happen
since the add index operation already was committed inside
InnoDB but the table metadata inside the server had not been
updated yet.
This patch fixes the problem by (for now) reverting the
effects of the patches for Bug#11751388 and Bug#11784056.
Concurrent reads will now again be blocked during creation
of secondary indexes in InnoDB.
Test case added to innodb_mysql_lock.test.
Diffstat (limited to 'mysql-test/t/innodb_mysql_sync.test')
-rw-r--r-- | mysql-test/t/innodb_mysql_sync.test | 227 |
1 files changed, 114 insertions, 113 deletions
diff --git a/mysql-test/t/innodb_mysql_sync.test b/mysql-test/t/innodb_mysql_sync.test index a8925306c70..13c854d6b61 100644 --- a/mysql-test/t/innodb_mysql_sync.test +++ b/mysql-test/t/innodb_mysql_sync.test @@ -152,132 +152,133 @@ disconnect con1; --echo # that implement add_index --echo # ---disable_warnings -DROP DATABASE IF EXISTS db1; -DROP TABLE IF EXISTS t1; ---enable_warnings - -connect(con1,localhost,root); -connect(con2,localhost,root); - ---echo # Test 1: Secondary index, should not block reads (original test case). - ---echo # Connection default -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"; ---echo # Sending: ---send ALTER TABLE db1.t1 ADD INDEX(value) - ---echo # Connection con1 -connection con1; -SET DEBUG_SYNC= "now WAIT_FOR manage"; -# Neither of these two statements should be blocked -USE db1; -SELECT * FROM t1; -SET DEBUG_SYNC= "now SIGNAL query"; - ---echo # Connection default -connection default; ---echo # Reaping: ALTER TABLE db1.t1 ADD INDEX(value) ---reap -DROP DATABASE db1; - ---echo # Test 2: Primary index (implicit), should block reads. - -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"; ---echo # Sending: ---send ALTER TABLE t1 ADD UNIQUE INDEX(a) - ---echo # Connection con1 -connection con1; -SET DEBUG_SYNC= "now WAIT_FOR manage"; -USE test; ---echo # Sending: ---send SELECT * FROM t1 - ---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'; ---source include/wait_condition.inc -SET DEBUG_SYNC= "now SIGNAL query"; - ---echo # Connection default -connection default; ---echo # Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a) ---reap - ---echo # Connection con1 -connection con1; ---echo # Reaping: SELECT * FROM t1 ---reap - ---echo # Test 3: Primary index (explicit), should block reads. - ---echo # Connection default -connection default; -ALTER TABLE t1 DROP INDEX a; -SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; ---echo # Sending: ---send ALTER TABLE t1 ADD PRIMARY KEY (a) - ---echo # Connection con1 -connection con1; -SET DEBUG_SYNC= "now WAIT_FOR manage"; ---echo # Sending: ---send SELECT * FROM t1 - ---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'; ---source include/wait_condition.inc -SET DEBUG_SYNC= "now SIGNAL query"; - ---echo # Connection default -connection default; ---echo # Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a) ---reap - ---echo # Connection con1 -connection con1; ---echo # Reaping: SELECT * FROM t1 ---reap - ---echo # Test 4: Secondary unique index, should not block reads. -# This requires HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE to be supported -# by InnoDB. Adding this flag currently introduces a regression so -# this test is disabled until the regression has been fixed. +--echo # +--echo # DISABLED due to Bug#11815600 +--echo # ---echo # Connection default -connection default; +#--disable_warnings +#DROP DATABASE IF EXISTS db1; +#DROP TABLE IF EXISTS t1; +#--enable_warnings +# +#connect(con1,localhost,root); +#connect(con2,localhost,root); +# +#--echo # Test 1: Secondary index, should not block reads (original test case). +# +#--echo # Connection default +#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"; +#--echo # Sending: +#--send ALTER TABLE db1.t1 ADD INDEX(value) +# +#--echo # Connection con1 +#connection con1; +#SET DEBUG_SYNC= "now WAIT_FOR manage"; +# # Neither of these two statements should be blocked +#USE db1; +#SELECT * FROM t1; +#SET DEBUG_SYNC= "now SIGNAL query"; +# +#--echo # Connection default +#connection default; +#--echo # Reaping: ALTER TABLE db1.t1 ADD INDEX(value) +#--reap +#DROP DATABASE db1; +# +#--echo # Test 2: Primary index (implicit), should block reads. +# +#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"; +#--echo # Sending: +#--send ALTER TABLE t1 ADD UNIQUE INDEX(a) +# +#--echo # Connection con1 +#connection con1; +#SET DEBUG_SYNC= "now WAIT_FOR manage"; +#USE test; +#--echo # Sending: +#--send SELECT * FROM t1 +# +#--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'; +#--source include/wait_condition.inc +#SET DEBUG_SYNC= "now SIGNAL query"; +# +#--echo # Connection default +#connection default; +#--echo # Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a) +#--reap +# +#--echo # Connection con1 +#connection con1; +#--echo # Reaping: SELECT * FROM t1 +#--reap +# +#--echo # Test 3: Primary index (explicit), should block reads. +# +#--echo # Connection default +#connection default; +#ALTER TABLE t1 DROP INDEX a; +#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; +#--echo # Sending: +#--send ALTER TABLE t1 ADD PRIMARY KEY (a) +# +#--echo # Connection con1 +#connection con1; +#SET DEBUG_SYNC= "now WAIT_FOR manage"; +#--echo # Sending: +#--send SELECT * FROM t1 +# +#--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'; +#--source include/wait_condition.inc +#SET DEBUG_SYNC= "now SIGNAL query"; +# +#--echo # Connection default +#connection default; +#--echo # Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a) +#--reap +# +#--echo # Connection con1 +#connection con1; +#--echo # Reaping: SELECT * FROM t1 +#--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"; #--echo # Sending: #--send ALTER TABLE t1 ADD UNIQUE (b) - +# #--echo # Connection con1 #connection con1; #SET DEBUG_SYNC= "now WAIT_FOR manage"; #SELECT * FROM t1; #SET DEBUG_SYNC= "now SIGNAL query"; - +# #--echo # Connection default #connection default; #--echo # Reaping: ALTER TABLE t1 ADD UNIQUE (b) #--reap - -disconnect con1; -disconnect con2; -SET DEBUG_SYNC= "RESET"; -DROP TABLE t1; +# +#disconnect con1; +#disconnect con2; +#SET DEBUG_SYNC= "RESET"; +#DROP TABLE t1; # Check that all connections opened by test cases in this file are really |