mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -148,3 +148,25 @@ COMMIT;
|
||||
# Connection default
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
#
|
||||
# Bug#11815600 [ERROR] INNODB COULD NOT FIND INDEX PRIMARY
|
||||
# KEY NO 0 FOR TABLE IN ERROR LOG
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# Connection default
|
||||
CREATE TABLE t1 (id INT PRIMARY KEY, value INT) ENGINE = InnoDB;
|
||||
INSERT INTO t1 VALUES (1, 12345);
|
||||
START TRANSACTION;
|
||||
SELECT * FROM t1;
|
||||
id value
|
||||
1 12345
|
||||
# Connection con1
|
||||
SET lock_wait_timeout=1;
|
||||
ALTER TABLE t1 ADD INDEX idx(value);
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
# Connection default
|
||||
SELECT * FROM t1;
|
||||
id value
|
||||
1 12345
|
||||
COMMIT;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user