mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug #29644: alter table hangs if records locked in share mode
by long running transaction On Windows opened files can't be deleted. There was a special upgraded lock mode (TL_WRITE instead of TL_WRITE_ALLOW_READ) in ALTER TABLE to make sure nobody has the table opened when deleting the old table in ALTER TABLE. This special mode was causing ALTER TABLE to hang waiting on a lock inside InnoDB. This special lock is no longer necessary as the server is closing the tables it needs to delete in ALTER TABLE. Fixed by removing the special lock. Note that this also reverses the fix for bug 17264 that deals with another consequence of this special lock mode being used.
This commit is contained in:
@ -735,4 +735,27 @@ COUNT(*)
|
||||
3072
|
||||
set @@sort_buffer_size=default;
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
|
||||
INSERT INTO t1 SELECT a + 8 FROM t1;
|
||||
INSERT INTO t1 SELECT a + 16 FROM t1;
|
||||
CREATE PROCEDURE p1 ()
|
||||
BEGIN
|
||||
DECLARE i INT DEFAULT 50;
|
||||
DECLARE cnt INT;
|
||||
START TRANSACTION;
|
||||
ALTER TABLE t1 ENGINE=InnoDB;
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
WHILE (i > 0) DO
|
||||
SET i = i - 1;
|
||||
SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE;
|
||||
END WHILE;
|
||||
COMMIT;
|
||||
END;|
|
||||
CALL p1();
|
||||
CALL p1();
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user