Skip to content

Commit

Permalink
Remove extra (not needed) error from multi-table-update for killed query
Browse files Browse the repository at this point in the history
If a multi-update query was killed because of timeout or a kill statement,
there was a chance the query returned the error "An error occurred in
multi-table update" instead of the right error, like
"Query execution was interrupted".
  • Loading branch information
montywi committed Feb 14, 2021
1 parent 23833dc commit 3cd32a9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions sql/sql_update.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3047,14 +3047,18 @@ bool multi_update::send_eof()
DBUG_ASSERT(trans_safe || !updated ||
thd->transaction.stmt.modified_non_trans_table);

if (likely(local_error != 0))
error_handled= TRUE; // to force early leave from ::abort_result_set()

if (unlikely(local_error > 0)) // if the above log write did not fail ...
if (unlikely(local_error))
{
/* Safety: If we haven't got an error before (can happen in do_updates) */
my_message(ER_UNKNOWN_ERROR, "An error occurred in multi-table update",
MYF(0));
error_handled= TRUE; // to force early leave from ::abort_result_set()
if (thd->killed == NOT_KILLED && !thd->get_stmt_da()->is_set())
{
/*
No error message was sent and query was not killed (in which case
mysql_execute_command() will send the error mesage).
*/
my_message(ER_UNKNOWN_ERROR, "An error occurred in multi-table update",
MYF(0));
}
DBUG_RETURN(TRUE);
}

Expand Down

0 comments on commit 3cd32a9

Please sign in to comment.