diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2005-07-14 18:02:32 +0200 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2005-07-14 18:02:32 +0200 |
commit | 66fccd8261f49c8c70b903b6073c4c120f28655a (patch) | |
tree | cc2c0bfca39689812ebbbac42ed1d42f690fcae5 /ndb | |
parent | 96dcb8c20dbce6561a1e025c5c8a86052771f15b (diff) | |
download | mariadb-git-66fccd8261f49c8c70b903b6073c4c120f28655a.tar.gz |
added debug prints
ndb/include/portlib/NdbTCP.h:
added debug prints
ndb/include/util/SocketServer.hpp:
added debug prints
ndb/src/common/mgmcommon/ConfigRetriever.cpp:
debug prints
ndb/src/common/mgmcommon/IPCConfig.cpp:
debug prints
ndb/src/common/portlib/NdbMutex.c:
debug prints
ndb/src/common/portlib/NdbTCP.cpp:
debug printout
ndb/src/common/portlib/NdbThread.c:
debug printout
ndb/src/common/transporter/TransporterRegistry.cpp:
debug printout
ndb/src/common/util/Parser.cpp:
debug printout
ndb/src/common/util/SocketClient.cpp:
debug printout
ndb/src/common/util/SocketServer.cpp:
debug printout
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/include/portlib/NdbTCP.h | 12 | ||||
-rw-r--r-- | ndb/include/util/SocketServer.hpp | 8 | ||||
-rw-r--r-- | ndb/src/common/mgmcommon/ConfigRetriever.cpp | 9 | ||||
-rw-r--r-- | ndb/src/common/mgmcommon/IPCConfig.cpp | 7 | ||||
-rw-r--r-- | ndb/src/common/portlib/NdbMutex.c | 16 | ||||
-rw-r--r-- | ndb/src/common/portlib/NdbTCP.cpp | 9 | ||||
-rw-r--r-- | ndb/src/common/portlib/NdbThread.c | 16 | ||||
-rw-r--r-- | ndb/src/common/transporter/TransporterRegistry.cpp | 12 | ||||
-rw-r--r-- | ndb/src/common/util/Parser.cpp | 21 | ||||
-rw-r--r-- | ndb/src/common/util/SocketClient.cpp | 2 | ||||
-rw-r--r-- | ndb/src/common/util/SocketServer.cpp | 4 |
11 files changed, 87 insertions, 29 deletions
diff --git a/ndb/include/portlib/NdbTCP.h b/ndb/include/portlib/NdbTCP.h index 8138a2ef354..308a3833ffd 100644 --- a/ndb/include/portlib/NdbTCP.h +++ b/ndb/include/portlib/NdbTCP.h @@ -31,7 +31,7 @@ #define NDB_NONBLOCK FNDELAY #define NDB_SOCKET_TYPE int #define NDB_INVALID_SOCKET -1 -#define NDB_CLOSE_SOCKET(x) close(x) +#define _NDB_CLOSE_SOCKET(x) close(x) /** * socklen_t not defined in the header files of OSE @@ -52,7 +52,7 @@ typedef int socklen_t; #define EWOULDBLOCK WSAEWOULDBLOCK #define NDB_SOCKET_TYPE SOCKET #define NDB_INVALID_SOCKET INVALID_SOCKET -#define NDB_CLOSE_SOCKET(x) closesocket(x) +#define _NDB_CLOSE_SOCKET(x) closesocket(x) #else @@ -64,7 +64,7 @@ typedef int socklen_t; #define NDB_NONBLOCK O_NONBLOCK #define NDB_SOCKET_TYPE int #define NDB_INVALID_SOCKET -1 -#define NDB_CLOSE_SOCKET(x) ::close(x) +#define _NDB_CLOSE_SOCKET(x) ::close(x) #define InetErrno errno @@ -89,6 +89,12 @@ extern "C" { */ int Ndb_getInAddr(struct in_addr * dst, const char *address); +#ifdef DBUG_OFF +#define NDB_CLOSE_SOCKET(fd) _NDB_CLOSE_SOCKET(fd) +#else +int NDB_CLOSE_SOCKET(int fd); +#endif + #ifdef __cplusplus } #endif diff --git a/ndb/include/util/SocketServer.hpp b/ndb/include/util/SocketServer.hpp index 9d8af204391..ee2dd31c41f 100644 --- a/ndb/include/util/SocketServer.hpp +++ b/ndb/include/util/SocketServer.hpp @@ -41,7 +41,13 @@ public: protected: friend class SocketServer; friend void* sessionThread_C(void*); - Session(NDB_SOCKET_TYPE sock): m_socket(sock){ m_stop = m_stopped = false;} + Session(NDB_SOCKET_TYPE sock): m_socket(sock) + { + DBUG_ENTER("SocketServer::Session"); + DBUG_PRINT("enter",("NDB_SOCKET: %d", m_socket)); + m_stop = m_stopped = false; + DBUG_VOID_RETURN; + } bool m_stop; // Has the session been ordered to stop? bool m_stopped; // Has the session stopped? diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index 648f3b4a52c..f77f823f2a4 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -47,6 +47,8 @@ ConfigRetriever::ConfigRetriever(const char * _connect_string, Uint32 version, Uint32 node_type) { + DBUG_ENTER("ConfigRetriever::ConfigRetriever"); + m_version = version; m_node_type = node_type; _ownNodeId= 0; @@ -55,23 +57,26 @@ ConfigRetriever::ConfigRetriever(const char * _connect_string, if (m_handle == 0) { setError(CR_ERROR, "Unable to allocate mgm handle"); - return; + DBUG_VOID_RETURN; } if (ndb_mgm_set_connectstring(m_handle, _connect_string)) { setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle)); - return; + DBUG_VOID_RETURN; } resetError(); + DBUG_VOID_RETURN; } ConfigRetriever::~ConfigRetriever() { + DBUG_ENTER("ConfigRetriever::~ConfigRetriever"); if (m_handle) { ndb_mgm_disconnect(m_handle); ndb_mgm_destroy_handle(&m_handle); } + DBUG_VOID_RETURN; } Uint32 diff --git a/ndb/src/common/mgmcommon/IPCConfig.cpp b/ndb/src/common/mgmcommon/IPCConfig.cpp index 86791490863..8cf5e6e8d45 100644 --- a/ndb/src/common/mgmcommon/IPCConfig.cpp +++ b/ndb/src/common/mgmcommon/IPCConfig.cpp @@ -114,7 +114,10 @@ IPCConfig::addRemoteNodeId(NodeId nodeId){ * Returns no of transporters configured */ int -IPCConfig::configureTransporters(TransporterRegistry * theTransporterRegistry){ +IPCConfig::configureTransporters(TransporterRegistry * theTransporterRegistry) +{ + DBUG_ENTER("IPCConfig::configureTransporters"); + int noOfTransportersCreated = 0; Uint32 noOfConnections; @@ -276,7 +279,7 @@ IPCConfig::configureTransporters(TransporterRegistry * theTransporterRegistry){ continue; } } - return noOfTransportersCreated; + DBUG_RETURN(noOfTransportersCreated); } /** diff --git a/ndb/src/common/portlib/NdbMutex.c b/ndb/src/common/portlib/NdbMutex.c index d3d39ea8cf7..18f8548e4e6 100644 --- a/ndb/src/common/portlib/NdbMutex.c +++ b/ndb/src/common/portlib/NdbMutex.c @@ -23,33 +23,37 @@ NdbMutex* NdbMutex_Create(void) { + DBUG_ENTER("NdbMutex_Create"); NdbMutex* pNdbMutex; int result; pNdbMutex = (NdbMutex*)NdbMem_Allocate(sizeof(NdbMutex)); + DBUG_PRINT("info",("NdbMem_Allocate 0x%lx",pNdbMutex)); if (pNdbMutex == NULL) - return NULL; + DBUG_RETURN(NULL); result = pthread_mutex_init(pNdbMutex, NULL); assert(result == 0); - return pNdbMutex; - + DBUG_RETURN(pNdbMutex); } int NdbMutex_Destroy(NdbMutex* p_mutex) { + DBUG_ENTER("NdbMutex_Destroy"); int result; if (p_mutex == NULL) - return -1; + DBUG_RETURN(-1); result = pthread_mutex_destroy(p_mutex); - free(p_mutex); + + DBUG_PRINT("info",("NdbMem_Free 0x%lx",p_mutex)); + NdbMem_Free(p_mutex); - return result; + DBUG_RETURN(result); } diff --git a/ndb/src/common/portlib/NdbTCP.cpp b/ndb/src/common/portlib/NdbTCP.cpp index a63f5a7ba27..c7b9d33c5f6 100644 --- a/ndb/src/common/portlib/NdbTCP.cpp +++ b/ndb/src/common/portlib/NdbTCP.cpp @@ -54,6 +54,15 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) { return -1; //DBUG_RETURN(-1); } +#ifndef DBUG_OFF +extern "C" +int NDB_CLOSE_SOCKET(int fd) +{ + DBUG_PRINT("info", ("NDB_CLOSE_SOCKET(%d)", fd)); + return _NDB_CLOSE_SOCKET(fd); +} +#endif + #if 0 int Ndb_getInAddr(struct in_addr * dst, const char *address) { diff --git a/ndb/src/common/portlib/NdbThread.c b/ndb/src/common/portlib/NdbThread.c index aaee9b45069..cee4ec018a0 100644 --- a/ndb/src/common/portlib/NdbThread.c +++ b/ndb/src/common/portlib/NdbThread.c @@ -56,6 +56,7 @@ ndb_thread_wrapper(void* _ss){ void *ret; struct NdbThread * ss = (struct NdbThread *)_ss; ret= (* ss->func)(ss->object); + DBUG_POP(); NdbThread_Exit(ret); } /* will never be reached */ @@ -70,6 +71,7 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, const char* p_thread_name, NDB_THREAD_PRIO thread_prio) { + DBUG_ENTER("NdbThread_Create"); struct NdbThread* tmpThread; int result; pthread_attr_t thread_attr; @@ -77,11 +79,13 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, (void)thread_prio; /* remove warning for unused parameter */ if (p_thread_func == NULL) - return 0; + DBUG_RETURN(NULL); tmpThread = (struct NdbThread*)NdbMem_Allocate(sizeof(struct NdbThread)); if (tmpThread == NULL) - return NULL; + DBUG_RETURN(NULL); + + DBUG_PRINT("info",("thread_name: %s", p_thread_name)); strnmov(tmpThread->thread_name,p_thread_name,sizeof(tmpThread->thread_name)); @@ -108,16 +112,20 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, assert(result==0); pthread_attr_destroy(&thread_attr); - return tmpThread; + DBUG_PRINT("exit",("ret: %lx", tmpThread)); + DBUG_RETURN(tmpThread); } void NdbThread_Destroy(struct NdbThread** p_thread) { - if (*p_thread != NULL){ + DBUG_ENTER("NdbThread_Destroy"); + if (*p_thread != NULL){ + DBUG_PRINT("enter",("*p_thread: %lx", * p_thread)); free(* p_thread); * p_thread = 0; } + DBUG_VOID_RETURN; } diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp index ac6161b314e..3e2c105fa2e 100644 --- a/ndb/src/common/transporter/TransporterRegistry.cpp +++ b/ndb/src/common/transporter/TransporterRegistry.cpp @@ -70,7 +70,9 @@ SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd) TransporterRegistry::TransporterRegistry(void * callback, unsigned _maxTransporters, - unsigned sizeOfLongSignalMemory) { + unsigned sizeOfLongSignalMemory) +{ + DBUG_ENTER("TransporterRegistry::TransporterRegistry"); nodeIdSpecified = false; maxTransporters = _maxTransporters; @@ -107,9 +109,13 @@ TransporterRegistry::TransporterRegistry(void * callback, theOSEReceiver = 0; theOSEJunkSocketSend = 0; theOSEJunkSocketRecv = 0; + + DBUG_VOID_RETURN; } -TransporterRegistry::~TransporterRegistry() { +TransporterRegistry::~TransporterRegistry() +{ + DBUG_ENTER("TransporterRegistry::~TransporterRegistry"); removeAll(); @@ -129,6 +135,8 @@ TransporterRegistry::~TransporterRegistry() { theOSEReceiver = 0; } #endif + + DBUG_VOID_RETURN; } void diff --git a/ndb/src/common/util/Parser.cpp b/ndb/src/common/util/Parser.cpp index dea128ccf66..d692aa18392 100644 --- a/ndb/src/common/util/Parser.cpp +++ b/ndb/src/common/util/Parser.cpp @@ -141,7 +141,10 @@ split(char * buf, char ** name, char ** value){ bool ParserImpl::run(Context * ctx, const class Properties ** pDst, - volatile bool * stop) const { + volatile bool * stop) const +{ + DBUG_ENTER("ParserImpl::run"); + * pDst = 0; bool ownStop = false; if(stop == 0) @@ -153,24 +156,24 @@ ParserImpl::run(Context * ctx, const class Properties ** pDst, ctx->m_currentToken = input.gets(ctx->m_tokenBuffer, sz); if(Eof(ctx->m_currentToken)){ ctx->m_status = Parser<Dummy>::Eof; - return false; + DBUG_RETURN(false); } if(ctx->m_currentToken[0] == 0){ ctx->m_status = Parser<Dummy>::NoLine; - return false; + DBUG_RETURN(false); } if(Empty(ctx->m_currentToken)){ ctx->m_status = Parser<Dummy>::EmptyLine; - return false; + DBUG_RETURN(false); } trim(ctx->m_currentToken); ctx->m_currentCmd = matchCommand(ctx, ctx->m_currentToken, m_rows); if(ctx->m_currentCmd == 0){ ctx->m_status = Parser<Dummy>::UnknownCommand; - return false; + DBUG_RETURN(false); } Properties * p = new Properties(); @@ -200,19 +203,19 @@ ParserImpl::run(Context * ctx, const class Properties ** pDst, tmp = input.gets(buf, sz); } while((! * stop) && !Eof(tmp) && !Empty(tmp)); } - return false; + DBUG_RETURN(false); } if(* stop){ delete p; ctx->m_status = Parser<Dummy>::ExternalStop; - return false; + DBUG_RETURN(false); } if(!checkMandatory(ctx, p)){ ctx->m_status = Parser<Dummy>::MissingMandatoryArgument; delete p; - return false; + DBUG_RETURN(false); } /** @@ -229,7 +232,7 @@ ParserImpl::run(Context * ctx, const class Properties ** pDst, ctx->m_status = Parser<Dummy>::Ok; * pDst = p; - return true; + DBUG_RETURN(true); } const ParserImpl::DummyRow* diff --git a/ndb/src/common/util/SocketClient.cpp b/ndb/src/common/util/SocketClient.cpp index 38df1417eb8..821624eb5c4 100644 --- a/ndb/src/common/util/SocketClient.cpp +++ b/ndb/src/common/util/SocketClient.cpp @@ -57,6 +57,8 @@ SocketClient::init() return false; } + DBUG_PRINT("info",("NDB_SOCKET: %d", m_sockfd)); + return true; } diff --git a/ndb/src/common/util/SocketServer.cpp b/ndb/src/common/util/SocketServer.cpp index da06389b5df..db5c03f925a 100644 --- a/ndb/src/common/util/SocketServer.cpp +++ b/ndb/src/common/util/SocketServer.cpp @@ -64,6 +64,8 @@ SocketServer::tryBind(unsigned short port, const char * intface) { return false; } + DBUG_PRINT("info",("NDB_SOCKET: %d", sock)); + const int on = 1; if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on)) == -1) { @@ -104,6 +106,8 @@ SocketServer::setup(SocketServer::Service * service, DBUG_RETURN(false); } + DBUG_PRINT("info",("NDB_SOCKET: %d", sock)); + const int on = 1; if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on)) == -1) { |