Commit 436ccb69 authored by Davi Arnaut's avatar Davi Arnaut

Manual merge.

parents b29966b0 e218ac06
--loose-debug=d,simulate_detached_thread_refresh
CREATE DATABASE federated;
CREATE DATABASE federated;
#
# Bug#47525: MySQL crashed (Federated)
#
# Switch to slave
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
# Switch to master
CREATE TABLE t1(a INT) ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
SELECT * FROM t1;
a
1
# Start a asynchronous reload
# Wait for tables to be closed
# Ensure that the server didn't crash
SELECT * FROM t1;
a
1
# Drop tables on master and slave
DROP TABLE t1;
DROP TABLE t1;
# Federated cleanup
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE federated;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE federated;
--source include/have_debug.inc
--source federated.inc
--echo #
--echo # Bug#47525: MySQL crashed (Federated)
--echo #
connection slave;
--echo # Switch to slave
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
connection master;
--echo # Switch to master
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE t1(a INT) ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
SELECT * FROM t1;
--echo # Start a asynchronous reload
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= refresh 2>&1
--echo # Wait for tables to be closed
let $show_statement= SHOW STATUS LIKE 'Open_tables';
let $field= Value;
let $condition= = '0';
--source include/wait_show_condition.inc
--echo # Ensure that the server didn't crash
SELECT * FROM t1;
--echo # Drop tables on master and slave
DROP TABLE t1;
connection slave;
DROP TABLE t1;
connection default;
--echo # Federated cleanup
source federated_cleanup.inc;
......@@ -9,4 +9,7 @@ log-bin= master-bin
[ENV]
MASTER_MYPORT= @mysqld.1.port
MASTER_MYSOCK= @mysqld.1.socket
SLAVE_MYPORT= @mysqld.2.port
SLAVE_MYSOCK= @mysqld.2.socket
......@@ -3761,7 +3761,7 @@ extern "C" void slave_io_thread_detach_vio()
{
#ifdef SIGNAL_WITH_VIO_CLOSE
THD *thd= current_thd;
if (thd->slave_thread)
if (thd && thd->slave_thread)
thd->clear_active_vio();
#endif
}
......
......@@ -1428,7 +1428,27 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (check_global_access(thd,RELOAD_ACL))
break;
general_log_print(thd, command, NullS);
if (!reload_acl_and_cache(thd, options, (TABLE_LIST*) 0, &not_used))
#ifndef DBUG_OFF
DBUG_EXECUTE_IF("simulate_detached_thread_refresh",
{
/*
Simulate a reload without a attached thread session.
Provides a environment similar to that of when the
server receives a SIGHUP signal and reloads caches
and flushes tables.
*/
bool res;
my_pthread_setspecific_ptr(THR_THD, NULL);
res= reload_acl_and_cache(NULL, options | REFRESH_FAST,
NULL, &not_used);
my_pthread_setspecific_ptr(THR_THD, thd);
if (!res)
my_ok(thd);
goto end;
}
);
#endif
if (!reload_acl_and_cache(thd, options, NULL, &not_used))
my_ok(thd);
break;
}
......@@ -1571,6 +1591,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
}
/* Break the switch for DBUG wrapped code. */
#ifndef DBUG_OFF
end:
#endif
/* report error issued during command execution */
if (thd->killed_errno())
{
......
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