From: Date: October 11 2007 6:48pm Subject: bk commit into 5.1 tree (tomas:1.2630) BUG#31320 List-Archive: http://lists.mysql.com/commits/35389 X-Bug: 31320 Message-Id: <20071011164814.AB27719455550@linux.local> Below is the list of changes that have just been committed into a local 5.1 repository of tomas. When tomas does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-10-11 18:48:09+02:00, tomas@stripped +3 -0 BUG#31320: Fix error introduced by WL3682, transaction not aborted after failure of statement mysql-test/suite/ndb/r/ndb_insert.result@stripped, 2007-10-11 18:48:06+02:00, tomas@stripped +8 -0 BUG#31320: Fix error introduced by WL3682, transaction not aborted after failure of statement mysql-test/suite/ndb/t/ndb_insert.test@stripped, 2007-10-11 18:48:06+02:00, tomas@stripped +12 -0 BUG#31320: Fix error introduced by WL3682, transaction not aborted after failure of statement sql/ha_ndbcluster.cc@stripped, 2007-10-11 18:48:06+02:00, tomas@stripped +7 -2 BUG#31320: Fix error introduced by WL3682, transaction not aborted after failure of statement diff -Nrup a/mysql-test/suite/ndb/r/ndb_insert.result b/mysql-test/suite/ndb/r/ndb_insert.result --- a/mysql-test/suite/ndb/r/ndb_insert.result 2007-06-27 14:27:29 +02:00 +++ b/mysql-test/suite/ndb/r/ndb_insert.result 2007-10-11 18:48:06 +02:00 @@ -5,6 +5,14 @@ b INT NOT NULL, 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 -Nrup a/mysql-test/suite/ndb/t/ndb_insert.test b/mysql-test/suite/ndb/t/ndb_insert.test --- a/mysql-test/suite/ndb/t/ndb_insert.test 2007-07-04 22:06:23 +02:00 +++ b/mysql-test/suite/ndb/t/ndb_insert.test 2007-10-11 18:48:06 +02:00 @@ -18,6 +18,18 @@ CREATE TABLE t1 ( 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 -Nrup a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc --- a/sql/ha_ndbcluster.cc 2007-10-11 12:33:07 +02:00 +++ b/sql/ha_ndbcluster.cc 2007-10-11 18:48:06 +02:00 @@ -5589,8 +5589,7 @@ static int ndbcluster_rollback(handlerto 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")); @@ -5608,6 +5607,12 @@ static int ndbcluster_rollback(handlerto 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;