1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-6616 Server crashes in my_hash_first if shutdown is performed when FLUSH LOGS is running

master_info_index becomes zero during shutdown.
check that it's valid (under a mutex) before dereferencing.
This commit is contained in:
Sergei Golubchik
2014-09-06 08:33:56 +02:00
parent 9392d0e280
commit 3da761912a
6 changed files with 61 additions and 32 deletions

View File

@ -3226,6 +3226,9 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added)
LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
DBUG_ENTER("change_master");
mysql_mutex_assert_owner(&LOCK_active_mi);
DBUG_ASSERT(master_info_index);
*master_info_added= false;
/*
We need to check if there is an empty master_host. Otherwise
@ -3632,7 +3635,8 @@ bool mysql_show_binlog_events(THD* thd)
else /* showing relay log contents */
{
mysql_mutex_lock(&LOCK_active_mi);
if (!(mi= master_info_index->
if (!master_info_index ||
!(mi= master_info_index->
get_master_info(&thd->variables.default_master_connection,
Sql_condition::WARN_LEVEL_ERROR)))
{