Commit 6014f67d authored by unknown's avatar unknown

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
parent 97f79493
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#define NDB_NONBLOCK FNDELAY #define NDB_NONBLOCK FNDELAY
#define NDB_SOCKET_TYPE int #define NDB_SOCKET_TYPE int
#define NDB_INVALID_SOCKET -1 #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 * socklen_t not defined in the header files of OSE
...@@ -52,7 +52,7 @@ typedef int socklen_t; ...@@ -52,7 +52,7 @@ typedef int socklen_t;
#define EWOULDBLOCK WSAEWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK
#define NDB_SOCKET_TYPE SOCKET #define NDB_SOCKET_TYPE SOCKET
#define NDB_INVALID_SOCKET INVALID_SOCKET #define NDB_INVALID_SOCKET INVALID_SOCKET
#define NDB_CLOSE_SOCKET(x) closesocket(x) #define _NDB_CLOSE_SOCKET(x) closesocket(x)
#else #else
...@@ -64,7 +64,7 @@ typedef int socklen_t; ...@@ -64,7 +64,7 @@ typedef int socklen_t;
#define NDB_NONBLOCK O_NONBLOCK #define NDB_NONBLOCK O_NONBLOCK
#define NDB_SOCKET_TYPE int #define NDB_SOCKET_TYPE int
#define NDB_INVALID_SOCKET -1 #define NDB_INVALID_SOCKET -1
#define NDB_CLOSE_SOCKET(x) ::close(x) #define _NDB_CLOSE_SOCKET(x) ::close(x)
#define InetErrno errno #define InetErrno errno
...@@ -89,6 +89,12 @@ extern "C" { ...@@ -89,6 +89,12 @@ extern "C" {
*/ */
int Ndb_getInAddr(struct in_addr * dst, const char *address); 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 #ifdef __cplusplus
} }
#endif #endif
......
...@@ -41,7 +41,13 @@ public: ...@@ -41,7 +41,13 @@ public:
protected: protected:
friend class SocketServer; friend class SocketServer;
friend void* sessionThread_C(void*); 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_stop; // Has the session been ordered to stop?
bool m_stopped; // Has the session stopped? bool m_stopped; // Has the session stopped?
......
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
ConfigRetriever::ConfigRetriever(const char * _connect_string, ConfigRetriever::ConfigRetriever(const char * _connect_string,
Uint32 version, Uint32 node_type) Uint32 version, Uint32 node_type)
{ {
DBUG_ENTER("ConfigRetriever::ConfigRetriever");
m_version = version; m_version = version;
m_node_type = node_type; m_node_type = node_type;
_ownNodeId= 0; _ownNodeId= 0;
...@@ -55,23 +57,26 @@ ConfigRetriever::ConfigRetriever(const char * _connect_string, ...@@ -55,23 +57,26 @@ ConfigRetriever::ConfigRetriever(const char * _connect_string,
if (m_handle == 0) { if (m_handle == 0) {
setError(CR_ERROR, "Unable to allocate mgm handle"); setError(CR_ERROR, "Unable to allocate mgm handle");
return; DBUG_VOID_RETURN;
} }
if (ndb_mgm_set_connectstring(m_handle, _connect_string)) if (ndb_mgm_set_connectstring(m_handle, _connect_string))
{ {
setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle)); setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
return; DBUG_VOID_RETURN;
} }
resetError(); resetError();
DBUG_VOID_RETURN;
} }
ConfigRetriever::~ConfigRetriever() ConfigRetriever::~ConfigRetriever()
{ {
DBUG_ENTER("ConfigRetriever::~ConfigRetriever");
if (m_handle) { if (m_handle) {
ndb_mgm_disconnect(m_handle); ndb_mgm_disconnect(m_handle);
ndb_mgm_destroy_handle(&m_handle); ndb_mgm_destroy_handle(&m_handle);
} }
DBUG_VOID_RETURN;
} }
Uint32 Uint32
......
...@@ -114,7 +114,10 @@ IPCConfig::addRemoteNodeId(NodeId nodeId){ ...@@ -114,7 +114,10 @@ IPCConfig::addRemoteNodeId(NodeId nodeId){
* Returns no of transporters configured * Returns no of transporters configured
*/ */
int int
IPCConfig::configureTransporters(TransporterRegistry * theTransporterRegistry){ IPCConfig::configureTransporters(TransporterRegistry * theTransporterRegistry)
{
DBUG_ENTER("IPCConfig::configureTransporters");
int noOfTransportersCreated = 0; int noOfTransportersCreated = 0;
Uint32 noOfConnections; Uint32 noOfConnections;
...@@ -276,7 +279,7 @@ IPCConfig::configureTransporters(TransporterRegistry * theTransporterRegistry){ ...@@ -276,7 +279,7 @@ IPCConfig::configureTransporters(TransporterRegistry * theTransporterRegistry){
continue; continue;
} }
} }
return noOfTransportersCreated; DBUG_RETURN(noOfTransportersCreated);
} }
/** /**
......
...@@ -23,33 +23,37 @@ ...@@ -23,33 +23,37 @@
NdbMutex* NdbMutex_Create(void) NdbMutex* NdbMutex_Create(void)
{ {
DBUG_ENTER("NdbMutex_Create");
NdbMutex* pNdbMutex; NdbMutex* pNdbMutex;
int result; int result;
pNdbMutex = (NdbMutex*)NdbMem_Allocate(sizeof(NdbMutex)); pNdbMutex = (NdbMutex*)NdbMem_Allocate(sizeof(NdbMutex));
DBUG_PRINT("info",("NdbMem_Allocate 0x%lx",pNdbMutex));
if (pNdbMutex == NULL) if (pNdbMutex == NULL)
return NULL; DBUG_RETURN(NULL);
result = pthread_mutex_init(pNdbMutex, NULL); result = pthread_mutex_init(pNdbMutex, NULL);
assert(result == 0); assert(result == 0);
return pNdbMutex; DBUG_RETURN(pNdbMutex);
} }
int NdbMutex_Destroy(NdbMutex* p_mutex) int NdbMutex_Destroy(NdbMutex* p_mutex)
{ {
DBUG_ENTER("NdbMutex_Destroy");
int result; int result;
if (p_mutex == NULL) if (p_mutex == NULL)
return -1; DBUG_RETURN(-1);
result = pthread_mutex_destroy(p_mutex); 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);
} }
......
...@@ -54,6 +54,15 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) { ...@@ -54,6 +54,15 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
return -1; //DBUG_RETURN(-1); 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 #if 0
int int
Ndb_getInAddr(struct in_addr * dst, const char *address) { Ndb_getInAddr(struct in_addr * dst, const char *address) {
......
...@@ -56,6 +56,7 @@ ndb_thread_wrapper(void* _ss){ ...@@ -56,6 +56,7 @@ ndb_thread_wrapper(void* _ss){
void *ret; void *ret;
struct NdbThread * ss = (struct NdbThread *)_ss; struct NdbThread * ss = (struct NdbThread *)_ss;
ret= (* ss->func)(ss->object); ret= (* ss->func)(ss->object);
DBUG_POP();
NdbThread_Exit(ret); NdbThread_Exit(ret);
} }
/* will never be reached */ /* will never be reached */
...@@ -70,6 +71,7 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, ...@@ -70,6 +71,7 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
const char* p_thread_name, const char* p_thread_name,
NDB_THREAD_PRIO thread_prio) NDB_THREAD_PRIO thread_prio)
{ {
DBUG_ENTER("NdbThread_Create");
struct NdbThread* tmpThread; struct NdbThread* tmpThread;
int result; int result;
pthread_attr_t thread_attr; pthread_attr_t thread_attr;
...@@ -77,11 +79,13 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, ...@@ -77,11 +79,13 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
(void)thread_prio; /* remove warning for unused parameter */ (void)thread_prio; /* remove warning for unused parameter */
if (p_thread_func == NULL) if (p_thread_func == NULL)
return 0; DBUG_RETURN(NULL);
tmpThread = (struct NdbThread*)NdbMem_Allocate(sizeof(struct NdbThread)); tmpThread = (struct NdbThread*)NdbMem_Allocate(sizeof(struct NdbThread));
if (tmpThread == NULL) 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)); 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, ...@@ -108,16 +112,20 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
assert(result==0); assert(result==0);
pthread_attr_destroy(&thread_attr); pthread_attr_destroy(&thread_attr);
return tmpThread; DBUG_PRINT("exit",("ret: %lx", tmpThread));
DBUG_RETURN(tmpThread);
} }
void NdbThread_Destroy(struct NdbThread** p_thread) 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); free(* p_thread);
* p_thread = 0; * p_thread = 0;
} }
DBUG_VOID_RETURN;
} }
......
...@@ -70,7 +70,9 @@ SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd) ...@@ -70,7 +70,9 @@ SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
TransporterRegistry::TransporterRegistry(void * callback, TransporterRegistry::TransporterRegistry(void * callback,
unsigned _maxTransporters, unsigned _maxTransporters,
unsigned sizeOfLongSignalMemory) { unsigned sizeOfLongSignalMemory)
{
DBUG_ENTER("TransporterRegistry::TransporterRegistry");
nodeIdSpecified = false; nodeIdSpecified = false;
maxTransporters = _maxTransporters; maxTransporters = _maxTransporters;
...@@ -107,9 +109,13 @@ TransporterRegistry::TransporterRegistry(void * callback, ...@@ -107,9 +109,13 @@ TransporterRegistry::TransporterRegistry(void * callback,
theOSEReceiver = 0; theOSEReceiver = 0;
theOSEJunkSocketSend = 0; theOSEJunkSocketSend = 0;
theOSEJunkSocketRecv = 0; theOSEJunkSocketRecv = 0;
DBUG_VOID_RETURN;
} }
TransporterRegistry::~TransporterRegistry() { TransporterRegistry::~TransporterRegistry()
{
DBUG_ENTER("TransporterRegistry::~TransporterRegistry");
removeAll(); removeAll();
...@@ -129,6 +135,8 @@ TransporterRegistry::~TransporterRegistry() { ...@@ -129,6 +135,8 @@ TransporterRegistry::~TransporterRegistry() {
theOSEReceiver = 0; theOSEReceiver = 0;
} }
#endif #endif
DBUG_VOID_RETURN;
} }
void void
......
...@@ -141,7 +141,10 @@ split(char * buf, char ** name, char ** value){ ...@@ -141,7 +141,10 @@ split(char * buf, char ** name, char ** value){
bool bool
ParserImpl::run(Context * ctx, const class Properties ** pDst, ParserImpl::run(Context * ctx, const class Properties ** pDst,
volatile bool * stop) const { volatile bool * stop) const
{
DBUG_ENTER("ParserImpl::run");
* pDst = 0; * pDst = 0;
bool ownStop = false; bool ownStop = false;
if(stop == 0) if(stop == 0)
...@@ -153,24 +156,24 @@ ParserImpl::run(Context * ctx, const class Properties ** pDst, ...@@ -153,24 +156,24 @@ ParserImpl::run(Context * ctx, const class Properties ** pDst,
ctx->m_currentToken = input.gets(ctx->m_tokenBuffer, sz); ctx->m_currentToken = input.gets(ctx->m_tokenBuffer, sz);
if(Eof(ctx->m_currentToken)){ if(Eof(ctx->m_currentToken)){
ctx->m_status = Parser<Dummy>::Eof; ctx->m_status = Parser<Dummy>::Eof;
return false; DBUG_RETURN(false);
} }
if(ctx->m_currentToken[0] == 0){ if(ctx->m_currentToken[0] == 0){
ctx->m_status = Parser<Dummy>::NoLine; ctx->m_status = Parser<Dummy>::NoLine;
return false; DBUG_RETURN(false);
} }
if(Empty(ctx->m_currentToken)){ if(Empty(ctx->m_currentToken)){
ctx->m_status = Parser<Dummy>::EmptyLine; ctx->m_status = Parser<Dummy>::EmptyLine;
return false; DBUG_RETURN(false);
} }
trim(ctx->m_currentToken); trim(ctx->m_currentToken);
ctx->m_currentCmd = matchCommand(ctx, ctx->m_currentToken, m_rows); ctx->m_currentCmd = matchCommand(ctx, ctx->m_currentToken, m_rows);
if(ctx->m_currentCmd == 0){ if(ctx->m_currentCmd == 0){
ctx->m_status = Parser<Dummy>::UnknownCommand; ctx->m_status = Parser<Dummy>::UnknownCommand;
return false; DBUG_RETURN(false);
} }
Properties * p = new Properties(); Properties * p = new Properties();
...@@ -200,19 +203,19 @@ ParserImpl::run(Context * ctx, const class Properties ** pDst, ...@@ -200,19 +203,19 @@ ParserImpl::run(Context * ctx, const class Properties ** pDst,
tmp = input.gets(buf, sz); tmp = input.gets(buf, sz);
} while((! * stop) && !Eof(tmp) && !Empty(tmp)); } while((! * stop) && !Eof(tmp) && !Empty(tmp));
} }
return false; DBUG_RETURN(false);
} }
if(* stop){ if(* stop){
delete p; delete p;
ctx->m_status = Parser<Dummy>::ExternalStop; ctx->m_status = Parser<Dummy>::ExternalStop;
return false; DBUG_RETURN(false);
} }
if(!checkMandatory(ctx, p)){ if(!checkMandatory(ctx, p)){
ctx->m_status = Parser<Dummy>::MissingMandatoryArgument; ctx->m_status = Parser<Dummy>::MissingMandatoryArgument;
delete p; delete p;
return false; DBUG_RETURN(false);
} }
/** /**
...@@ -229,7 +232,7 @@ ParserImpl::run(Context * ctx, const class Properties ** pDst, ...@@ -229,7 +232,7 @@ ParserImpl::run(Context * ctx, const class Properties ** pDst,
ctx->m_status = Parser<Dummy>::Ok; ctx->m_status = Parser<Dummy>::Ok;
* pDst = p; * pDst = p;
return true; DBUG_RETURN(true);
} }
const ParserImpl::DummyRow* const ParserImpl::DummyRow*
......
...@@ -57,6 +57,8 @@ SocketClient::init() ...@@ -57,6 +57,8 @@ SocketClient::init()
return false; return false;
} }
DBUG_PRINT("info",("NDB_SOCKET: %d", m_sockfd));
return true; return true;
} }
......
...@@ -64,6 +64,8 @@ SocketServer::tryBind(unsigned short port, const char * intface) { ...@@ -64,6 +64,8 @@ SocketServer::tryBind(unsigned short port, const char * intface) {
return false; return false;
} }
DBUG_PRINT("info",("NDB_SOCKET: %d", sock));
const int on = 1; const int on = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(const char*)&on, sizeof(on)) == -1) { (const char*)&on, sizeof(on)) == -1) {
...@@ -104,6 +106,8 @@ SocketServer::setup(SocketServer::Service * service, ...@@ -104,6 +106,8 @@ SocketServer::setup(SocketServer::Service * service,
DBUG_RETURN(false); DBUG_RETURN(false);
} }
DBUG_PRINT("info",("NDB_SOCKET: %d", sock));
const int on = 1; const int on = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(const char*)&on, sizeof(on)) == -1) { (const char*)&on, sizeof(on)) == -1) {
......
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