Commit 18663539 authored by Monty's avatar Monty

Fixed deadlock in main.flush_read_lock

local_global_read_lock did release all HANDLER's before taking its
MDL_BACKUP_FTWRL# locks. This had a potential race condition if
there was a waiting LOCK TABLE for one of the freed handlers.

Fixed by moving the release of HANDLER's to after the backup locks are
taken.

After commit 8cf7e345 it's not anymore critical to free HANDLER's in
FTWRL, but we will keep the mysql_ha_cleanup_no_free() call until 10.5
to not cause any issues with 10.4 just before it's going GA.
parent 0cc7c608
......@@ -1034,8 +1034,6 @@ bool Global_read_lock::lock_global_read_lock(THD *thd)
DBUG_RETURN(1);
}
mysql_ha_cleanup_no_free(thd);
DBUG_ASSERT(! thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
MDL_BACKUP_FTWRL1));
DBUG_ASSERT(! thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
......@@ -1057,6 +1055,9 @@ bool Global_read_lock::lock_global_read_lock(THD *thd)
m_mdl_global_read_lock= mdl_request.ticket;
m_state= GRL_ACQUIRED;
/* Release HANDLER OPEN after we have got our MDL lock */
mysql_ha_cleanup_no_free(thd);
}
/*
We DON'T set global_read_lock_blocks_commit now, it will be set after
......
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