Bug #31320 | transaction with statement error not aborting transaction | ||
---|---|---|---|
Submitted: | 1 Oct 2007 16:00 | Modified: | 12 Oct 2007 15:50 |
Reporter: | Mikael Ronström | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Cluster: Cluster (NDB) storage engine | Severity: | S3 (Non-critical) |
Version: | MySQL Cluster CGE 6.3 | OS: | Any |
Assigned to: | Mikael Ronström | CPU Architecture: | Any |
[1 Oct 2007 16:00]
Mikael Ronström
[1 Oct 2007 16:21]
Mikael Ronström
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet clean_telco/mysql-test/suite/ndb/r/ndb_insert.result clean_bug31320/mysql-test/suite/ndb/r/ndb_insert.result --- clean_telco/mysql-test/suite/ndb/r/ndb_insert.result 2007-09-11 10:09:49 +02:00 +++ clean_bug31320/mysql-test/suite/ndb/r/ndb_insert.result 2007-10-01 18:24:02 +02:00 @@ -5,6 +5,14 @@ c INT NOT NULL ) ENGINE=ndbcluster; INSERT INTO t1 VALUES (0, 0, 0); +BEGIN; +INSERT INTO t1 VALUES (1, 1, 1); +INSERT INTO t1 VALUES (0, 0, 0); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +COMMIT; +ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER +DELETE FROM t1; +INSERT INTO t1 VALUES (0, 0, 0); SELECT * FROM t1; pk1 b c 0 0 0 diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet clean_telco/mysql-test/suite/ndb/t/ndb_insert.test clean_bug31320/mysql-test/suite/ndb/t/ndb_insert.test --- clean_telco/mysql-test/suite/ndb/t/ndb_insert.test 2007-09-11 10:09:49 +02:00 +++ clean_bug31320/mysql-test/suite/ndb/t/ndb_insert.test 2007-10-01 18:24:02 +02:00 @@ -18,6 +18,18 @@ c INT NOT NULL ) ENGINE=ndbcluster; +# +# Bug 31320: Ensure statement error leads to transaction rollback +# +INSERT INTO t1 VALUES (0, 0, 0); +BEGIN; +INSERT INTO t1 VALUES (1, 1, 1); +--error 1062 +INSERT INTO t1 VALUES (0, 0, 0); +--error 1296 +COMMIT; +DELETE FROM t1; + INSERT INTO t1 VALUES (0, 0, 0); SELECT * FROM t1; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet clean_telco/sql/ha_ndbcluster.cc clean_bug31320/sql/ha_ndbcluster.cc --- clean_telco/sql/ha_ndbcluster.cc 2007-09-28 16:38:00 +02:00 +++ clean_bug31320/sql/ha_ndbcluster.cc 2007-10-01 18:24:02 +02:00 @@ -5577,8 +5577,7 @@ DBUG_ENTER("ndbcluster_rollback"); DBUG_ASSERT(ndb); thd_ndb->start_stmt_count= 0; - if (trans == NULL || (!all && - thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) + if (trans == NULL) { /* Ignore end-of-statement until real rollback or commit is called */ DBUG_PRINT("info", ("Rollback before start or end-of-statement only")); @@ -5593,6 +5592,12 @@ res= ndb_to_mysql_error(&err); if (res != -1) ndbcluster_print_error(res, error_op); + } + if (!all && + thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) + { + DBUG_PRINT("info", ("Rollback transaction at statement error")); + DBUG_RETURN(res); } ndb->closeTransaction(trans); thd_ndb->trans= NULL;
[11 Oct 2007 16:47]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/35389 ChangeSet@1.2630, 2007-10-11 18:48:09+02:00, tomas@whalegate.ndb.mysql.com +3 -0 BUG#31320: Fix error introduced by WL3682, transaction not aborted after failure of statement
[11 Oct 2007 17:48]
Mikael Ronström
Pushed to 6.3
[12 Oct 2007 15:50]
Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at http://dev.mysql.com/doc/en/installing-source.html Documented bugfix in mysql-5.1.22-ndb-6.3.4 changelog. Closed.