summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorjoreland@mysql.com <>2005-05-04 18:58:41 +0200
committerjoreland@mysql.com <>2005-05-04 18:58:41 +0200
commit97feb2df6aebbdce894f46346782f88de925a09b (patch)
treee24106926a102af1fba3d8e78e133d245e02f9e2 /ndb
parentbf6e779b84ebe7cd12be371bc7441ce76cae9947 (diff)
parenta1faad1e64fc874c590ba2cdcf5564a3460cb924 (diff)
downloadmariadb-git-97feb2df6aebbdce894f46346782f88de925a09b.tar.gz
Merge mysql.com:/home/jonas/src/mysql-5.0
into mysql.com:/home/jonas/src/mysql-5.0-ndb
Diffstat (limited to 'ndb')
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp6
-rw-r--r--ndb/src/ndbapi/ClusterMgr.cpp13
-rw-r--r--ndb/src/ndbapi/ClusterMgr.hpp14
3 files changed, 27 insertions, 6 deletions
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index ab32de5b9ca..e5e00b78bfa 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -892,7 +892,10 @@ ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
args.put("initialstart", initial);
args.put("nostart", nostart);
const Properties *reply;
+ const int timeout = handle->read_timeout;
+ handle->read_timeout= 5*60*1000; // 5 minutes
reply = ndb_mgm_call(handle, restart_reply, "restart all", &args);
+ handle->read_timeout= timeout;
CHECK_REPLY(reply, -1);
BaseString result;
@@ -925,7 +928,10 @@ ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
args.put("nostart", nostart);
const Properties *reply;
+ const int timeout = handle->read_timeout;
+ handle->read_timeout= 5*60*1000; // 5 minutes
reply = ndb_mgm_call(handle, restart_reply, "restart node", &args);
+ handle->read_timeout= timeout;
if(reply != NULL) {
BaseString result;
reply->get("result", result);
diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp
index 71938e27037..42b3b01bca1 100644
--- a/ndb/src/ndbapi/ClusterMgr.cpp
+++ b/ndb/src/ndbapi/ClusterMgr.cpp
@@ -66,6 +66,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade):
{
ndbSetOwnVersion();
clusterMgrThreadMutex = NdbMutex_Create();
+ noOfAliveNodes= 0;
noOfConnectedNodes= 0;
theClusterMgrThread= 0;
}
@@ -336,9 +337,9 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){
node.m_state = apiRegConf->nodeState;
if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED ||
node.m_state.startLevel == NodeState::SL_SINGLEUSER)){
- node.m_alive = true;
+ set_node_alive(node, true);
} else {
- node.m_alive = false;
+ set_node_alive(node, false);
}//if
node.hbSent = 0;
node.hbCounter = 0;
@@ -361,7 +362,7 @@ ClusterMgr::execAPI_REGREF(const Uint32 * theData){
assert(node.defined == true);
node.compatible = false;
- node.m_alive = false;
+ set_node_alive(node, false);
node.m_state = NodeState::SL_NOTHING;
node.m_info.m_version = ref->version;
@@ -446,7 +447,7 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){
Node & theNode = theNodes[nodeId];
- theNode.m_alive = false;
+ set_node_alive(theNode, false);
theNode.m_info.m_connectCount ++;
if(theNode.connected)
@@ -462,8 +463,8 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){
}
theNode.nfCompleteRep = false;
-
- if(noOfConnectedNodes == 0){
+ if(noOfAliveNodes == 0)
+ {
NFCompleteRep rep;
for(Uint32 i = 1; i<MAX_NODES; i++){
if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){
diff --git a/ndb/src/ndbapi/ClusterMgr.hpp b/ndb/src/ndbapi/ClusterMgr.hpp
index cc3cf66c8aa..d75b820e9cb 100644
--- a/ndb/src/ndbapi/ClusterMgr.hpp
+++ b/ndb/src/ndbapi/ClusterMgr.hpp
@@ -80,6 +80,7 @@ public:
Uint32 getNoOfConnectedNodes() const;
private:
+ Uint32 noOfAliveNodes;
Uint32 noOfConnectedNodes;
Node theNodes[MAX_NODES];
NdbThread* theClusterMgrThread;
@@ -100,6 +101,19 @@ private:
void execAPI_REGREF (const Uint32 * theData);
void execNODE_FAILREP (const Uint32 * theData);
void execNF_COMPLETEREP(const Uint32 * theData);
+
+ inline void set_node_alive(Node& node, bool alive){
+ if(node.m_alive && !alive)
+ {
+ assert(noOfAliveNodes);
+ noOfAliveNodes--;
+ }
+ else if(!node.m_alive && alive)
+ {
+ noOfAliveNodes++;
+ }
+ node.m_alive = alive;
+ }
};
inline