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

Same as MDEV-12725 but for federated (not X).
Set and reset mysql.net->thd appropriately.
This commit is contained in:
Sergei Golubchik 2017-09-13 21:02:44 +02:00
parent e78712d464
commit e6ce97a592
3 changed files with 41 additions and 2 deletions

View file

@ -0,0 +1,11 @@
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;

View file

@ -0,0 +1,23 @@
#
# 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;

View file

@ -2980,6 +2980,9 @@ int ha_federated::reset(void)
}
reset_dynamic(&results);
if (mysql)
mysql->net.thd= NULL;
return 0;
}
@ -3200,11 +3203,13 @@ int ha_federated::real_query(const char *query, size_t length)
int rc= 0;
DBUG_ENTER("ha_federated::real_query");
if (!query || !length)
goto end;
if (!mysql && (rc= real_connect()))
goto end;
if (!query || !length)
goto end;
mysql->net.thd= table->in_use;
rc= mysql_real_query(mysql, query, (uint) length);