From 0319b958b50a47a42c4b1b185b1b1310ce0017aa Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Mar 2005 19:44:53 +0200 Subject: [PATCH] ha_innodb.cc: In TRUNCATE TABLE, MySQL may call innobase_xa_prepare() even though there is no active transaction because it was committed in ha_innobase::delete_all_rows(); in innobase_xa_prepare() InnoDB starts then a new transaction; let us adjust the trx->active_trans flag accordingly sql/ha_innodb.cc: In TRUNCATE TABLE, MySQL may call innobase_xa_prepare() even though there is no active transaction because it was committed in ha_innobase::delete_all_rows(); in innobase_xa_prepare() InnoDB starts then a new transaction; let us adjust the trx->active_trans flag accordingly --- sql/ha_innodb.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index f68ad99ac44..121dbdccc12 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -6313,6 +6313,14 @@ innobase_xa_prepare( /* We were instructed to prepare the whole transaction, or this is an SQL statement end and autocommit is on */ + /* If there is no active InnoDB transaction, + trx_prepare_for_mysql() will (temporarily) start one */ + + if (trx->active_trans == 0) { + + trx->active_trans = 1; + } + error = trx_prepare_for_mysql(trx); } else { /* We just mark the SQL statement ended and do not do a