Commit 2152fbdc authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-13470 DELETE IGNORE should not ignore deadlocks (again)

This is basically a duplicate or a reincarnation of MDEV-117.
For some reason, the test innodb.mdev-117 started failing in 10.2.

It is uncertain when this test started failing. The test is
nondeterministic, because there is a race condition between the
concurrently executing DELETE IGNORE and DELETE statements.

When a deadlock is reported for DELETE IGNORE, the SQL layer would
call handler::print_error() but then proceed to the next row,
as if no error had happened (which is the purpose of DELETE IGNORE).
So, when it proceeded to handler::ha_rnd_next(), InnoDB would hit an
assertion failure, because the transaction no longer exists, and we
are not executing at the start of a statement.

handler::print_error(): If thd_mark_transaction_to_rollback(thd, true)
was called, clear the ME_JUST_WARNING and ME_JUST_INFO errflags, so
that a note or warning will be promoted to an error if the transaction
was aborted by a storage engine.
parent 4bca34d8
......@@ -3345,6 +3345,12 @@ void handler::print_error(int error, myf errflag)
DBUG_ENTER("handler::print_error");
DBUG_PRINT("enter",("error: %d",error));
if (ha_thd()->transaction_rollback_request)
{
/* Ensure this becomes a true error */
errflag&= ~(ME_JUST_WARNING | ME_JUST_INFO);
}
int textno= -1; // impossible value
switch (error) {
case EACCES:
......
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