Commit b9ce8572 authored by unknown's avatar unknown

MDEV-4520: Assertion `0' fails in Query_cache::end_of_result on concurrent...

MDEV-4520: Assertion `0' fails in Query_cache::end_of_result on concurrent drop event and event execution

If there is no net.vio then query cache cant't get data via net_real_write() so it is better just do not try to cache such query.
parent 7ba2ff93
#
# MDEV-4520: Assertion `0' fails in Query_cache::end_of_result on
# concurrent drop event and event execution
#
set GLOBAL query_cache_size=1355776;
create user mysqltest1@localhost;
grant SELECT on test.* to mysqltest1@localhost;
create table t1 (a int);
# This explain put here to be sure that init connection query
# has 'Impossible WHERE'.
explain extended select * from test.t1 where 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost;
drop table t1;
set GLOBAL query_cache_size=default;
--init_connect="select * from test.t1 where 0"
-- source include/have_query_cache.inc
--echo #
--echo # MDEV-4520: Assertion `0' fails in Query_cache::end_of_result on
--echo # concurrent drop event and event execution
--echo #
set GLOBAL query_cache_size=1355776;
create user mysqltest1@localhost;
grant SELECT on test.* to mysqltest1@localhost;
create table t1 (a int);
connect (con1,localhost,mysqltest1,,);
connection con1;
--echo # This explain put here to be sure that init connection query
--echo # has 'Impossible WHERE'.
explain extended select * from test.t1 where 0;
connection default;
disconnect con1;
revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost;
drop table t1;
set GLOBAL query_cache_size=default;
...@@ -4000,7 +4000,8 @@ Query_cache::is_cacheable(THD *thd, LEX *lex, ...@@ -4000,7 +4000,8 @@ Query_cache::is_cacheable(THD *thd, LEX *lex,
if (thd->lex->safe_to_cache_query && if (thd->lex->safe_to_cache_query &&
(thd->variables.query_cache_type == 1 || (thd->variables.query_cache_type == 1 ||
(thd->variables.query_cache_type == 2 && (lex->select_lex.options & (thd->variables.query_cache_type == 2 && (lex->select_lex.options &
OPTION_TO_QUERY_CACHE)))) OPTION_TO_QUERY_CACHE))) &&
thd->net.vio)
{ {
DBUG_PRINT("qcache", ("options: %lx %lx type: %u", DBUG_PRINT("qcache", ("options: %lx %lx type: %u",
(long) OPTION_TO_QUERY_CACHE, (long) OPTION_TO_QUERY_CACHE,
...@@ -4022,11 +4023,12 @@ Query_cache::is_cacheable(THD *thd, LEX *lex, ...@@ -4022,11 +4023,12 @@ Query_cache::is_cacheable(THD *thd, LEX *lex,
} }
DBUG_PRINT("qcache", DBUG_PRINT("qcache",
("not interesting query: %d or not cacheable, options %lx %lx type: %u", ("not interesting query: %d or not cacheable, options %lx %lx type: %u net->vio present: %u",
(int) lex->sql_command, (int) lex->sql_command,
(long) OPTION_TO_QUERY_CACHE, (long) OPTION_TO_QUERY_CACHE,
(long) lex->select_lex.options, (long) lex->select_lex.options,
(int) thd->variables.query_cache_type)); (int) thd->variables.query_cache_type,
(uint) test(thd->net.vio)));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -4579,7 +4579,7 @@ void xid_cache_delete(XID_STATE *xid_state) ...@@ -4579,7 +4579,7 @@ void xid_cache_delete(XID_STATE *xid_state)
int THD::decide_logging_format(TABLE_LIST *tables) int THD::decide_logging_format(TABLE_LIST *tables)
{ {
DBUG_ENTER("THD::decide_logging_format"); DBUG_ENTER("THD::decide_logging_format");
DBUG_PRINT("info", ("query: %s", query())); DBUG_PRINT("info", ("Query: %s", query()));
DBUG_PRINT("info", ("variables.binlog_format: %lu", DBUG_PRINT("info", ("variables.binlog_format: %lu",
variables.binlog_format)); variables.binlog_format));
DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags(): 0x%x", DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags(): 0x%x",
......
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