mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-27649 PS conflict handling causing node crash
Handling BF abort for prepared statement execution so that EXECUTE processing will continue until parameter setup is complete, before BF abort bails out the statement execution. THD class has new boolean member: wsrep_delayed_BF_abort, which is set if BF abort is observed in do_command() right after reading client's packet, and if the client has sent PS execute command. In such case, the deadlock error is not returned immediately back to client, but the PS execution will be started. However, the PS execution loop, will now check if wsrep_delayed_BF_abort is set, and stop the PS execution after the type information has been assigned for the PS. With this, the PS protocol type information, which is present in the first PS EXECUTE command, is not lost even if the first PS EXECUTE command was marked to abort. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
This commit is contained in:
@ -1313,7 +1313,13 @@ bool do_command(THD *thd)
|
||||
DBUG_ASSERT(!thd->mdl_context.has_locks());
|
||||
DBUG_ASSERT(!thd->get_stmt_da()->is_set());
|
||||
/* We let COM_QUIT and COM_STMT_CLOSE to execute even if wsrep aborted. */
|
||||
if (command != COM_STMT_CLOSE &&
|
||||
if (command == COM_STMT_EXECUTE)
|
||||
{
|
||||
WSREP_DEBUG("PS BF aborted at do_command");
|
||||
thd->wsrep_delayed_BF_abort= true;
|
||||
}
|
||||
if (command != COM_STMT_CLOSE &&
|
||||
command != COM_STMT_EXECUTE &&
|
||||
command != COM_QUIT)
|
||||
{
|
||||
my_error(ER_LOCK_DEADLOCK, MYF(0));
|
||||
@ -1385,6 +1391,17 @@ out:
|
||||
/* there was a command to process, and before_command() has been called */
|
||||
wsrep_after_command_after_result(thd);
|
||||
}
|
||||
|
||||
if (thd->wsrep_delayed_BF_abort)
|
||||
{
|
||||
my_error(ER_LOCK_DEADLOCK, MYF(0));
|
||||
WSREP_DEBUG("Deadlock error for PS query: %s", thd->query());
|
||||
thd->reset_killed();
|
||||
thd->mysys_var->abort = 0;
|
||||
thd->wsrep_retry_counter = 0;
|
||||
|
||||
thd->wsrep_delayed_BF_abort= false;
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
DBUG_RETURN(return_value);
|
||||
}
|
||||
|
Reference in New Issue
Block a user