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 @@
#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
......
......@@ -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?
......
......@@ -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
......
......@@ -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);
}
/**
......
......@@ -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);
}
......
......@@ -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) {
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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*
......
......@@ -57,6 +57,8 @@ SocketClient::init()
return false;
}
DBUG_PRINT("info",("NDB_SOCKET: %d", m_sockfd));
return true;
}
......
......@@ -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) {
......
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