Loading ndb/include/mgmapi/mgmapi.h +8 −0 Original line number Diff line number Diff line Loading @@ -394,6 +394,14 @@ extern "C" { */ const char * ndb_mgm_get_node_type_string(enum ndb_mgm_node_type type); /** * Convert an ndb_mgm_node_type to a alias string * * @param type Node type. * @return NULL if invalid id. */ const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type, const char **str); /** * Convert a string to a ndb_mgm_node_status * Loading ndb/src/common/mgmcommon/ConfigInfo.cpp +30 −1 Original line number Diff line number Diff line Loading @@ -161,6 +161,9 @@ const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule); /**************************************************************************** * Config Rules declarations ****************************************************************************/ static bool sanity_checks(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data); static bool add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data); Loading @@ -173,6 +176,7 @@ static bool check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>§ion const ConfigInfo::ConfigRule ConfigInfo::m_ConfigRules[] = { { sanity_checks, 0 }, { add_node_connections, 0 }, { add_server_ports, 0 }, { check_node_vs_replicas, 0 }, Loading Loading @@ -2958,6 +2962,29 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){ return true; } static bool sanity_checks(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data) { Uint32 db_nodes = 0; Uint32 mgm_nodes = 0; Uint32 api_nodes = 0; if (!ctx.m_userProperties.get("DB", &db_nodes)) { ctx.reportError("At least one database node should be defined in config file"); return false; } if (!ctx.m_userProperties.get("MGM", &mgm_nodes)) { ctx.reportError("At least one management server node should be defined in config file"); return false; } if (!ctx.m_userProperties.get("API", &api_nodes)) { ctx.reportError("At least one application node (for the mysqld) should be defined in config file"); return false; } return true; } static bool add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, Loading Loading @@ -3091,7 +3118,9 @@ check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>§ions, { Uint32 db_nodes = 0; Uint32 replicas = 0; ctx.m_userProperties.get("DB", &db_nodes); if (!ctx.m_userProperties.get("DB", &db_nodes)) { return true; } ctx.m_userProperties.get("NoOfReplicas", &replicas); if((db_nodes % replicas) != 0){ ctx.reportError("Invalid no of db nodes wrt no of replicas.\n" Loading ndb/src/common/mgmcommon/NdbConfig.c +29 −14 Original line number Diff line number Diff line Loading @@ -53,58 +53,73 @@ NdbConfig_NdbCfgName(int with_ndb_home){ return buf; } static char *get_prefix_buf(int len, int node_id) { char tmp_buf[sizeof("ndb_pid#########")+1]; 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)); strcat(buf, tmp_buf); return buf; } char* NdbConfig_ErrorFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_error.log", node_id); snprintf(buf+len, 128, "_error.log"); return buf; } char* NdbConfig_ClusterLogFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_cluster.log", node_id); snprintf(buf+len, 128, "_cluster.log"); return buf; } char* NdbConfig_SignalLogFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_signal.log", node_id); snprintf(buf+len, 128, "_signal.log"); return buf; } char* NdbConfig_TraceFileName(int node_id, int file_no){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_trace.log.%u", node_id, file_no); snprintf(buf+len, 128, "_trace.log.%u", file_no); return buf; } char* NdbConfig_NextTraceFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_trace.log.next", node_id); snprintf(buf+len, 128, "_trace.log.next"); return buf; } char* NdbConfig_PidFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u.pid", node_id); snprintf(buf+len, 128, ".pid"); return buf; } char* NdbConfig_StdoutFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_out.log", node_id); snprintf(buf+len, 128, "_out.log"); return buf; } ndb/src/kernel/error/ErrorReporter.cpp +24 −20 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ ErrorReporter::formatMessage(ErrorCategory type, objRef, programName, processId, theNameOfTheTraceFile); theNameOfTheTraceFile ? theNameOfTheTraceFile : "<no tracefile>"); // Add trailing blanks to get a fixed lenght of the message while (strlen(messptr) <= MESSAGE_LENGTH-3){ Loading Loading @@ -217,8 +217,10 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID, /** * Format trace file name */ int file_no= ErrorReporter::get_trace_no(); char *theTraceFileName= NdbConfig_TraceFileName(globalData.ownId, file_no); char *theTraceFileName= 0; if (globalData.ownId > 0) theTraceFileName= NdbConfig_TraceFileName(globalData.ownId, ErrorReporter::get_trace_no()); NdbAutoPtr<char> tmp_aptr1(theTraceFileName); // The first 69 bytes is info about the current offset Loading Loading @@ -291,6 +293,7 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID, fflush(stream); fclose(stream); if (theTraceFileName) { // Open the tracefile... FILE *jamStream = fopen(theTraceFileName, "w"); Loading @@ -310,6 +313,7 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID, globalScheduler.dumpSignalMemory(jamStream); fclose(jamStream); } return 0; } Loading ndb/src/mgmapi/mgmapi.cpp +18 −3 Original line number Diff line number Diff line Loading @@ -403,14 +403,15 @@ ndb_mgm_disconnect(NdbMgmHandle handle) struct ndb_mgm_type_atoi { const char * str; const char * alias; enum ndb_mgm_node_type value; }; static struct ndb_mgm_type_atoi type_values[] = { { "NDB", NDB_MGM_NODE_TYPE_NDB}, { "API", NDB_MGM_NODE_TYPE_API }, { "MGM", NDB_MGM_NODE_TYPE_MGM } { "NDB", "ndbd", NDB_MGM_NODE_TYPE_NDB}, { "API", "mysqld", NDB_MGM_NODE_TYPE_API }, { "MGM", "ndb_mgmd", NDB_MGM_NODE_TYPE_MGM } }; const int no_of_type_values = (sizeof(type_values) / Loading Loading @@ -440,6 +441,20 @@ ndb_mgm_get_node_type_string(enum ndb_mgm_node_type type) return 0; } extern "C" const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type, const char** str) { for(int i = 0; i<no_of_type_values; i++) if(type_values[i].value == type) { if (str) *str= type_values[i].str; return type_values[i].alias; } return 0; } struct ndb_mgm_status_atoi { const char * str; enum ndb_mgm_node_status value; Loading Loading
ndb/include/mgmapi/mgmapi.h +8 −0 Original line number Diff line number Diff line Loading @@ -394,6 +394,14 @@ extern "C" { */ const char * ndb_mgm_get_node_type_string(enum ndb_mgm_node_type type); /** * Convert an ndb_mgm_node_type to a alias string * * @param type Node type. * @return NULL if invalid id. */ const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type, const char **str); /** * Convert a string to a ndb_mgm_node_status * Loading
ndb/src/common/mgmcommon/ConfigInfo.cpp +30 −1 Original line number Diff line number Diff line Loading @@ -161,6 +161,9 @@ const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule); /**************************************************************************** * Config Rules declarations ****************************************************************************/ static bool sanity_checks(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data); static bool add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data); Loading @@ -173,6 +176,7 @@ static bool check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>§ion const ConfigInfo::ConfigRule ConfigInfo::m_ConfigRules[] = { { sanity_checks, 0 }, { add_node_connections, 0 }, { add_server_ports, 0 }, { check_node_vs_replicas, 0 }, Loading Loading @@ -2958,6 +2962,29 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){ return true; } static bool sanity_checks(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data) { Uint32 db_nodes = 0; Uint32 mgm_nodes = 0; Uint32 api_nodes = 0; if (!ctx.m_userProperties.get("DB", &db_nodes)) { ctx.reportError("At least one database node should be defined in config file"); return false; } if (!ctx.m_userProperties.get("MGM", &mgm_nodes)) { ctx.reportError("At least one management server node should be defined in config file"); return false; } if (!ctx.m_userProperties.get("API", &api_nodes)) { ctx.reportError("At least one application node (for the mysqld) should be defined in config file"); return false; } return true; } static bool add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, struct InitConfigFileParser::Context &ctx, Loading Loading @@ -3091,7 +3118,9 @@ check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>§ions, { Uint32 db_nodes = 0; Uint32 replicas = 0; ctx.m_userProperties.get("DB", &db_nodes); if (!ctx.m_userProperties.get("DB", &db_nodes)) { return true; } ctx.m_userProperties.get("NoOfReplicas", &replicas); if((db_nodes % replicas) != 0){ ctx.reportError("Invalid no of db nodes wrt no of replicas.\n" Loading
ndb/src/common/mgmcommon/NdbConfig.c +29 −14 Original line number Diff line number Diff line Loading @@ -53,58 +53,73 @@ NdbConfig_NdbCfgName(int with_ndb_home){ return buf; } static char *get_prefix_buf(int len, int node_id) { char tmp_buf[sizeof("ndb_pid#########")+1]; 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)); strcat(buf, tmp_buf); return buf; } char* NdbConfig_ErrorFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_error.log", node_id); snprintf(buf+len, 128, "_error.log"); return buf; } char* NdbConfig_ClusterLogFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_cluster.log", node_id); snprintf(buf+len, 128, "_cluster.log"); return buf; } char* NdbConfig_SignalLogFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_signal.log", node_id); snprintf(buf+len, 128, "_signal.log"); return buf; } char* NdbConfig_TraceFileName(int node_id, int file_no){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_trace.log.%u", node_id, file_no); snprintf(buf+len, 128, "_trace.log.%u", file_no); return buf; } char* NdbConfig_NextTraceFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_trace.log.next", node_id); snprintf(buf+len, 128, "_trace.log.next"); return buf; } char* NdbConfig_PidFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u.pid", node_id); snprintf(buf+len, 128, ".pid"); return buf; } char* NdbConfig_StdoutFileName(int node_id){ char *buf= NdbConfig_AllocHomePath(128); char *buf= get_prefix_buf(128, node_id); int len= strlen(buf); snprintf(buf+len, 128, "ndb_%u_out.log", node_id); snprintf(buf+len, 128, "_out.log"); return buf; }
ndb/src/kernel/error/ErrorReporter.cpp +24 −20 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ ErrorReporter::formatMessage(ErrorCategory type, objRef, programName, processId, theNameOfTheTraceFile); theNameOfTheTraceFile ? theNameOfTheTraceFile : "<no tracefile>"); // Add trailing blanks to get a fixed lenght of the message while (strlen(messptr) <= MESSAGE_LENGTH-3){ Loading Loading @@ -217,8 +217,10 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID, /** * Format trace file name */ int file_no= ErrorReporter::get_trace_no(); char *theTraceFileName= NdbConfig_TraceFileName(globalData.ownId, file_no); char *theTraceFileName= 0; if (globalData.ownId > 0) theTraceFileName= NdbConfig_TraceFileName(globalData.ownId, ErrorReporter::get_trace_no()); NdbAutoPtr<char> tmp_aptr1(theTraceFileName); // The first 69 bytes is info about the current offset Loading Loading @@ -291,6 +293,7 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID, fflush(stream); fclose(stream); if (theTraceFileName) { // Open the tracefile... FILE *jamStream = fopen(theTraceFileName, "w"); Loading @@ -310,6 +313,7 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID, globalScheduler.dumpSignalMemory(jamStream); fclose(jamStream); } return 0; } Loading
ndb/src/mgmapi/mgmapi.cpp +18 −3 Original line number Diff line number Diff line Loading @@ -403,14 +403,15 @@ ndb_mgm_disconnect(NdbMgmHandle handle) struct ndb_mgm_type_atoi { const char * str; const char * alias; enum ndb_mgm_node_type value; }; static struct ndb_mgm_type_atoi type_values[] = { { "NDB", NDB_MGM_NODE_TYPE_NDB}, { "API", NDB_MGM_NODE_TYPE_API }, { "MGM", NDB_MGM_NODE_TYPE_MGM } { "NDB", "ndbd", NDB_MGM_NODE_TYPE_NDB}, { "API", "mysqld", NDB_MGM_NODE_TYPE_API }, { "MGM", "ndb_mgmd", NDB_MGM_NODE_TYPE_MGM } }; const int no_of_type_values = (sizeof(type_values) / Loading Loading @@ -440,6 +441,20 @@ ndb_mgm_get_node_type_string(enum ndb_mgm_node_type type) return 0; } extern "C" const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type, const char** str) { for(int i = 0; i<no_of_type_values; i++) if(type_values[i].value == type) { if (str) *str= type_values[i].str; return type_values[i].alias; } return 0; } struct ndb_mgm_status_atoi { const char * str; enum ndb_mgm_node_status value; Loading