From b23c82fef38839f9f6b758091dfb5064c017f608 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 18 Jun 2019 14:32:24 +0300 Subject: [PATCH] MDEV-18078 Assertion `trnman_has_locked_tables(trn) > 0' failed Problem was that in case of implicit rollback for alter table Aria did try to run commit twice. The test case for this is tricky to do in 10.2, so it will be added to 10.4 as part of BACKUP STAGE testing. --- storage/maria/ha_maria.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index f64ea4b1edb..5f0d023f42b 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -2743,7 +2743,8 @@ int ha_maria::external_lock(THD *thd, int lock_type) } else { - TRN *trn= (file->trn != &dummy_transaction_object ? file->trn : 0); + /* We have to test for THD_TRN to protect against implicit commits */ + TRN *trn= (file->trn != &dummy_transaction_object && THD_TRN ? file->trn : 0); /* End of transaction */ /*