From ed48fcf177bf1077db731a4d5bb0b6dd7468fc9c Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Mon, 1 Aug 2016 17:02:28 -0400 Subject: [PATCH] MDEV-10478: Trx abort does not work in autocommit mode THD's statement transaction handle (st_transactions::stmt) should also be looked for registered htons while serving a request to abort a transaction. --- sql/handler.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sql/handler.cc b/sql/handler.cc index 947ca005cdb..e4aa1660c82 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -6078,7 +6078,10 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) DBUG_RETURN(0); } - THD_TRANS *trans= &victim_thd->transaction.all; + /* Try statement transaction if standard one is not set. */ + THD_TRANS *trans= (victim_thd->transaction.all.ha_list) ? + &victim_thd->transaction.all : &victim_thd->transaction.stmt; + Ha_trx_info *ha_info= trans->ha_list, *ha_info_next; for (; ha_info; ha_info= ha_info_next) @@ -6086,8 +6089,8 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) handlerton *hton= ha_info->ht(); if (!hton->abort_transaction) { - /* Skip warning for binlog SE */ - if (hton->db_type != DB_TYPE_BINLOG) + /* Skip warning for binlog & wsrep. */ + if (hton->db_type != DB_TYPE_BINLOG && hton != wsrep_hton) { WSREP_WARN("Cannot abort transaction."); }