summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Lenev <dlenev@mysql.com>2010-06-11 17:32:12 +0400
committerDmitry Lenev <dlenev@mysql.com>2010-06-11 17:32:12 +0400
commita6cfec17e5bceb298e09dc0474597f1ee4593652 (patch)
treee783a27fb35779b893187e59059a4eac34603ac5
parent262bf59a2dc7ca1eed75f0e1ec93ec5e5182f2f9 (diff)
downloadmariadb-git-a6cfec17e5bceb298e09dc0474597f1ee4593652.tar.gz
Fix for bug #46785 "main.truncate_coverage fails
sporadically". Races in truncate_coverage.test have caused its sporadical failures. In the test case we have tried to kill truncate statement being executed in the first connection which was waiting for X metadata lock on table being locked by the second connection. Since we have released metadata lock held by the second connection right after issuing KILL statement sometimes TRUNCATE TABLE managed to acquire X lock before it has noticed that it was killed. In this case TRUNCATE TABLE was successfully executed till its end and this fact has caused test failure since this statement didn't return expected error in such case. This patch addresses the problem by not releasing metadata locks in the second connections prematurely.
-rw-r--r--mysql-test/r/truncate_coverage.result13
-rw-r--r--mysql-test/t/truncate_coverage.test20
2 files changed, 25 insertions, 8 deletions
diff --git a/mysql-test/r/truncate_coverage.result b/mysql-test/r/truncate_coverage.result
index 7a5021f55e2..a7a4b9c70f4 100644
--- a/mysql-test/r/truncate_coverage.result
+++ b/mysql-test/r/truncate_coverage.result
@@ -18,13 +18,15 @@ TRUNCATE TABLE t1;
SET DEBUG_SYNC='now WAIT_FOR waiting';
KILL QUERY @id;
#
+# connection default
+ERROR 70100: Query execution was interrupted
+UNLOCK TABLES;
+#
# connection con1
# Release shared metadata lock by closing HANDLER.
HANDLER t1 CLOSE;
#
# connection default
-ERROR 70100: Query execution was interrupted
-UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
CREATE TABLE t1 (c1 INT);
@@ -64,10 +66,15 @@ TRUNCATE TABLE t1;
# connection con1
SET DEBUG_SYNC='now WAIT_FOR waiting';
KILL QUERY @id;
-COMMIT;
#
# connection default
ERROR 70100: Query execution was interrupted
+#
+# connection con1
+# Release SW lock by committing transaction.
+COMMIT;
+#
+# connection default
UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
diff --git a/mysql-test/t/truncate_coverage.test b/mysql-test/t/truncate_coverage.test
index b7c08b03c8b..c9c4bd90ca4 100644
--- a/mysql-test/t/truncate_coverage.test
+++ b/mysql-test/t/truncate_coverage.test
@@ -55,6 +55,12 @@ let $invisible_assignment_in_select = `SELECT @id := $ID`;
KILL QUERY @id;
--disconnect con2
--echo #
+--echo # connection default
+--connection default
+--error ER_QUERY_INTERRUPTED
+reap;
+UNLOCK TABLES;
+--echo #
--echo # connection con1
--connection con1
--echo # Release shared metadata lock by closing HANDLER.
@@ -63,9 +69,6 @@ HANDLER t1 CLOSE;
--echo #
--echo # connection default
--connection default
---error ER_QUERY_INTERRUPTED
-reap;
-UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
########
@@ -151,13 +154,20 @@ send TRUNCATE TABLE t1;
SET DEBUG_SYNC='now WAIT_FOR waiting';
let $invisible_assignment_in_select = `SELECT @id := $ID`;
KILL QUERY @id;
-COMMIT;
---disconnect con1
--echo #
--echo # connection default
--connection default
--error ER_QUERY_INTERRUPTED
reap;
+--echo #
+--echo # connection con1
+--connection con1
+--echo # Release SW lock by committing transaction.
+COMMIT;
+--disconnect con1
+--echo #
+--echo # connection default
+--connection default
UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';