block using QC in case of having tables locked by LOCK... (BUG#12385)
This commit is contained in:
parent
518745abd4
commit
1dff783854
18
mysql-test/r/query_cache_noembeded.result
Normal file
18
mysql-test/r/query_cache_noembeded.result
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
set GLOBAL query_cache_size=1355776;
|
||||||
|
reset query cache;
|
||||||
|
flush status;
|
||||||
|
CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY AUTO_INCREMENT ) ENGINE =
|
||||||
|
MyISAM;
|
||||||
|
LOCK TABLE t1 READ LOCAL;
|
||||||
|
INSERT INTO t1 VALUES (), (), ();
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a
|
||||||
|
drop table t1;
|
||||||
|
set GLOBAL query_cache_size=default;
|
33
mysql-test/t/query_cache_noembeded.test
Normal file
33
mysql-test/t/query_cache_noembeded.test
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
-- source include/have_query_cache.inc
|
||||||
|
-- source include/not_embedded.inc
|
||||||
|
|
||||||
|
#
|
||||||
|
# Tests with query cache
|
||||||
|
#
|
||||||
|
set GLOBAL query_cache_size=1355776;
|
||||||
|
|
||||||
|
# Reset query cache variables.
|
||||||
|
|
||||||
|
reset query cache;
|
||||||
|
flush status;
|
||||||
|
|
||||||
|
#
|
||||||
|
# do not use QC if tables locked (BUG#12385)
|
||||||
|
#
|
||||||
|
connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
|
||||||
|
connection root;
|
||||||
|
CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY AUTO_INCREMENT ) ENGINE =
|
||||||
|
MyISAM;
|
||||||
|
LOCK TABLE t1 READ LOCAL;
|
||||||
|
connect (root2,localhost,root,,test,$MASTER_MYPORT,master.sock);
|
||||||
|
connection root2;
|
||||||
|
INSERT INTO t1 VALUES (), (), ();
|
||||||
|
connection root;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
connection root2;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
connection root;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
set GLOBAL query_cache_size=default;
|
@ -739,7 +739,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
|
|||||||
TABLE_COUNTER_TYPE local_tables;
|
TABLE_COUNTER_TYPE local_tables;
|
||||||
ulong tot_length;
|
ulong tot_length;
|
||||||
DBUG_ENTER("Query_cache::store_query");
|
DBUG_ENTER("Query_cache::store_query");
|
||||||
if (query_cache_size == 0)
|
if (query_cache_size == 0 || thd->locked_tables)
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
|
||||||
if ((local_tables= is_cacheable(thd, thd->query_length,
|
if ((local_tables= is_cacheable(thd, thd->query_length,
|
||||||
@ -750,7 +750,10 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
|
|||||||
STRUCT_LOCK(&structure_guard_mutex);
|
STRUCT_LOCK(&structure_guard_mutex);
|
||||||
|
|
||||||
if (query_cache_size == 0)
|
if (query_cache_size == 0)
|
||||||
|
{
|
||||||
|
STRUCT_UNLOCK(&structure_guard_mutex);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
}
|
||||||
DUMP(this);
|
DUMP(this);
|
||||||
|
|
||||||
/* Key is query + database + flag */
|
/* Key is query + database + flag */
|
||||||
@ -874,7 +877,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
|
|||||||
byte flags;
|
byte flags;
|
||||||
DBUG_ENTER("Query_cache::send_result_to_client");
|
DBUG_ENTER("Query_cache::send_result_to_client");
|
||||||
|
|
||||||
if (query_cache_size == 0 ||
|
if (query_cache_size == 0 || thd->locked_tables ||
|
||||||
/*
|
/*
|
||||||
it is not possible to check has_transactions() function of handler
|
it is not possible to check has_transactions() function of handler
|
||||||
because tables not opened yet
|
because tables not opened yet
|
||||||
|
Loading…
x
Reference in New Issue
Block a user