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){
mgmtSrvrId.type = MgmId_TCP;
mgmtSrvrId.name.assign(tempString);
mgmtSrvrId.port = port;
printf("LocalConfig::parseHostName %d %s\n", port, tempString);
ids.push_back(mgmtSrvrId);
return true;
}
......@@ -200,9 +201,8 @@ LocalConfig::parseString(const char * connectString, char *line){
bool b_nodeId = false;
bool found_other = false;
for (char *tok = strtok_r(copy,";",&for_strtok); tok != 0;
tok = strtok_r(NULL, ";", &for_strtok)) {
for (char *tok = strtok_r(copy,";,",&for_strtok); tok != 0;
tok = strtok_r(NULL, ";,", &for_strtok)) {
if (tok[0] == '#') continue;
if (!b_nodeId) // only one nodeid definition allowed
......
......@@ -19,7 +19,7 @@
#include <NdbEnv.h>
#include <NdbMem.h>
static char *datadir_path= 0;
static const char *datadir_path= 0;
const char *
NdbConfig_get_path(int *_len)
......@@ -75,13 +75,14 @@ static
char *get_prefix_buf(int len, int node_id)
{
char tmp_buf[sizeof("ndb_pid#########")+1];
char *buf;
if (node_id > 0)
snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id);
else
snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u", getpid());
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);
return buf;
}
......
......@@ -2417,7 +2417,13 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
#endif
return true;
}
global_flag_send_heartbeat_now= 1;
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;
}
BaseString type_string, type_c_string;
{
const char *alias, *str;
......@@ -2856,6 +2862,10 @@ MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
MgmtSrvr::Allocated_resources::~Allocated_resources()
{
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);
}
......
......@@ -107,7 +107,7 @@ struct getargs args[] = {
{ "version", 'v', arg_flag, &_print_version,
"Print ndb_mgmd version"},
{ "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
{ "debug", 0, arg_string, &debug_option,
"Specify debug options e.g. d:t:i:o,out.trace", "options" },
......@@ -151,8 +151,8 @@ NDB_MAIN(mgmsrv){
glob.daemon= 0;
}
#ifndef DBUG_OFF
my_init();
#ifndef DBUG_OFF
if (debug_option)
DBUG_PUSH(debug_option);
#endif
......
......@@ -37,6 +37,8 @@
#include <mgmapi_configuration.hpp>
#include <mgmapi_config_parameters.h>
int global_flag_send_heartbeat_now= 0;
// Just a C wrapper for threadMain
extern "C"
void*
......@@ -177,6 +179,9 @@ ClusterMgr::threadMain( ){
/**
* 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();
for (int i = 1; i < MAX_NODES; i++){
/**
......@@ -199,12 +204,16 @@ ClusterMgr::threadMain( ){
}
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
*/
theNode.hbSent++;
theNode.hbCounter = 0;
if (theNode.hbCounter >= theNode.hbFrequency) {
theNode.hbSent++;
theNode.hbCounter = 0;
}
/**
* If the node is of type REP,
* then the receiver of the signal should be API_CLUSTERMGR
......
......@@ -38,11 +38,11 @@ void NdbGlobalEventBuffer_drop(NdbGlobalEventBufferHandle *);
/**
* Static object for NDB
*/
static int theNoOfNdbObjects = 0;
// only needed for backwards compatability, before ndb_cluster_connection
static char *ndbConnectString = 0;
static int theNoOfNdbObjects = 0;
static Ndb_cluster_connection *global_ndb_cluster_connection= 0;
#if defined NDB_WIN32 || defined SCO
static NdbMutex & createNdbMutex = * NdbMutex_Create();
#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