Commit a6cfec17 authored by Dmitry Lenev's avatar Dmitry Lenev

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.
parent 262bf59a
......@@ -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';
......@@ -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';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment