Loading ndb/include/portlib/NdbMutex.h +0 −2 Original line number Diff line number Diff line Loading @@ -31,13 +31,11 @@ extern "C" { #if defined NDB_OSE || defined NDB_SOFTOSE #include <ose.h> typedef SEMAPHORE NdbMutex; #define NDB_MUTEX_INITIALIZER { 1, 0, 0 } #elif defined NDB_WIN32 typedef CRITICAL_SECTION NdbMutex; #else #include <pthread.h> typedef pthread_mutex_t NdbMutex; #define NDB_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #endif /** Loading ndb/src/common/portlib/NdbTCP.cpp +14 −16 Original line number Diff line number Diff line Loading @@ -16,29 +16,27 @@ #include <ndb_global.h> #include <NdbMutex.h> #include <my_net.h> #include <NdbTCP.h> #if defined NDB_WIN32 || defined SCO static NdbMutex & LOCK_gethostbyname = * NdbMutex_Create(); #else static NdbMutex LOCK_gethostbyname = NDB_MUTEX_INITIALIZER; #endif extern "C" int Ndb_getInAddr(struct in_addr * dst, const char *address) { DBUG_ENTER("Ndb_getInAddr"); struct hostent * hostPtr; NdbMutex_Lock(&LOCK_gethostbyname); hostPtr = gethostbyname(address); if (hostPtr != NULL) { dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr; NdbMutex_Unlock(&LOCK_gethostbyname); { int tmp_errno; struct hostent tmp_hostent, *hp; char buff[GETHOSTBYNAME_BUFF_SIZE]; hp = my_gethostbyname_r(address,&tmp_hostent,buff,sizeof(buff), &tmp_errno); if (hp) { memcpy(dst, hp->h_addr, min(sizeof(*dst), (size_t) hp->h_length)); my_gethostbyname_r_free(); DBUG_RETURN(0); } NdbMutex_Unlock(&LOCK_gethostbyname); my_gethostbyname_r_free(); } /* Try it as aaa.bbb.ccc.ddd. */ dst->s_addr = inet_addr(address); if (dst->s_addr != Loading ndb/src/mgmsrv/MgmtSrvr.cpp +11 −9 Original line number Diff line number Diff line Loading @@ -534,6 +534,12 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId, m_statisticsListner.m_logLevel = se.m_logLevel; } if ((m_node_id_mutex = NdbMutex_Create()) == 0) { ndbout << "mutex creation failed line = " << __LINE__ << endl; exit(-1); } DBUG_VOID_RETURN; } Loading Loading @@ -627,7 +633,9 @@ MgmtSrvr::~MgmtSrvr() stopEventLog(); NdbCondition_Destroy(theMgmtWaitForResponseCondPtr); NdbMutex_Destroy(m_configMutex); NdbMutex_Destroy(m_node_id_mutex); NdbCondition_Destroy(theMgmtWaitForResponseCondPtr); NdbMutex_Destroy(m_configMutex); if(m_newConfig != NULL) free(m_newConfig); Loading Loading @@ -2087,12 +2095,6 @@ MgmtSrvr::getNodeType(NodeId nodeId) const return nodeTypes[nodeId]; } #ifdef NDB_WIN32 static NdbMutex & f_node_id_mutex = * NdbMutex_Create(); #else static NdbMutex f_node_id_mutex = NDB_MUTEX_INITIALIZER; #endif bool MgmtSrvr::alloc_node_id(NodeId * nodeId, enum ndb_mgm_node_type type, Loading @@ -2111,7 +2113,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, } DBUG_RETURN(true); } Guard g(&f_node_id_mutex); Guard g(m_node_id_mutex); int no_mgm= 0; NodeBitmask connected_nodes(m_reserved_nodes); for(Uint32 i = 0; i < MAX_NODES; i++) Loading Loading @@ -2528,7 +2530,7 @@ MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m) MgmtSrvr::Allocated_resources::~Allocated_resources() { Guard g(&f_node_id_mutex); Guard g(m_mgmsrv.m_node_id_mutex); if (!m_reserved_nodes.isclear()) { // node has been reserved, force update signal to ndb nodes global_flag_send_heartbeat_now= 1; Loading ndb/src/mgmsrv/MgmtSrvr.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public: MgmtSrvr &m_mgmsrv; NodeBitmask m_reserved_nodes; }; NdbMutex *m_node_id_mutex; /** * Start/initate the event log. Loading ndb/src/ndbapi/Ndb.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -1365,7 +1365,8 @@ Ndb::pollEvents(int aMillisecondNumber) #ifdef VM_TRACE #include <NdbMutex.h> static NdbMutex print_state_mutex = NDB_MUTEX_INITIALIZER; extern NdbMutex *ndb_print_state_mutex; static bool checkdups(NdbConnection** list, unsigned no) { Loading @@ -1383,7 +1384,7 @@ Ndb::printState(const char* fmt, ...) va_start(ap, fmt); vsprintf(buf, fmt, ap); va_end(ap); NdbMutex_Lock(&print_state_mutex); NdbMutex_Lock(ndb_print_state_mutex); bool dups = false; ndbout << buf << " ndb=" << hex << this << dec; #ifndef NDB_WIN32 Loading Loading @@ -1421,7 +1422,7 @@ Ndb::printState(const char* fmt, ...) } for (unsigned i = 0; i < theNoOfCompletedTransactions; i++) theCompletedTransactionsArray[i]->printState(); NdbMutex_Unlock(&print_state_mutex); NdbMutex_Unlock(ndb_print_state_mutex); } #endif Loading Loading
ndb/include/portlib/NdbMutex.h +0 −2 Original line number Diff line number Diff line Loading @@ -31,13 +31,11 @@ extern "C" { #if defined NDB_OSE || defined NDB_SOFTOSE #include <ose.h> typedef SEMAPHORE NdbMutex; #define NDB_MUTEX_INITIALIZER { 1, 0, 0 } #elif defined NDB_WIN32 typedef CRITICAL_SECTION NdbMutex; #else #include <pthread.h> typedef pthread_mutex_t NdbMutex; #define NDB_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #endif /** Loading
ndb/src/common/portlib/NdbTCP.cpp +14 −16 Original line number Diff line number Diff line Loading @@ -16,29 +16,27 @@ #include <ndb_global.h> #include <NdbMutex.h> #include <my_net.h> #include <NdbTCP.h> #if defined NDB_WIN32 || defined SCO static NdbMutex & LOCK_gethostbyname = * NdbMutex_Create(); #else static NdbMutex LOCK_gethostbyname = NDB_MUTEX_INITIALIZER; #endif extern "C" int Ndb_getInAddr(struct in_addr * dst, const char *address) { DBUG_ENTER("Ndb_getInAddr"); struct hostent * hostPtr; NdbMutex_Lock(&LOCK_gethostbyname); hostPtr = gethostbyname(address); if (hostPtr != NULL) { dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr; NdbMutex_Unlock(&LOCK_gethostbyname); { int tmp_errno; struct hostent tmp_hostent, *hp; char buff[GETHOSTBYNAME_BUFF_SIZE]; hp = my_gethostbyname_r(address,&tmp_hostent,buff,sizeof(buff), &tmp_errno); if (hp) { memcpy(dst, hp->h_addr, min(sizeof(*dst), (size_t) hp->h_length)); my_gethostbyname_r_free(); DBUG_RETURN(0); } NdbMutex_Unlock(&LOCK_gethostbyname); my_gethostbyname_r_free(); } /* Try it as aaa.bbb.ccc.ddd. */ dst->s_addr = inet_addr(address); if (dst->s_addr != Loading
ndb/src/mgmsrv/MgmtSrvr.cpp +11 −9 Original line number Diff line number Diff line Loading @@ -534,6 +534,12 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId, m_statisticsListner.m_logLevel = se.m_logLevel; } if ((m_node_id_mutex = NdbMutex_Create()) == 0) { ndbout << "mutex creation failed line = " << __LINE__ << endl; exit(-1); } DBUG_VOID_RETURN; } Loading Loading @@ -627,7 +633,9 @@ MgmtSrvr::~MgmtSrvr() stopEventLog(); NdbCondition_Destroy(theMgmtWaitForResponseCondPtr); NdbMutex_Destroy(m_configMutex); NdbMutex_Destroy(m_node_id_mutex); NdbCondition_Destroy(theMgmtWaitForResponseCondPtr); NdbMutex_Destroy(m_configMutex); if(m_newConfig != NULL) free(m_newConfig); Loading Loading @@ -2087,12 +2095,6 @@ MgmtSrvr::getNodeType(NodeId nodeId) const return nodeTypes[nodeId]; } #ifdef NDB_WIN32 static NdbMutex & f_node_id_mutex = * NdbMutex_Create(); #else static NdbMutex f_node_id_mutex = NDB_MUTEX_INITIALIZER; #endif bool MgmtSrvr::alloc_node_id(NodeId * nodeId, enum ndb_mgm_node_type type, Loading @@ -2111,7 +2113,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, } DBUG_RETURN(true); } Guard g(&f_node_id_mutex); Guard g(m_node_id_mutex); int no_mgm= 0; NodeBitmask connected_nodes(m_reserved_nodes); for(Uint32 i = 0; i < MAX_NODES; i++) Loading Loading @@ -2528,7 +2530,7 @@ MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m) MgmtSrvr::Allocated_resources::~Allocated_resources() { Guard g(&f_node_id_mutex); Guard g(m_mgmsrv.m_node_id_mutex); if (!m_reserved_nodes.isclear()) { // node has been reserved, force update signal to ndb nodes global_flag_send_heartbeat_now= 1; Loading
ndb/src/mgmsrv/MgmtSrvr.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public: MgmtSrvr &m_mgmsrv; NodeBitmask m_reserved_nodes; }; NdbMutex *m_node_id_mutex; /** * Start/initate the event log. Loading
ndb/src/ndbapi/Ndb.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -1365,7 +1365,8 @@ Ndb::pollEvents(int aMillisecondNumber) #ifdef VM_TRACE #include <NdbMutex.h> static NdbMutex print_state_mutex = NDB_MUTEX_INITIALIZER; extern NdbMutex *ndb_print_state_mutex; static bool checkdups(NdbConnection** list, unsigned no) { Loading @@ -1383,7 +1384,7 @@ Ndb::printState(const char* fmt, ...) va_start(ap, fmt); vsprintf(buf, fmt, ap); va_end(ap); NdbMutex_Lock(&print_state_mutex); NdbMutex_Lock(ndb_print_state_mutex); bool dups = false; ndbout << buf << " ndb=" << hex << this << dec; #ifndef NDB_WIN32 Loading Loading @@ -1421,7 +1422,7 @@ Ndb::printState(const char* fmt, ...) } for (unsigned i = 0; i < theNoOfCompletedTransactions; i++) theCompletedTransactionsArray[i]->printState(); NdbMutex_Unlock(&print_state_mutex); NdbMutex_Unlock(ndb_print_state_mutex); } #endif Loading