Commit fb7d91e7 authored by unknown's avatar unknown

added possibility to use comma-separated connectstring

compile error/warning fixes
added force of heartbeat
added ability to force heartbeat


ndb/src/common/mgmcommon/LocalConfig.cpp:
  added possibility to use comma-separated connectstring
ndb/src/common/mgmcommon/NdbConfig.c:
  compile error/warning fixes
ndb/src/mgmsrv/MgmtSrvr.cpp:
  added force of heartbeat
ndb/src/mgmsrv/main.cpp:
  changed help text
ndb/src/ndbapi/ClusterMgr.cpp:
  added ability to force heartbeat
ndb/src/ndbapi/Ndbinit.cpp:
  added comment
parent dc21dcd2
...@@ -169,6 +169,7 @@ LocalConfig::parseHostName(const char * buf){ ...@@ -169,6 +169,7 @@ LocalConfig::parseHostName(const char * buf){
mgmtSrvrId.type = MgmId_TCP; mgmtSrvrId.type = MgmId_TCP;
mgmtSrvrId.name.assign(tempString); mgmtSrvrId.name.assign(tempString);
mgmtSrvrId.port = port; mgmtSrvrId.port = port;
printf("LocalConfig::parseHostName %d %s\n", port, tempString);
ids.push_back(mgmtSrvrId); ids.push_back(mgmtSrvrId);
return true; return true;
} }
...@@ -200,9 +201,8 @@ LocalConfig::parseString(const char * connectString, char *line){ ...@@ -200,9 +201,8 @@ LocalConfig::parseString(const char * connectString, char *line){
bool b_nodeId = false; bool b_nodeId = false;
bool found_other = false; bool found_other = false;
for (char *tok = strtok_r(copy,";",&for_strtok); tok != 0; for (char *tok = strtok_r(copy,";,",&for_strtok); tok != 0;
tok = strtok_r(NULL, ";", &for_strtok)) { tok = strtok_r(NULL, ";,", &for_strtok)) {
if (tok[0] == '#') continue; if (tok[0] == '#') continue;
if (!b_nodeId) // only one nodeid definition allowed if (!b_nodeId) // only one nodeid definition allowed
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <NdbEnv.h> #include <NdbEnv.h>
#include <NdbMem.h> #include <NdbMem.h>
static char *datadir_path= 0; static const char *datadir_path= 0;
const char * const char *
NdbConfig_get_path(int *_len) NdbConfig_get_path(int *_len)
...@@ -75,13 +75,14 @@ static ...@@ -75,13 +75,14 @@ static
char *get_prefix_buf(int len, int node_id) char *get_prefix_buf(int len, int node_id)
{ {
char tmp_buf[sizeof("ndb_pid#########")+1]; char tmp_buf[sizeof("ndb_pid#########")+1];
char *buf;
if (node_id > 0) if (node_id > 0)
snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id); snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id);
else else
snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u", getpid()); snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u", getpid());
tmp_buf[sizeof(tmp_buf)-1]= 0; tmp_buf[sizeof(tmp_buf)-1]= 0;
char *buf= NdbConfig_AllocHomePath(len+strlen(tmp_buf)); buf= NdbConfig_AllocHomePath(len+strlen(tmp_buf));
strcat(buf, tmp_buf); strcat(buf, tmp_buf);
return buf; return buf;
} }
......
...@@ -2417,7 +2417,13 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, ...@@ -2417,7 +2417,13 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
#endif #endif
return true; return true;
} }
if (found_matching_type && !found_free_node) {
// we have a temporary error which might be due to that we have got the latest
// connect status from db-nodes. Force update.
global_flag_send_heartbeat_now= 1; global_flag_send_heartbeat_now= 1;
}
BaseString type_string, type_c_string; BaseString type_string, type_c_string;
{ {
const char *alias, *str; const char *alias, *str;
...@@ -2856,6 +2862,10 @@ MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m) ...@@ -2856,6 +2862,10 @@ MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
MgmtSrvr::Allocated_resources::~Allocated_resources() MgmtSrvr::Allocated_resources::~Allocated_resources()
{ {
Guard g(&f_node_id_mutex); Guard g(&f_node_id_mutex);
if (!m_reserved_nodes.isclear()) {
// node has been reserved, force update signal to ndb nodes
global_flag_send_heartbeat_now= 1;
}
m_mgmsrv.m_reserved_nodes.bitANDC(m_reserved_nodes); m_mgmsrv.m_reserved_nodes.bitANDC(m_reserved_nodes);
} }
......
...@@ -107,7 +107,7 @@ struct getargs args[] = { ...@@ -107,7 +107,7 @@ struct getargs args[] = {
{ "version", 'v', arg_flag, &_print_version, { "version", 'v', arg_flag, &_print_version,
"Print ndb_mgmd version"}, "Print ndb_mgmd version"},
{ "config-file", 'c', arg_string, &glob.config_filename, { "config-file", 'c', arg_string, &glob.config_filename,
"Specify cluster configuration file", "filename" }, "Specify cluster configuration file (will default use config.ini if available)", "filename" },
#ifndef DBUG_OFF #ifndef DBUG_OFF
{ "debug", 0, arg_string, &debug_option, { "debug", 0, arg_string, &debug_option,
"Specify debug options e.g. d:t:i:o,out.trace", "options" }, "Specify debug options e.g. d:t:i:o,out.trace", "options" },
...@@ -151,8 +151,8 @@ NDB_MAIN(mgmsrv){ ...@@ -151,8 +151,8 @@ NDB_MAIN(mgmsrv){
glob.daemon= 0; glob.daemon= 0;
} }
#ifndef DBUG_OFF
my_init(); my_init();
#ifndef DBUG_OFF
if (debug_option) if (debug_option)
DBUG_PUSH(debug_option); DBUG_PUSH(debug_option);
#endif #endif
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <mgmapi_configuration.hpp> #include <mgmapi_configuration.hpp>
#include <mgmapi_config_parameters.h> #include <mgmapi_config_parameters.h>
int global_flag_send_heartbeat_now= 0;
// Just a C wrapper for threadMain // Just a C wrapper for threadMain
extern "C" extern "C"
void* void*
...@@ -177,6 +179,9 @@ ClusterMgr::threadMain( ){ ...@@ -177,6 +179,9 @@ ClusterMgr::threadMain( ){
/** /**
* Start of Secure area for use of Transporter * Start of Secure area for use of Transporter
*/ */
int send_heartbeat_now= global_flag_send_heartbeat_now;
global_flag_send_heartbeat_now= 0;
theFacade.lock_mutex(); theFacade.lock_mutex();
for (int i = 1; i < MAX_NODES; i++){ for (int i = 1; i < MAX_NODES; i++){
/** /**
...@@ -199,12 +204,16 @@ ClusterMgr::threadMain( ){ ...@@ -199,12 +204,16 @@ ClusterMgr::threadMain( ){
} }
theNode.hbCounter += timeSlept; theNode.hbCounter += timeSlept;
if (theNode.hbCounter >= theNode.hbFrequency){ if (theNode.hbCounter >= theNode.hbFrequency ||
send_heartbeat_now) {
/** /**
* It is now time to send a new Heartbeat * It is now time to send a new Heartbeat
*/ */
if (theNode.hbCounter >= theNode.hbFrequency) {
theNode.hbSent++; theNode.hbSent++;
theNode.hbCounter = 0; theNode.hbCounter = 0;
}
/** /**
* If the node is of type REP, * If the node is of type REP,
* then the receiver of the signal should be API_CLUSTERMGR * then the receiver of the signal should be API_CLUSTERMGR
......
...@@ -38,11 +38,11 @@ void NdbGlobalEventBuffer_drop(NdbGlobalEventBufferHandle *); ...@@ -38,11 +38,11 @@ void NdbGlobalEventBuffer_drop(NdbGlobalEventBufferHandle *);
/** /**
* Static object for NDB * Static object for NDB
*/ */
static int theNoOfNdbObjects = 0;
// only needed for backwards compatability, before ndb_cluster_connection
static char *ndbConnectString = 0; static char *ndbConnectString = 0;
static int theNoOfNdbObjects = 0;
static Ndb_cluster_connection *global_ndb_cluster_connection= 0; static Ndb_cluster_connection *global_ndb_cluster_connection= 0;
#if defined NDB_WIN32 || defined SCO #if defined NDB_WIN32 || defined SCO
static NdbMutex & createNdbMutex = * NdbMutex_Create(); static NdbMutex & createNdbMutex = * NdbMutex_Create();
#else #else
......
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