Commit ed48fcf1 authored by Nirbhay Choubey's avatar Nirbhay Choubey

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.
parent 84a9e050
...@@ -6078,7 +6078,10 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) ...@@ -6078,7 +6078,10 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
DBUG_RETURN(0); 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; Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
for (; ha_info; ha_info= 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) ...@@ -6086,8 +6089,8 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
handlerton *hton= ha_info->ht(); handlerton *hton= ha_info->ht();
if (!hton->abort_transaction) if (!hton->abort_transaction)
{ {
/* Skip warning for binlog SE */ /* Skip warning for binlog & wsrep. */
if (hton->db_type != DB_TYPE_BINLOG) if (hton->db_type != DB_TYPE_BINLOG && hton != wsrep_hton)
{ {
WSREP_WARN("Cannot abort transaction."); WSREP_WARN("Cannot abort transaction.");
} }
......
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