summaryrefslogtreecommitdiff
path: root/mysql-test/t/truncate_coverage.test
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 /mysql-test/t/truncate_coverage.test
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.
Diffstat (limited to 'mysql-test/t/truncate_coverage.test')
-rw-r--r--mysql-test/t/truncate_coverage.test20
1 files changed, 15 insertions, 5 deletions
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';