summaryrefslogtreecommitdiff
path: root/mysql-test/t/query_cache_debug.test
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-04-30 16:12:41 +0400
committerAlexander Nozdrin <alik@sun.com>2010-04-30 16:12:41 +0400
commit63e6005ac40e5aa894e770287d8bcf45aa9f5198 (patch)
treec8ef1f1345cfa63c1ebd524afef056504896b4ab /mysql-test/t/query_cache_debug.test
parent37074b61084606a73fe07ccb5ce801e6ac259c71 (diff)
downloadmariadb-git-63e6005ac40e5aa894e770287d8bcf45aa9f5198.tar.gz
Patch for Bug#52356: query_cache_debug fails on Linux.
There were two problems here: 1. misleading error message 2. abusing KILL QUERY in the test case 1. The server reported "'DELETE FROM t1' failed: 1689: Wait on a lock was aborted due to a pending exclusive lock", while the proper error message should be "'DELETE FROM t1' failed: 1317: Query execution was interrupted". The problem is that the server has two different flags for signalling that a query is being killed: THD::killed and mysys_var::abort. The test case triggers a race: sometimes mysys_var::abort is set earlier than THD::killed. That leads to the following situation: - thr_lock() checks mysys_var::abort and returns error status, since mysys_var::abort is set; - the caller (mysql_lock_tables()) gets an error from thr_lock(), but THD::killed is not set, so it decides that thr_lock() couldn't get a lock due to a pending exclusive lock. This is a known issue with the server and it's not going to be fixed soon. 5.5 differs from 5.1 here as follows: when thr_lock() returns an error: - 5.1 continues trying thr_lock() until success; - 5.5 propagates the error 2. The test case uses KILL QUERY is a highly concurent environment. The fix is to wait for the dying statement to rest in peace before executing another DELETE FROM t1.
Diffstat (limited to 'mysql-test/t/query_cache_debug.test')
-rw-r--r--mysql-test/t/query_cache_debug.test3
1 files changed, 3 insertions, 0 deletions
diff --git a/mysql-test/t/query_cache_debug.test b/mysql-test/t/query_cache_debug.test
index d30cd458e99..ce62b931a93 100644
--- a/mysql-test/t/query_cache_debug.test
+++ b/mysql-test/t/query_cache_debug.test
@@ -221,6 +221,9 @@ KILL QUERY @thread_id;
SELECT SQL_NO_CACHE id FROM information_schema.processlist WHERE state='wait_in_query_cache_invalidate2' LIMIT 1 INTO @flush_thread_id;
KILL QUERY @flush_thread_id;
+LET $wait_condition= SELECT SQL_NO_CACHE COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE Id = @flush_thread_id AND Command = 'Sleep';
+--source include/wait_condition.inc
+
--echo **
--echo *************************************************************************
--echo ** No tables should be locked