diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-09-30 18:38:02 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-09-30 18:38:02 -0300 |
commit | 565f1bc4a1ccd9a7b853980d9aca5861d75ed104 (patch) | |
tree | e494fb28c32b11ed12288677e44572035a31869e /sql/sql_parse.cc | |
parent | df2122a262cc421fff27f5e2265d7723a6e48829 (diff) | |
download | mariadb-git-565f1bc4a1ccd9a7b853980d9aca5861d75ed104.tar.gz |
Bug#47525: MySQL crashed (Federated)
On Mac OS X or Windows, sending a SIGHUP to the server or a
asynchronous flush (triggered by flush_time), would cause the
server to crash.
The problem was that a hook used to detach client API handles
wasn't prepared to handle cases where the thread does not have
a associated session.
The solution is to verify whether the thread has a associated
session before trying to detach a handle.
mysql-test/r/federated_debug.result:
Add test case result for Bug#47525
mysql-test/t/federated_debug-master.opt:
Debug point.
mysql-test/t/federated_debug.test:
Add test case for Bug#47525
sql/slave.cc:
Check whether a the thread has a associated session.
sql/sql_parse.cc:
Add debug code to simulate a reload without thread session.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 65b2a9d60b0..62cca71ee97 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2161,6 +2161,26 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (check_global_access(thd,RELOAD_ACL)) break; mysql_log.write(thd,command,NullS); +#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, ¬_used); + my_pthread_setspecific_ptr(THR_THD, thd); + if (!res) + send_ok(thd); + break; + } + ); +#endif if (!reload_acl_and_cache(thd, options, (TABLE_LIST*) 0, ¬_used)) send_ok(thd); break; |