Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-29676 Add query to set lock wait timeout when getting sts crd
Set the lock wait timeout to 1 beforehand, and reset it afterwards, to avoid lock conflict caused by opening the same table twice in case of self-reference.
- Loading branch information
1 parent
779307d
commit 6abafdb
Showing
9 changed files
with
188 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
wait_timeout : MDEV-26045 | ||
mdev_29676 : MDEV-31138 |
47 changes: 47 additions & 0 deletions
47
storage/spider/mysql-test/spider/bugfix/r/mdev_29676.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# | ||
# MDEV-29676 Dual thread hang in 'closing tables' and 'Waiting for table metadata lock' on Spider CREATE OR REPLACE TABLE | ||
# | ||
for master_1 | ||
for child2 | ||
for child3 | ||
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); | ||
|
||
# length-0 self-reference | ||
|
||
CREATE TABLE t (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t"'; | ||
CREATE OR REPLACE TABLE t (c INT); | ||
Warnings: | ||
Error 1205 Lock wait timeout exceeded; try restarting transaction | ||
Error 12722 Table test.t open lock wait timeout. Please check for self-reference. | ||
SHOW CREATE TABLE t; | ||
Table Create Table | ||
t CREATE TABLE `t` ( | ||
`c` int(11) DEFAULT NULL | ||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci | ||
DROP TABLE t; | ||
|
||
# length-2 self-reference | ||
|
||
CREATE TABLE t2 (c int); | ||
CREATE TABLE t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; | ||
CREATE TABLE t0 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t1"'; | ||
ALTER TABLE t2 ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t0"'; | ||
CREATE OR REPLACE TABLE t0 (c int); | ||
Warnings: | ||
Error 1205 Lock wait timeout exceeded; try restarting transaction | ||
Error 12722 Table test.t1 open lock wait timeout. Please check for self-reference. | ||
SHOW CREATE TABLE t0; | ||
Table Create Table | ||
t0 CREATE TABLE `t0` ( | ||
`c` int(11) DEFAULT NULL | ||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci | ||
CREATE OR REPLACE TABLE t1 (c int); | ||
SHOW CREATE TABLE t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`c` int(11) DEFAULT NULL | ||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci | ||
drop TABLE t0, t1, t2; | ||
for master_1 | ||
for child2 | ||
for child3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--echo # | ||
--echo # MDEV-29676 Dual thread hang in 'closing tables' and 'Waiting for table metadata lock' on Spider CREATE OR REPLACE TABLE | ||
--echo # | ||
|
||
--disable_query_log | ||
--disable_result_log | ||
--source ../../t/test_init.inc | ||
--enable_result_log | ||
--enable_query_log | ||
|
||
--replace_regex /SOCKET ".*"/SOCKET "$MASTER_1_MYSOCK"/ | ||
eval CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); | ||
|
||
--echo | ||
--echo # length-0 self-reference | ||
--echo | ||
CREATE TABLE t (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t"'; | ||
CREATE OR REPLACE TABLE t (c INT); | ||
SHOW CREATE TABLE t; | ||
DROP TABLE t; | ||
|
||
--echo | ||
--echo # length-2 self-reference | ||
--echo | ||
CREATE TABLE t2 (c int); | ||
CREATE TABLE t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; | ||
CREATE TABLE t0 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t1"'; | ||
ALTER TABLE t2 ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t0"'; | ||
# warnings | ||
CREATE OR REPLACE TABLE t0 (c int); | ||
SHOW CREATE TABLE t0; | ||
# no warnings | ||
CREATE OR REPLACE TABLE t1 (c int); | ||
SHOW CREATE TABLE t1; | ||
drop TABLE t0, t1, t2; | ||
|
||
--disable_query_log | ||
--disable_result_log | ||
--source ../../t/test_deinit.inc | ||
--enable_result_log | ||
--enable_query_log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters