diff options
Diffstat (limited to 'ndb/src/kernel/vm')
-rw-r--r-- | ndb/src/kernel/vm/Configuration.cpp | 12 | ||||
-rw-r--r-- | ndb/src/kernel/vm/Configuration.hpp | 1 | ||||
-rw-r--r-- | ndb/src/kernel/vm/DLFifoList.hpp | 22 | ||||
-rw-r--r-- | ndb/src/kernel/vm/Emulator.cpp | 142 | ||||
-rw-r--r-- | ndb/src/kernel/vm/SignalCounter.hpp | 2 | ||||
-rw-r--r-- | ndb/src/kernel/vm/SimulatedBlock.cpp | 1 |
6 files changed, 53 insertions, 127 deletions
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index 0b680940105..03495449787 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -32,6 +32,9 @@ extern "C" { void ndbSetOwnVersion(); } +#include <EventLogger.hpp> +extern EventLogger g_eventLogger; + bool Configuration::init(int argc, const char** argv){ @@ -259,10 +262,6 @@ Configuration::setupConfiguration(){ delete p; - if (_lockPagesInMainMemory) { - NdbMem_MemLockAll(); - } - /** * Create the watch dog thread */ @@ -336,3 +335,8 @@ Configuration::getConnectStringCopy() const { return strdup(_connectString); return 0; } + +void +Configuration::setInitialStart(bool val){ + _initialStart = val; +} diff --git a/ndb/src/kernel/vm/Configuration.hpp b/ndb/src/kernel/vm/Configuration.hpp index e7e3a125394..3f96bb454c5 100644 --- a/ndb/src/kernel/vm/Configuration.hpp +++ b/ndb/src/kernel/vm/Configuration.hpp @@ -62,6 +62,7 @@ public: * */ bool getInitialStart() const; + void setInitialStart(bool val); bool getDaemonMode() const; private: diff --git a/ndb/src/kernel/vm/DLFifoList.hpp b/ndb/src/kernel/vm/DLFifoList.hpp index 0b40d00f56e..91b5b421b0c 100644 --- a/ndb/src/kernel/vm/DLFifoList.hpp +++ b/ndb/src/kernel/vm/DLFifoList.hpp @@ -60,6 +60,11 @@ public: void add(Ptr<T> &); /** + * Remove from list + */ + void remove(Ptr<T> &); + + /** * Return an object to pool */ void release(Uint32 i); @@ -241,14 +246,11 @@ DLFifoList<T>::release(Uint32 i){ p.p = thePool.getPtr(i); release(p); } - -/** - * Return an object to pool - */ + template <class T> inline void -DLFifoList<T>::release(Ptr<T> & p){ +DLFifoList<T>::remove(Ptr<T> & p){ T * t = p.p; Uint32 ni = t->nextList; Uint32 pi = t->prevList; @@ -268,6 +270,16 @@ DLFifoList<T>::release(Ptr<T> & p){ // We are releasing first head.firstItem = ni; } +} + +/** + * Return an object to pool + */ +template <class T> +inline +void +DLFifoList<T>::release(Ptr<T> & p){ + remove(p); thePool.release(p.i); } diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index 43b5619d202..a852e045c6e 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -34,11 +34,14 @@ #include <stdlib.h> #include <new> -#ifdef NDB_WIN32 -#include <new.h> -#include <process.h> -#define execvp _execvp -#define set_new_handler _set_new_handler +extern "C" { + extern void (* ndb_new_handler)(); +} + + +#if defined (NDB_LINUX) || defined (NDB_SOLARIS) +#include <sys/types.h> +#include <sys/wait.h> #endif /** @@ -73,7 +76,7 @@ EmulatorData::EmulatorData(){ } void -ndb_new_handler(){ +ndb_new_handler_impl(){ ERROR_SET(fatal, ERR_MEMALLOC, "New handler", ""); } @@ -88,11 +91,7 @@ EmulatorData::create(){ theShutdownMutex = NdbMutex_Create(); -#ifdef NDB_WIN32 - set_new_handler((_PNH)ndb_new_handler); -#else - std::set_new_handler(ndb_new_handler); -#endif + ndb_new_handler = ndb_new_handler_impl; } void @@ -110,60 +109,6 @@ EmulatorData::destroy(){ } void -NdbRestart(char * programName, - NdbRestartType type, char * connString){ -#if ! ( defined NDB_OSE || defined NDB_SOFTOSE) - int argc = 2; - switch(type){ - case NRT_NoStart_Restart: - case NRT_DoStart_InitialStart: - argc = 3; - break; - case NRT_NoStart_InitialStart: - argc = 4; - break; - case NRT_DoStart_Restart: - case NRT_Default: - default: - argc = 2; - break; - } - - if(connString != 0){ - argc += 2; - } - - char ** argv = new char * [argc]; - argv[0] = programName; - argv[argc - 1] = 0; - - switch(type){ - case NRT_NoStart_Restart: - argv[1] = "-n"; - break; - case NRT_DoStart_InitialStart: - argv[1] = "-i"; - break; - case NRT_NoStart_InitialStart: - argv[1] = "-n"; - argv[2] = "-i"; - break; - case NRT_DoStart_Restart: - case NRT_Default: - default: - break; - } - - if(connString != 0){ - argv[argc-3] = "-c"; - argv[argc-2] = connString; - } - - execvp(programName, argv); -#endif -} - -void NdbShutdown(NdbShutdownType type, NdbRestartType restartType){ @@ -181,27 +126,12 @@ NdbShutdown(NdbShutdownType type, globalData.theRestartFlag = perform_stop; bool restart = false; - char * progName = 0; - char * connString = 0; #if ! ( defined NDB_OSE || defined NDB_SOFTOSE) if((type != NST_Normal && globalEmulatorData.theConfiguration->stopOnError() == false) || type == NST_Restart) { restart = true; - progName = strdup(globalEmulatorData.theConfiguration->programName()); - connString = globalEmulatorData.theConfiguration->getConnectStringCopy(); - if(type != NST_Restart){ - /** - * If we crash before we started - * - * Do restart -n - */ - if(globalData.theStartLevel == NodeState::SL_STARTED) - restartType = NRT_Default; - else - restartType = NRT_NoStart_Restart; - } } #endif @@ -238,21 +168,18 @@ NdbShutdown(NdbShutdownType type, #endif if(type == NST_Watchdog){ - if(restart){ - NdbRestart(progName, restartType, connString); - } - /** - * Very serious + * Very serious, don't attempt to free, just die!! */ ndbout << "Watchdog shutdown completed - " << exitAbort << endl; #if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) ) + signal(6, SIG_DFL); abort(); #else - exit(1); + exit(-1); #endif } - + globalEmulatorData.theWatchDog->doStop(); #ifdef VM_TRACE @@ -265,7 +192,7 @@ NdbShutdown(NdbShutdownType type, globalTransporterRegistry.stopReceiving(); globalTransporterRegistry.removeAll(); - + #ifdef VM_TRACE #define UNLOAD (type != NST_ErrorHandler && type != NST_Watchdog) #else @@ -274,61 +201,44 @@ NdbShutdown(NdbShutdownType type, if(UNLOAD){ globalEmulatorData.theSimBlockList->unload(); globalEmulatorData.destroy(); - } - - if(type != NST_Normal && - type != NST_Restart){ - if(restart){ - NdbRestart(progName, restartType, connString); - } - + + if(type != NST_Normal && type != NST_Restart){ ndbout << "Error handler shutdown completed - " << exitAbort << endl; #if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) ) + signal(6, SIG_DFL); abort(); #else - exit(1); + exit(-1); #endif } /** - * This is a normal restart + * This is a normal restart, depend on angel */ if(type == NST_Restart){ - if(restart){ - NdbRestart(progName, restartType, connString); - } - /** - * What to do if in restart mode, but being unable to do it... - */ -#if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) ) - abort(); -#else - exit(1); -#endif + exit(restartType); } - - /** - * This is normal shutdown - */ + ndbout << "Shutdown completed - exiting" << endl; } else { /** * Shutdown is already in progress */ - + /** * If this is the watchdog, kill system the hard way */ if (type== NST_Watchdog){ ndbout << "Watchdog is killing system the hard way" << endl; #if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) ) + signal(6, SIG_DFL); abort(); #else - exit(1); + exit(-1); #endif } - + while(true) NdbSleep_MilliSleep(10); } diff --git a/ndb/src/kernel/vm/SignalCounter.hpp b/ndb/src/kernel/vm/SignalCounter.hpp index b05d0858867..d572551ea92 100644 --- a/ndb/src/kernel/vm/SignalCounter.hpp +++ b/ndb/src/kernel/vm/SignalCounter.hpp @@ -148,7 +148,7 @@ inline const char * SignalCounter::getText() const { static char buf[255]; - static char nodes[m_nodes.TextLength+1]; + static char nodes[NodeBitmask::TextLength+1]; snprintf(buf, sizeof(buf), "[SignalCounter: m_count=%d %s]", m_count, m_nodes.getText(nodes)); return buf; } diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp index b9bfcfebc7d..f36b3e43d42 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.cpp +++ b/ndb/src/kernel/vm/SimulatedBlock.cpp @@ -948,7 +948,6 @@ SimulatedBlock::FragmentInfo::FragmentInfo(Uint32 fragId, Uint32 sender){ m_sectionPtrI[0] = RNIL; m_sectionPtrI[1] = RNIL; m_sectionPtrI[2] = RNIL; - m_sectionPtrI[3] = RNIL; } SimulatedBlock::FragmentSendInfo::FragmentSendInfo() |