mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Bug#16757869: INNODB: POSSIBLE REGRESSION IN 5.5.31, BUG#16004999
The problem was that if UPDATE with subselect caused a deadlock inside InnoDB, this deadlock was not properly handled by the SQL layer. This meant that the SQL layer would try to unlock the row after InnoDB had rolled back the transaction. This caused an assertion inside InnoDB. This patch fixes the problem by checking for errors reported by SQL_SELECT::skip_record() and not calling unlock_row() if any errors have been reported. This bug is similar to Bug#13586591, but for UPDATE rather than DELETE. Similar issues in filesort/opt_range/ sql_select will be investigated and handled in the scope of Bug#16767929
This commit is contained in:
parent
8b6b6b2c44
commit
05ca7f0823
1 changed files with 15 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -555,7 +555,10 @@ int mysql_update(THD *thd,
|
|||
if (select && select->skip_record(thd, &skip_record))
|
||||
{
|
||||
error= 1;
|
||||
table->file->unlock_row();
|
||||
/*
|
||||
Don't try unlocking the row if skip_record reported an error since
|
||||
in this case the transaction might have been rolled back already.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
if (!skip_record)
|
||||
|
@ -801,8 +804,17 @@ int mysql_update(THD *thd,
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
/*
|
||||
Don't try unlocking the row if skip_record reported an error since in
|
||||
this case the transaction might have been rolled back already.
|
||||
*/
|
||||
else if (!thd->is_error())
|
||||
table->file->unlock_row();
|
||||
else
|
||||
{
|
||||
error= 1;
|
||||
break;
|
||||
}
|
||||
thd->warning_info->inc_current_row_for_warning();
|
||||
if (thd->is_error())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue