diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result index 8a5fdfaf6a7..365879fb99b 100644 --- a/mysql-test/r/ndb_alter_table.result +++ b/mysql-test/r/ndb_alter_table.result @@ -75,9 +75,11 @@ drop table t1; DROP TABLE IF EXISTS t2; create table t2 (a int NOT NULL PRIMARY KEY) engine=myisam; alter table t2 engine=ndbcluster; -select count(*) from t2; +delete from t2; +ERROR HY000: Got temporary error 1217 '1217' from ndbcluster +select count(*) from t2 where a+0 > 0; count(*) -15001 +12001 truncate table t2; select count(*) from t2; count(*) diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test index e2fbf829cc0..6057eff4fca 100644 --- a/mysql-test/t/ndb_alter_table.test +++ b/mysql-test/t/ndb_alter_table.test @@ -53,7 +53,7 @@ DROP TABLE IF EXISTS t2; --enable_warnings create table t2 (a int NOT NULL PRIMARY KEY) engine=myisam; -let $1=15001; +let $1=12001; disable_query_log; while ($1) { @@ -62,7 +62,10 @@ while ($1) } enable_query_log; alter table t2 engine=ndbcluster; -select count(*) from t2; +--error 1297 +delete from t2; +#to make sure we do a full table scan +select count(*) from t2 where a+0 > 0; truncate table t2; select count(*) from t2; drop table t2; diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index 26bac2cf10b..c0e2c1a793a 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -102,14 +102,13 @@ ConfigRetriever::do_connect(int exit_on_connect_failure){ if (ndb_mgm_connect(m_handle, tmp.c_str()) == 0) { return 0; } - if (exit_on_connect_failure) - return 1; setError(CR_RETRY, ndb_mgm_get_latest_error_desc(m_handle)); case MgmId_File: break; } } - + if (exit_on_connect_failure) + return 1; if(latestErrorType == CR_RETRY){ REPORT_WARNING("Failed to retrieve cluster configuration"); ndbout << "(Cause of failure: " << getErrorString() << ")" << endl; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 381481704c7..36077352cae 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -2603,7 +2603,6 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) (NdbConnection*)thd->transaction.all.ndb_tid: (NdbConnection*)thd->transaction.stmt.ndb_tid; DBUG_ASSERT(m_active_trans); - // Start of transaction retrieve_all_fields= FALSE; ops_pending= 0; @@ -2628,7 +2627,18 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) thd->transaction.stmt.ndb_tid= 0; } } + if (m_active_trans) + DBUG_PRINT("warning", ("m_active_trans != NULL")); + if (m_active_cursor) + DBUG_PRINT("warning", ("m_active_cursor != NULL")); + if (blobs_pending) + DBUG_PRINT("warning", ("blobs_pending != 0")); + if (ops_pending) + DBUG_PRINT("warning", ("ops_pending != 0L")); m_active_trans= NULL; + m_active_cursor= NULL; + ops_pending= 0; + blobs_pending= 0; } DBUG_RETURN(error); } @@ -3242,7 +3252,11 @@ ha_ndbcluster::~ha_ndbcluster() blobs_buffer= 0; // Check for open cursor/transaction + if (m_active_cursor) { + } DBUG_ASSERT(m_active_cursor == NULL); + if (m_active_trans) { + } DBUG_ASSERT(m_active_trans == NULL); DBUG_VOID_RETURN;