Commit 2fdb262c authored by tomas@poseidon.(none)'s avatar tomas@poseidon.(none)

fixed and added test case for bug#5431

+ fix for support of multiple mgmt servers
parent cfad8ecc
...@@ -75,9 +75,11 @@ drop table t1; ...@@ -75,9 +75,11 @@ drop table t1;
DROP TABLE IF EXISTS t2; DROP TABLE IF EXISTS t2;
create table t2 (a int NOT NULL PRIMARY KEY) engine=myisam; create table t2 (a int NOT NULL PRIMARY KEY) engine=myisam;
alter table t2 engine=ndbcluster; 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(*) count(*)
15001 12001
truncate table t2; truncate table t2;
select count(*) from t2; select count(*) from t2;
count(*) count(*)
......
...@@ -53,7 +53,7 @@ DROP TABLE IF EXISTS t2; ...@@ -53,7 +53,7 @@ DROP TABLE IF EXISTS t2;
--enable_warnings --enable_warnings
create table t2 (a int NOT NULL PRIMARY KEY) engine=myisam; create table t2 (a int NOT NULL PRIMARY KEY) engine=myisam;
let $1=15001; let $1=12001;
disable_query_log; disable_query_log;
while ($1) while ($1)
{ {
...@@ -62,7 +62,10 @@ while ($1) ...@@ -62,7 +62,10 @@ while ($1)
} }
enable_query_log; enable_query_log;
alter table t2 engine=ndbcluster; 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; truncate table t2;
select count(*) from t2; select count(*) from t2;
drop table t2; drop table t2;
...@@ -102,14 +102,13 @@ ConfigRetriever::do_connect(int exit_on_connect_failure){ ...@@ -102,14 +102,13 @@ ConfigRetriever::do_connect(int exit_on_connect_failure){
if (ndb_mgm_connect(m_handle, tmp.c_str()) == 0) { if (ndb_mgm_connect(m_handle, tmp.c_str()) == 0) {
return 0; return 0;
} }
if (exit_on_connect_failure)
return 1;
setError(CR_RETRY, ndb_mgm_get_latest_error_desc(m_handle)); setError(CR_RETRY, ndb_mgm_get_latest_error_desc(m_handle));
case MgmId_File: case MgmId_File:
break; break;
} }
} }
if (exit_on_connect_failure)
return 1;
if(latestErrorType == CR_RETRY){ if(latestErrorType == CR_RETRY){
REPORT_WARNING("Failed to retrieve cluster configuration"); REPORT_WARNING("Failed to retrieve cluster configuration");
ndbout << "(Cause of failure: " << getErrorString() << ")" << endl; ndbout << "(Cause of failure: " << getErrorString() << ")" << endl;
......
...@@ -2603,7 +2603,6 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) ...@@ -2603,7 +2603,6 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
(NdbConnection*)thd->transaction.all.ndb_tid: (NdbConnection*)thd->transaction.all.ndb_tid:
(NdbConnection*)thd->transaction.stmt.ndb_tid; (NdbConnection*)thd->transaction.stmt.ndb_tid;
DBUG_ASSERT(m_active_trans); DBUG_ASSERT(m_active_trans);
// Start of transaction // Start of transaction
retrieve_all_fields= FALSE; retrieve_all_fields= FALSE;
ops_pending= 0; ops_pending= 0;
...@@ -2628,7 +2627,18 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) ...@@ -2628,7 +2627,18 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
thd->transaction.stmt.ndb_tid= 0; 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_trans= NULL;
m_active_cursor= NULL;
ops_pending= 0;
blobs_pending= 0;
} }
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -3242,7 +3252,11 @@ ha_ndbcluster::~ha_ndbcluster() ...@@ -3242,7 +3252,11 @@ ha_ndbcluster::~ha_ndbcluster()
blobs_buffer= 0; blobs_buffer= 0;
// Check for open cursor/transaction // Check for open cursor/transaction
if (m_active_cursor) {
}
DBUG_ASSERT(m_active_cursor == NULL); DBUG_ASSERT(m_active_cursor == NULL);
if (m_active_trans) {
}
DBUG_ASSERT(m_active_trans == NULL); DBUG_ASSERT(m_active_trans == NULL);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment