#At file:///opt/local/work/mysql-5.1-bugteam/ based on
revid:iggy@stripped
2846 Konstantin Osipov 2009-03-26
Bug#26288 "savepoint not deleted, comit on empty transaction",
commit the reviewing version for archiving purposes.
Ramil will commit and push into 5.0
modified:
mysql-test/r/innodb_mysql.result
mysql-test/t/innodb_mysql.test
sql/handler.cc
=== modified file 'mysql-test/r/innodb_mysql.result'
--- a/mysql-test/r/innodb_mysql.result 2009-02-20 09:50:50 +0000
+++ b/mysql-test/r/innodb_mysql.result 2009-03-26 15:06:29 +0000
@@ -1846,4 +1846,28 @@ id
TRUNCATE TABLE t2;
DROP TABLE t2;
DROP TABLE t1;
+#
+# BUG #26288: savepoint are not deleted on comit, if the transaction
+# was otherwise empty
+#
+BEGIN;
+SAVEPOINT s1;
+COMMIT;
+RELEASE SAVEPOINT s1;
+ERROR 42000: SAVEPOINT s1 does not exist
+BEGIN;
+SAVEPOINT s2;
+COMMIT;
+ROLLBACK TO SAVEPOINT s2;
+ERROR 42000: SAVEPOINT s2 does not exist
+BEGIN;
+SAVEPOINT s3;
+ROLLBACK;
+RELEASE SAVEPOINT s3;
+ERROR 42000: SAVEPOINT s3 does not exist
+BEGIN;
+SAVEPOINT s4;
+ROLLBACK;
+ROLLBACK TO SAVEPOINT s4;
+ERROR 42000: SAVEPOINT s4 does not exist
End of 5.1 tests
=== modified file 'mysql-test/t/innodb_mysql.test'
--- a/mysql-test/t/innodb_mysql.test 2009-02-20 09:50:50 +0000
+++ b/mysql-test/t/innodb_mysql.test 2009-03-26 15:06:29 +0000
@@ -185,4 +185,33 @@ TRUNCATE TABLE t2;
DROP TABLE t2;
DROP TABLE t1;
+
+--echo #
+--echo # BUG #26288: savepoint are not deleted on comit, if the transaction
+--echo # was otherwise empty
+--echo #
+BEGIN;
+SAVEPOINT s1;
+COMMIT;
+--error 1305
+RELEASE SAVEPOINT s1;
+
+BEGIN;
+SAVEPOINT s2;
+COMMIT;
+--error 1305
+ROLLBACK TO SAVEPOINT s2;
+
+BEGIN;
+SAVEPOINT s3;
+ROLLBACK;
+--error 1305
+RELEASE SAVEPOINT s3;
+
+BEGIN;
+SAVEPOINT s4;
+ROLLBACK;
+--error 1305
+ROLLBACK TO SAVEPOINT s4;
+
--echo End of 5.1 tests
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2009-03-17 20:29:24 +0000
+++ b/sql/handler.cc 2009-03-26 15:06:29 +0000
@@ -1184,6 +1184,16 @@ end:
if (rw_trans)
start_waiting_global_read_lock(thd);
}
+ else if (all)
+ {
+ /*
+ A COMMIT of an empty transaction. There may be savepoints.
+ Destroy them. If the transaction is not empty
+ savepoints are cleared in ha_commit_one_phase()
+ or ha_rollback_trans().
+ */
+ thd->transaction.cleanup();
+ }
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error);
}
@@ -1292,11 +1302,11 @@ int ha_rollback_trans(THD *thd, bool all
thd->transaction.xid_state.xid.null();
}
if (all)
- {
thd->variables.tx_isolation=thd->session_tx_isolation;
- thd->transaction.cleanup();
- }
}
+ /* Always cleanup. Even if there nht==0. There may be savepoints. */
+ if (all)
+ thd->transaction.cleanup();
#endif /* USING_TRANSACTIONS */
if (all)
thd->transaction_rollback_request= FALSE;
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (kostja:2846) Bug#26288 | Konstantin Osipov | 26 Mar 2009 |