summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2016-08-04 12:59:15 -0400
committerNirbhay Choubey <nirbhay@mariadb.com>2016-08-04 12:59:15 -0400
commit7adc83936300deff73996b962b03b0f987136724 (patch)
treeb912664c6c0f9c80b863fd72ca7b172520314f9a
parenta8c2f68fb8c7915317b12236c21a35bdd41d2092 (diff)
downloadmariadb-git-hf-10.1-11868.tar.gz
MDEV-10478, MDEV-10235: Postfixhf-10.1-11868
Make ha_abort_transaction & ha_fake_trx_id to lookup InnoDB/XtraDB handlerton directly from installed_htons.
-rw-r--r--sql/handler.cc59
1 files changed, 14 insertions, 45 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index e4aa1660c82..9939c38025f 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -6078,29 +6078,17 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
DBUG_RETURN(0);
}
- /* 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;
+ handlerton *hton= installed_htons[DB_TYPE_INNODB];
- Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
-
- for (; ha_info; ha_info= ha_info_next)
+ if (hton && hton->abort_transaction)
{
- handlerton *hton= ha_info->ht();
- if (!hton->abort_transaction)
- {
- /* Skip warning for binlog & wsrep. */
- if (hton->db_type != DB_TYPE_BINLOG && hton != wsrep_hton)
- {
- WSREP_WARN("Cannot abort transaction.");
- }
- }
- else
- {
- hton->abort_transaction(hton, bf_thd, victim_thd, signal);
- }
- ha_info_next= ha_info->next();
+ hton->abort_transaction(hton, bf_thd, victim_thd, signal);
}
+ else
+ {
+ WSREP_WARN("Cannot abort transaction.");
+ }
+
DBUG_RETURN(0);
}
@@ -6108,40 +6096,21 @@ void ha_fake_trx_id(THD *thd)
{
DBUG_ENTER("ha_fake_trx_id");
- bool no_fake_trx_id= true;
-
if (!WSREP(thd))
{
DBUG_VOID_RETURN;
}
- /* Try statement transaction if standard one is not set. */
- THD_TRANS *trans= (thd->transaction.all.ha_list) ? &thd->transaction.all :
- &thd->transaction.stmt;
+ handlerton *hton= installed_htons[DB_TYPE_INNODB];
- Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
-
- for (; ha_info; ha_info= ha_info_next)
+ if (hton && hton->fake_trx_id)
{
- handlerton *hton= ha_info->ht();
- if (hton->fake_trx_id)
- {
- hton->fake_trx_id(hton, thd);
-
- /* Got a fake trx id. */
- no_fake_trx_id= false;
-
- /*
- We need transaction ID from just one storage engine providing
- fake_trx_id (which will most likely be the case).
- */
- break;
- }
- ha_info_next= ha_info->next();
+ hton->fake_trx_id(hton, thd);
}
-
- if (unlikely(no_fake_trx_id))
+ else
+ {
WSREP_WARN("Cannot get fake transaction ID from storage engine.");
+ }
DBUG_VOID_RETURN;
}