From ca126a2bbdf50736d2cb1909be1bde8808ba2d6c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Oct 2006 12:44:03 +0400 Subject: [PATCH] Fix for bug #22728 "Handler_rollback value is growing". The bug is present only in 4.1, will be null-merged to 5.0 For InnoDB, check value of thd->transaction.all.innodb_active_trans instead of thd->transaction.stmt.innobase_tid to see if we really need to rollback. mysql-test/r/innodb_mysql.result: Added testcase for bug #22728 "Handler_rollback value is growing" mysql-test/t/innodb_mysql.test: Added testcase for bug #22728 "Handler_rollback value is growing" sql/handler.cc: For InnoDB, check value of thd->transaction.all.innodb_active_trans instead of thd->transaction.stmt.innobase_tid to see if we really need to rollback. --- mysql-test/r/innodb_mysql.result | 10 ++++++++++ mysql-test/t/innodb_mysql.test | 18 ++++++++++++++++++ sql/handler.cc | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 2a4e3555e3b..d1f34e681e9 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -54,3 +54,13 @@ c.c_id = 218 and expiredate is null; slai_id 12 drop table t1, t2; +flush status; +create table t1 (c1 int) engine=innodb; +handler t1 open; +handler t1 read first; +c1 +show /*!50002 GLOBAL */ status like 'Handler_rollback'; +Variable_name Value +Handler_rollback 0 +drop table t1; +End of 4.1 tests diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index f31e4d64789..ce8030d389d 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -57,3 +57,21 @@ where c.c_id = 218 and expiredate is null; drop table t1, t2; + +# +# Bug #22728 - Handler_rollback value is growing +# +flush status; +create table t1 (c1 int) engine=innodb; +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +connection con2; +handler t1 open; +handler t1 read first; +disconnect con2; +connection con1; +show /*!50002 GLOBAL */ status like 'Handler_rollback'; +connection default; +drop table t1; +disconnect con1; +--echo End of 4.1 tests diff --git a/sql/handler.cc b/sql/handler.cc index e166f9885fc..7dc72938f7a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -648,7 +648,7 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans) } #endif #ifdef HAVE_INNOBASE_DB - if (trans->innobase_tid) + if (thd->transaction.all.innodb_active_trans) { if ((error=innobase_rollback(thd, trans->innobase_tid))) {