diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result index 365879fb99b..75b52848a86 100644 --- a/mysql-test/r/ndb_alter_table.result +++ b/mysql-test/r/ndb_alter_table.result @@ -75,6 +75,7 @@ drop table t1; DROP TABLE IF EXISTS t2; create table t2 (a int NOT NULL PRIMARY KEY) engine=myisam; alter table t2 engine=ndbcluster; +alter table t2 add c int; delete from t2; ERROR HY000: Got temporary error 1217 '1217' from ndbcluster select count(*) from t2 where a+0 > 0; diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test index 6057eff4fca..793dfd177cd 100644 --- a/mysql-test/t/ndb_alter_table.test +++ b/mysql-test/t/ndb_alter_table.test @@ -62,6 +62,7 @@ while ($1) } enable_query_log; alter table t2 engine=ndbcluster; +alter table t2 add c int; --error 1297 delete from t2; #to make sure we do a full table scan diff --git a/ndb/src/ndbapi/NdbConnection.cpp b/ndb/src/ndbapi/NdbConnection.cpp index 1b4f1f1f75c..7072f743c6d 100644 --- a/ndb/src/ndbapi/NdbConnection.cpp +++ b/ndb/src/ndbapi/NdbConnection.cpp @@ -201,7 +201,9 @@ NdbConnection::restart(){ } else { theNdb->theFirstTransId = tTransid + 1; } + theCommitStatus = Started; theCompletionStatus = NotCompleted; + theTransactionIsStarted = false; DBUG_RETURN(0); } DBUG_PRINT("error",("theCompletionStatus != CompletedSuccess")); diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 36077352cae..05c5986ea5b 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -1451,36 +1451,22 @@ int ha_ndbcluster::write_row(byte *record) (int)rows_inserted, (int)bulk_insert_rows)); bulk_insert_not_flushed= false; - if (thd->transaction.on) { - if (trans->execute(NoCommit) != 0) - { - skip_auto_increment= true; - DBUG_RETURN(ndb_err(trans)); - } + if (thd->transaction.on) + { + if (trans->execute(NoCommit) != 0) + { + skip_auto_increment= true; + DBUG_RETURN(ndb_err(trans)); + } } else { if (trans->execute(Commit) != 0) - { - skip_auto_increment= true; - DBUG_RETURN(ndb_err(trans)); - } -#if 0 // this is what we want to use but it is not functional - trans->restart(); -#else - m_ndb->closeTransaction(m_active_trans); - m_active_trans= m_ndb->startTransaction(); - if (thd->transaction.all.ndb_tid) - thd->transaction.all.ndb_tid= m_active_trans; - else - thd->transaction.stmt.ndb_tid= m_active_trans; - if (m_active_trans == NULL) { skip_auto_increment= true; - ERR_RETURN(m_ndb->getNdbError()); + DBUG_RETURN(ndb_err(trans)); } - trans= m_active_trans; -#endif + trans->restart(); } } if ((has_auto_increment) && (skip_auto_increment))