From 2cd71180efb88cd1f2969fd1b52f20db8a9f540f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Sep 2004 09:04:53 +0000 Subject: [PATCH] better error printouts on cannot alloc node id put ByteOrder config param back as depricated ndb/src/common/mgmcommon/ConfigInfo.cpp: put ByteOrder config param back as depricated ndb/src/mgmsrv/MgmtSrvr.cpp: better error printouts on cannot alloc node id --- ndb/src/common/mgmcommon/ConfigInfo.cpp | 12 ++++++++++++ ndb/src/mgmsrv/MgmtSrvr.cpp | 24 ++++++++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ndb/src/common/mgmcommon/ConfigInfo.cpp b/ndb/src/common/mgmcommon/ConfigInfo.cpp index 861e38d8c09..c6c7566ba10 100644 --- a/ndb/src/common/mgmcommon/ConfigInfo.cpp +++ b/ndb/src/common/mgmcommon/ConfigInfo.cpp @@ -259,6 +259,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { MANDATORY, 0, MAX_INT_RNIL }, + + { + KEY_INTERNAL, + "ByteOrder", + "COMPUTER", + 0, + ConfigInfo::DEPRICATED, + false, + ConfigInfo::STRING, + UNDEFINED, + 0, + 0 }, /**************************************************************************** * SYSTEM diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 90d84831255..5bad5f27b01 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -2332,6 +2332,9 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, bool found_matching_id= false; bool found_matching_type= false; bool found_free_node= false; + const char *config_hostname = 0; + struct in_addr config_addr= {0}; + int r_config_addr= -1; unsigned type_c= 0; ndb_mgm_configuration_iterator iter(*(ndb_mgm_configuration *)_config->m_configValues, @@ -2349,18 +2352,16 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, if (connected_nodes.get(tmp)) continue; found_free_node= true; - const char *config_hostname = 0; if(iter.get(CFG_NODE_HOST, &config_hostname)) abort(); if (config_hostname && config_hostname[0] != 0 && client_addr) { // check hostname compatability - struct in_addr config_addr; - const void *tmp= &(((sockaddr_in*)client_addr)->sin_addr); - if(Ndb_getInAddr(&config_addr, config_hostname) != 0 - || memcmp(&config_addr, tmp, sizeof(config_addr)) != 0) { + const void *tmp_in= &(((sockaddr_in*)client_addr)->sin_addr); + if((r_config_addr= Ndb_getInAddr(&config_addr, config_hostname)) != 0 + || memcmp(&config_addr, tmp_in, sizeof(config_addr)) != 0) { struct in_addr tmp_addr; if(Ndb_getInAddr(&tmp_addr, "localhost") != 0 - || memcmp(&tmp_addr, tmp, sizeof(config_addr)) != 0) { + || memcmp(&tmp_addr, tmp_in, sizeof(config_addr)) != 0) { // not localhost #if 0 ndbout << "MgmtSrvr::getFreeNodeId compare failed for \"" << config_hostname @@ -2402,7 +2403,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, if (found_matching_id) if (found_matching_type) if (found_free_node) - error_string.appfmt("Connection done from wrong host %s.", + error_string.appfmt("Connection done from wrong host ip %s.", inet_ntoa(((struct sockaddr_in *)(client_addr))->sin_addr)); else error_string.appfmt("No free node id found for %s.", type_string.c_str()); @@ -2413,10 +2414,13 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, } else { if (found_matching_id) if (found_matching_type) - if (found_free_node) - error_string.appfmt("Connection with id %d done from wrong host %s, expected host XX.", + if (found_free_node) { + // have to split these into two since inet_ntoa overwrites itself + error_string.appfmt("Connection with id %d done from wrong host ip %s,", *nodeId, inet_ntoa(((struct sockaddr_in *)(client_addr))->sin_addr)); - else + error_string.appfmt(" expected %s(%s).", config_hostname, + r_config_addr ? "lookup failed" : inet_ntoa(config_addr)); + } else error_string.appfmt("Id %d already allocated by another node.", *nodeId); else error_string.appfmt("Id %d configured as %s, connect attempted as %s.",