mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 23:54:31 +02:00
reuse nodeid if ndbd is restarted
mysql-test/mysql-test-run.pl: start and exit fix for ndbcluster
This commit is contained in:
parent
c3dec835b5
commit
2eb2383ed0
6 changed files with 32 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ public:
|
|||
*/
|
||||
Uint32 allocNodeId(int no_retries, int retry_delay_in_seconds);
|
||||
|
||||
int setNodeId(Uint32 nodeid);
|
||||
|
||||
/**
|
||||
* Get config using socket
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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){
|
||||
|
|
|
|||
|
|
@ -1720,6 +1720,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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue