Loading mysql-test/r/query_cache_noembeded.result 0 → 100644 +18 −0 Original line number Diff line number Diff line 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; mysql-test/t/query_cache_noembeded.test 0 → 100644 +33 −0 Original line number Diff line number Diff line -- 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; sql/sql_cache.cc +5 −2 Original line number Diff line number Diff line Loading @@ -739,7 +739,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) TABLE_COUNTER_TYPE local_tables; ulong tot_length; DBUG_ENTER("Query_cache::store_query"); if (query_cache_size == 0) if (query_cache_size == 0 || thd->locked_tables) DBUG_VOID_RETURN; if ((local_tables= is_cacheable(thd, thd->query_length, Loading @@ -750,7 +750,10 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) STRUCT_LOCK(&structure_guard_mutex); if (query_cache_size == 0) { STRUCT_UNLOCK(&structure_guard_mutex); DBUG_VOID_RETURN; } DUMP(this); /* Key is query + database + flag */ Loading Loading @@ -874,7 +877,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) byte flags; 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 because tables not opened yet Loading Loading
mysql-test/r/query_cache_noembeded.result 0 → 100644 +18 −0 Original line number Diff line number Diff line 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;
mysql-test/t/query_cache_noembeded.test 0 → 100644 +33 −0 Original line number Diff line number Diff line -- 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;
sql/sql_cache.cc +5 −2 Original line number Diff line number Diff line Loading @@ -739,7 +739,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) TABLE_COUNTER_TYPE local_tables; ulong tot_length; DBUG_ENTER("Query_cache::store_query"); if (query_cache_size == 0) if (query_cache_size == 0 || thd->locked_tables) DBUG_VOID_RETURN; if ((local_tables= is_cacheable(thd, thd->query_length, Loading @@ -750,7 +750,10 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) STRUCT_LOCK(&structure_guard_mutex); if (query_cache_size == 0) { STRUCT_UNLOCK(&structure_guard_mutex); DBUG_VOID_RETURN; } DUMP(this); /* Key is query + database + flag */ Loading Loading @@ -874,7 +877,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) byte flags; 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 because tables not opened yet Loading