summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2005-02-16 20:46:34 +0100
committerunknown <tomas@poseidon.ndb.mysql.com>2005-02-16 20:46:34 +0100
commit2eb2383ed022ec8ec591f4dde9565b7415f11351 (patch)
tree0387a105d1ce4ed3221548c5d548aa627011c7de /ndb
parentc3dec835b536c59175de3c5c14a0601c711a982e (diff)
downloadmariadb-git-2eb2383ed022ec8ec591f4dde9565b7415f11351.tar.gz
reuse nodeid if ndbd is restarted
mysql-test/mysql-test-run.pl: start and exit fix for ndbcluster
Diffstat (limited to 'ndb')
-rw-r--r--ndb/include/mgmapi/mgmapi.h1
-rw-r--r--ndb/include/mgmcommon/ConfigRetriever.hpp2
-rw-r--r--ndb/src/common/mgmcommon/ConfigRetriever.cpp6
-rw-r--r--ndb/src/kernel/vm/Configuration.cpp9
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp9
5 files changed, 27 insertions, 0 deletions
diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h
index 3d4a34d6488..fa0774afa06 100644
--- a/ndb/include/mgmapi/mgmapi.h
+++ b/ndb/include/mgmapi/mgmapi.h
@@ -376,6 +376,7 @@ extern "C" {
int ndb_mgm_set_connectstring(NdbMgmHandle handle,
const char *connect_string);
+ int ndb_mgm_set_configuration_nodeid(NdbMgmHandle handle, int nodeid);
int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle);
int ndb_mgm_get_connected_port(NdbMgmHandle handle);
const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);
diff --git a/ndb/include/mgmcommon/ConfigRetriever.hpp b/ndb/include/mgmcommon/ConfigRetriever.hpp
index 8461658748e..be6d656e1a5 100644
--- a/ndb/include/mgmcommon/ConfigRetriever.hpp
+++ b/ndb/include/mgmcommon/ConfigRetriever.hpp
@@ -55,6 +55,8 @@ public:
*/
Uint32 allocNodeId(int no_retries, int retry_delay_in_seconds);
+ int setNodeId(Uint32 nodeid);
+
/**
* Get config using socket
*/
diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp
index db00cc1510f..fd04ad393eb 100644
--- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp
+++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp
@@ -316,6 +316,12 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
return true;
}
+int
+ConfigRetriever::setNodeId(Uint32 nodeid)
+{
+ return ndb_mgm_set_configuration_nodeid(m_handle, nodeid);
+}
+
Uint32
ConfigRetriever::allocNodeId(int no_retries, int retry_delay_in_seconds)
{
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp
index f35a5859ff8..de78a4e927c 100644
--- a/ndb/src/kernel/vm/Configuration.cpp
+++ b/ndb/src/kernel/vm/Configuration.cpp
@@ -141,6 +141,8 @@ Configuration::init(int argc, char** argv)
else
_programName = strdup("");
+ globalData.ownId= 0;
+
return true;
}
@@ -215,6 +217,13 @@ Configuration::fetch_configuration(){
ConfigRetriever &cr= *m_config_retriever;
+ /**
+ * if we have a nodeid set (e.g in a restart situation)
+ * reuse it
+ */
+ if (globalData.ownId)
+ cr.setNodeId(globalData.ownId);
+
globalData.ownId = cr.allocNodeId(2 /*retry*/,3 /*delay*/);
if(globalData.ownId == 0){
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index 5a95c6e9ac1..68106c4689d 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -1722,6 +1722,15 @@ ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *cfg)
extern "C"
int
+ndb_mgm_set_configuration_nodeid(NdbMgmHandle handle, int nodeid)
+{
+ CHECK_HANDLE(handle, -1);
+ handle->cfg._ownNodeId= nodeid;
+ return 0;
+}
+
+extern "C"
+int
ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle)
{
CHECK_HANDLE(handle, 0);