#include <kernel_types.h>#include <TransporterRegistry.hpp>Include dependency graph for Emulator.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| struct | EmulatorData |
Defines | |
| #define | EMULATED_JAM_SIZE 1024 |
| #define | JAM_MASK ((EMULATED_JAM_SIZE * 4) - 1) |
Enumerations | |
| enum | NdbShutdownType { NST_Normal, NST_Watchdog, NST_ErrorHandler, NST_ErrorHandlerSignal, NST_Restart, NST_ErrorInsert, NST_ErrorHandlerStartup } |
| enum | NdbRestartType { NRT_Default = 0, NRT_NoStart_Restart = 1, NRT_DoStart_Restart = 2, NRT_NoStart_InitialStart = 3, NRT_DoStart_InitialStart = 4 } |
Functions | |
| void | NdbShutdown (NdbShutdownType type, NdbRestartType restartType=NRT_Default) |
Variables | |
| JobTable | globalJobTable |
| TimeQueue | globalTimeQueue |
| FastScheduler | globalScheduler |
| TransporterRegistry | globalTransporterRegistry |
| GlobalData | globalData |
| Uint8 | theEmulatedJam [] |
| Uint32 | theEmulatedJamIndex |
| Uint32 | theEmulatedJamBlockNumber |
| EmulatorData | globalEmulatorData |
| #define EMULATED_JAM_SIZE 1024 |
| #define JAM_MASK ((EMULATED_JAM_SIZE * 4) - 1) |
Definition at line 42 of file Emulator.hpp.
| enum NdbRestartType |
| NRT_Default | |
| NRT_NoStart_Restart | |
| NRT_DoStart_Restart | |
| NRT_NoStart_InitialStart | |
| NRT_DoStart_InitialStart |
Definition at line 91 of file Emulator.hpp.
00091 { 00092 NRT_Default = 0, 00093 NRT_NoStart_Restart = 1, // -n 00094 NRT_DoStart_Restart = 2, // 00095 NRT_NoStart_InitialStart = 3, // -n -i 00096 NRT_DoStart_InitialStart = 4 // -i 00097 };
| enum NdbShutdownType |
| NST_Normal | |
| NST_Watchdog | |
| NST_ErrorHandler | |
| NST_ErrorHandlerSignal | |
| NST_Restart | |
| NST_ErrorInsert | |
| NST_ErrorHandlerStartup |
Definition at line 81 of file Emulator.hpp.
00081 { 00082 NST_Normal, 00083 NST_Watchdog, 00084 NST_ErrorHandler, 00085 NST_ErrorHandlerSignal, 00086 NST_Restart, 00087 NST_ErrorInsert, 00088 NST_ErrorHandlerStartup 00089 };
| void NdbShutdown | ( | NdbShutdownType | type, | |
| NdbRestartType | restartType = NRT_Default | |||
| ) |
Shutdown/restart Ndb
| type | - Type of shutdown/restart | |
| restartType | - Type of restart (only valid if type == NST_Restart) |
Very serious, don't attempt to free, just die!!
Stop all transporter connection attempts and accepts
Stop transporter communication with other nodes
Remove all transporters
This is a normal restart, depend on angel
Shutdown is already in progress
If this is the watchdog, kill system the hard way
Definition at line 125 of file Emulator.cpp.
References childAbort(), childExit(), EmulatorData::destroy(), WatchDog::doStop(), g_currentStartPhase, g_eventLogger, Configuration::getRestartOnErrorInsert(), globalData, globalEmulatorData, globalTransporterRegistry, Logger::info(), EmulatorData::m_socket_server, NdbMutex_Trylock(), NdbSleep_MilliSleep(), NRT_Default, NST_ErrorHandler, NST_ErrorHandlerSignal, NST_ErrorHandlerStartup, NST_ErrorInsert, NST_Normal, NST_Restart, NST_Watchdog, opt_core, perform_stop, TransporterRegistry::removeAll(), SignalLoggerManager::setOutputStream(), simulate_error_during_shutdown, TransporterRegistry::stop_clients(), Configuration::stopOnError(), TransporterRegistry::stopReceiving(), TransporterRegistry::stopSending(), SocketServer::stopServer(), SocketServer::stopSessions(), EmulatorData::theConfiguration, GlobalData::theRestartFlag, theShutdownMutex, EmulatorData::theSimBlockList, EmulatorData::theWatchDog, SimBlockList::unload(), and UNLOAD.
Referenced by Cmvmi::execSTART_ORD(), ErrorReporter::handleAssert(), and main().
00127 { 00128 if(type == NST_ErrorInsert){ 00129 type = NST_Restart; 00130 restartType = (NdbRestartType) 00131 globalEmulatorData.theConfiguration->getRestartOnErrorInsert(); 00132 if(restartType == NRT_Default){ 00133 type = NST_ErrorHandler; 00134 globalEmulatorData.theConfiguration->stopOnError(true); 00135 } 00136 } 00137 00138 if((type == NST_ErrorHandlerSignal) || // Signal handler has already locked mutex 00139 (NdbMutex_Trylock(theShutdownMutex) == 0)){ 00140 globalData.theRestartFlag = perform_stop; 00141 00142 bool restart = false; 00143 #if ! ( defined NDB_OSE || defined NDB_SOFTOSE) 00144 if((type != NST_Normal && 00145 globalEmulatorData.theConfiguration->stopOnError() == false) || 00146 type == NST_Restart) { 00147 00148 restart = true; 00149 } 00150 #endif 00151 00152 const char * shutting = "shutting down"; 00153 if(restart){ 00154 shutting = "restarting"; 00155 } 00156 00157 switch(type){ 00158 case NST_Normal: 00159 g_eventLogger.info("Shutdown initiated"); 00160 break; 00161 case NST_Watchdog: 00162 g_eventLogger.info("Watchdog %s system", shutting); 00163 break; 00164 case NST_ErrorHandler: 00165 g_eventLogger.info("Error handler %s system", shutting); 00166 break; 00167 case NST_ErrorHandlerSignal: 00168 g_eventLogger.info("Error handler signal %s system", shutting); 00169 break; 00170 case NST_ErrorHandlerStartup: 00171 g_eventLogger.info("Error handler startup %s system", shutting); 00172 break; 00173 case NST_Restart: 00174 g_eventLogger.info("Restarting system"); 00175 break; 00176 default: 00177 g_eventLogger.info("Error handler %s system (unknown type: %u)", 00178 shutting, (unsigned)type); 00179 type = NST_ErrorHandler; 00180 break; 00181 } 00182 00183 const char * exitAbort = 0; 00184 if (opt_core) 00185 exitAbort = "aborting"; 00186 else 00187 exitAbort = "exiting"; 00188 00189 if(type == NST_Watchdog){ 00193 g_eventLogger.info("Watchdog shutdown completed - %s", exitAbort); 00194 if (opt_core) 00195 { 00196 childAbort(-1,g_currentStartPhase); 00197 } 00198 else 00199 { 00200 childExit(-1,g_currentStartPhase); 00201 } 00202 } 00203 00204 #ifndef NDB_WIN32 00205 if (simulate_error_during_shutdown) { 00206 kill(getpid(), simulate_error_during_shutdown); 00207 while(true) 00208 NdbSleep_MilliSleep(10); 00209 } 00210 #endif 00211 00212 globalEmulatorData.theWatchDog->doStop(); 00213 00214 #ifdef VM_TRACE 00215 FILE * outputStream = globalSignalLoggers.setOutputStream(0); 00216 if(outputStream != 0) 00217 fclose(outputStream); 00218 #endif 00219 00223 globalEmulatorData.m_socket_server->stopServer(); 00224 globalEmulatorData.m_socket_server->stopSessions(); 00225 globalTransporterRegistry.stop_clients(); 00226 00230 globalTransporterRegistry.stopSending(); 00231 globalTransporterRegistry.stopReceiving(); 00232 00236 globalTransporterRegistry.removeAll(); 00237 00238 #ifdef VM_TRACE 00239 #define UNLOAD (type != NST_ErrorHandler && type != NST_Watchdog) 00240 #else 00241 #define UNLOAD true 00242 #endif 00243 if(UNLOAD){ 00244 globalEmulatorData.theSimBlockList->unload(); 00245 globalEmulatorData.destroy(); 00246 } 00247 00248 if(type != NST_Normal && type != NST_Restart){ 00249 // Signal parent that error occured during startup 00250 if (type == NST_ErrorHandlerStartup) 00251 kill(getppid(), SIGUSR1); 00252 g_eventLogger.info("Error handler shutdown completed - %s", exitAbort); 00253 if (opt_core) 00254 { 00255 childAbort(-1,g_currentStartPhase); 00256 } 00257 else 00258 { 00259 childExit(-1,g_currentStartPhase); 00260 } 00261 } 00262 00266 if(type == NST_Restart){ 00267 childExit(restartType,g_currentStartPhase); 00268 } 00269 00270 g_eventLogger.info("Shutdown completed - exiting"); 00271 } else { 00279 if (type== NST_Watchdog){ 00280 g_eventLogger.info("Watchdog is killing system the hard way"); 00281 #if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) ) 00282 childAbort(-1,g_currentStartPhase); 00283 #else 00284 childExit(-1,g_currentStartPhase); 00285 #endif 00286 } 00287 00288 while(true) 00289 NdbSleep_MilliSleep(10); 00290 } 00291 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct GlobalData globalData |
Definition at line 688 of file AsyncFileTest.cpp.
| struct EmulatorData globalEmulatorData |
Definition at line 70 of file Emulator.cpp.
Referenced by catchsigs(), ErrorReporter::get_trace_no(), main(), NdbShutdown(), Configuration::setupConfiguration(), and WriteMessage().
| class JobTable globalJobTable |
| class FastScheduler globalScheduler |
Definition at line 63 of file Emulator.cpp.
Referenced by checkJobBuffer(), ThreadConfig::doStart(), Cmvmi::execSTART_ORD(), execute(), SimulatedBlock::infoEvent(), TimeQueue::insert(), ThreadConfig::ipControlLoop(), reportConnect(), reportDisconnect(), reportError(), reportReceiveLen(), reportSendLen(), TimeQueue::scanTable(), SimulatedBlock::sendSignal(), SimulatedBlock::warningEvent(), and WriteMessage().
| class TimeQueue globalTimeQueue |
Definition at line 62 of file Emulator.cpp.
Referenced by Cmvmi::execSTART_ORD(), ThreadConfig::scanTimeQueue(), and SimulatedBlock::sendSignalWithDelay().
Definition at line 64 of file Emulator.cpp.
Referenced by Qmgr::execAPI_VERSION_REQ(), Cmvmi::execCLOSE_COMREQ(), Cmvmi::execCONNECT_REP(), Cmvmi::execDISCONNECT_REP(), Cmvmi::execDUMP_STATE_ORD(), Cmvmi::execENABLE_COMORD(), Cmvmi::execOPEN_COMREQ(), Cmvmi::execSTART_ORD(), ThreadConfig::ipControlLoop(), main(), NdbShutdown(), SimulatedBlock::sendSignal(), and Configuration::setupConfiguration().
Declare the global variables
Definition at line 55 of file Emulator.cpp.
Referenced by ErrorReporter::handleAssert().
Definition at line 57 of file Emulator.cpp.
Referenced by dumpJam(), and ErrorReporter::handleAssert().
1.4.7

