1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-17749 Kill during LOCK TABLE ; ALTER TABLE causes assert

The problem was that when LOCK TABLES where unwinded as part of
a killed connection, unlink_all_closed_tables() did not like that
there was uncommited transactions.
Fixed by doing a rollback of any open transaction in this particular case.
This commit is contained in:
Monty
2021-05-26 14:35:23 +03:00
parent 1864a8ea93
commit aa284e0237
3 changed files with 105 additions and 0 deletions

View File

@ -2469,7 +2469,17 @@ unlink_all_closed_tables(THD *thd, MYSQL_LOCK *lock, size_t reopen_count)
/* If no tables left, do an automatic UNLOCK TABLES */
if (thd->lock && thd->lock->table_count == 0)
{
/*
We have to rollback any open transactions here.
This is required in the case where the server has been killed
but some transations are still open (as part of locked tables).
If we don't do this, we will get an assert in unlock_locked_tables().
*/
ha_rollback_trans(thd, FALSE);
ha_rollback_trans(thd, TRUE);
unlock_locked_tables(thd);
}
}