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
commit 3da761912a
6 changed files with 61 additions and 32 deletions

View file

@ -3961,9 +3961,13 @@ longlong Item_master_pos_wait::val_int()
else
connection_name= thd->variables.default_master_connection;
if (!(mi= master_info_index->get_master_info(&connection_name,
Sql_condition::WARN_LEVEL_WARN)))
mysql_mutex_lock(&LOCK_active_mi);
mi= master_info_index->get_master_info(&connection_name,
Sql_condition::WARN_LEVEL_WARN);
mysql_mutex_unlock(&LOCK_active_mi);
if (!mi)
goto err;
if ((event_count = mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2)
{
null_value = 1;