Commit e6ce97a5 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-12951 Server crash [mysqld got exception 0xc0000005]

Same as MDEV-12725 but for federated (not X).
Set and reset mysql.net->thd appropriately.
parent e78712d4
set global query_cache_size= 16*1024*1024;
set global query_cache_type= 1;
create table t1 (i int) engine=innodb;
create table t2 (i int) engine=federated
CONNECTION="mysql://root@localhost:MASTER_MYPORT/test/t1";
select * from t2;
i
drop table t2;
drop table t1;
set global query_cache_type= default;
set global query_cache_size= default;
#
# MDEV-12951 Server crash [mysqld got exception 0xc0000005]
#
--source include/have_innodb.inc
set global query_cache_size= 16*1024*1024;
set global query_cache_type= 1;
create table t1 (i int) engine=innodb;
--replace_result $MASTER_MYPORT MASTER_MYPORT
eval create table t2 (i int) engine=federated
CONNECTION="mysql://root@localhost:$MASTER_MYPORT/test/t1";
select * from t2;
source include/restart_mysqld.inc;
drop table t2;
drop table t1;
set global query_cache_type= default;
set global query_cache_size= default;
...@@ -2980,6 +2980,9 @@ int ha_federated::reset(void) ...@@ -2980,6 +2980,9 @@ int ha_federated::reset(void)
} }
reset_dynamic(&results); reset_dynamic(&results);
if (mysql)
mysql->net.thd= NULL;
return 0; return 0;
} }
...@@ -3200,12 +3203,14 @@ int ha_federated::real_query(const char *query, size_t length) ...@@ -3200,12 +3203,14 @@ int ha_federated::real_query(const char *query, size_t length)
int rc= 0; int rc= 0;
DBUG_ENTER("ha_federated::real_query"); DBUG_ENTER("ha_federated::real_query");
if (!mysql && (rc= real_connect())) if (!query || !length)
goto end; goto end;
if (!query || !length) if (!mysql && (rc= real_connect()))
goto end; goto end;
mysql->net.thd= table->in_use;
rc= mysql_real_query(mysql, query, (uint) length); rc= mysql_real_query(mysql, query, (uint) length);
end: end:
......
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