#include <ndb_global.h>#include <my_pthread.h>#include <ndb_version.h>#include "Configuration.hpp"#include <ConfigRetriever.hpp>#include <TransporterRegistry.hpp>#include "vm/SimBlockList.hpp"#include "ThreadConfig.hpp"#include <SignalLoggerManager.hpp>#include <NdbOut.hpp>#include <NdbMain.h>#include <NdbDaemon.h>#include <NdbSleep.h>#include <NdbConfig.h>#include <WatchDog.hpp>#include <LogLevel.hpp>#include <EventLogger.hpp>#include <NdbAutoPtr.hpp>#include <Properties.hpp>#include <mgmapi_debug.h>Include dependency graph for main.cpp:

Go to the source code of this file.
Defines | |
| #define | MAX_FAILED_STARTUPS 3 |
| #define | handler_register(signum, handler, ignore) |
Functions | |
| void | catchsigs (bool ignore) |
| void | handler_shutdown (int signum) |
| void | handler_error (int signum) |
| void | handler_sigusr1 (int signum) |
| void | systemInfo (const Configuration &conf, const LogLevel &ll) |
| static void | writeChildInfo (const char *token, int val) |
| void | childReportSignal (int signum) |
| void | childReportError (int error) |
| void | childExit (int code, Uint32 currentStartPhase) |
| void | childAbort (int code, Uint32 currentStartPhase) |
| static int | insert (const char *pair, Properties &p) |
| static int | readChildInfo (Properties &info) |
| static bool | get_int_property (Properties &info, const char *token, Uint32 *int_val) |
| int | reportShutdown (class Configuration *config, int error_exit, int restart) |
| int | main (int argc, char **argv) |
Variables | |
| EventLogger | g_eventLogger |
| NdbMutex * | theShutdownMutex |
| static bool | failed_startup_flag = false |
| static Uint32 | failed_startups = 0 |
| static FILE * | child_info_file_r = stdin |
| static FILE * | child_info_file_w = stdout |
Value:
{\
if (ignore) {\
if(signum != SIGCHLD)\
signal(signum, SIG_IGN);\
} else\
signal(signum, handler);\
}
Definition at line 532 of file main.cpp.
Referenced by catchsigs().
| void catchsigs | ( | bool | ignore | ) |
Definition at line 542 of file main.cpp.
References Configuration::getForegroundMode(), globalEmulatorData, handler_error(), handler_register, handler_shutdown(), SIGPIPE, SIGQUIT, and EmulatorData::theConfiguration.
Referenced by main().
00542 { 00543 #if !defined NDB_WIN32 && !defined NDB_SOFTOSE && !defined NDB_OSE 00544 00545 static const int signals_shutdown[] = { 00546 #ifdef SIGBREAK 00547 SIGBREAK, 00548 #endif 00549 SIGHUP, 00550 SIGINT, 00551 #if defined SIGPWR 00552 SIGPWR, 00553 #elif defined SIGINFO 00554 SIGINFO, 00555 #endif 00556 SIGQUIT, 00557 SIGTERM, 00558 #ifdef SIGTSTP 00559 SIGTSTP, 00560 #endif 00561 SIGTTIN, 00562 SIGTTOU 00563 }; 00564 00565 static const int signals_error[] = { 00566 SIGABRT, 00567 SIGALRM, 00568 #ifdef SIGBUS 00569 SIGBUS, 00570 #endif 00571 SIGCHLD, 00572 SIGFPE, 00573 SIGILL, 00574 #ifdef SIGIO 00575 SIGIO, 00576 #endif 00577 #ifdef SIGPOLL 00578 SIGPOLL, 00579 #endif 00580 SIGSEGV 00581 }; 00582 00583 static const int signals_ignore[] = { 00584 SIGPIPE 00585 }; 00586 00587 size_t i; 00588 for(i = 0; i < sizeof(signals_shutdown)/sizeof(signals_shutdown[0]); i++) 00589 handler_register(signals_shutdown[i], handler_shutdown, ignore); 00590 for(i = 0; i < sizeof(signals_error)/sizeof(signals_error[0]); i++) 00591 handler_register(signals_error[i], handler_error, ignore); 00592 for(i = 0; i < sizeof(signals_ignore)/sizeof(signals_ignore[0]); i++) 00593 handler_register(signals_ignore[i], SIG_IGN, ignore); 00594 #ifdef SIGTRAP 00595 Configuration* theConfig = globalEmulatorData.theConfiguration; 00596 if (! theConfig->getForegroundMode()) 00597 handler_register(SIGTRAP, handler_error, ignore); 00598 #endif 00599 #endif 00600 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void childAbort | ( | int | code, | |
| Uint32 | currentStartPhase | |||
| ) |
Definition at line 97 of file main.cpp.
Referenced by NdbShutdown().
00098 { 00099 writeChildInfo("sphase", currentStartPhase); 00100 writeChildInfo("exit", code); 00101 fprintf(child_info_file_w, "\n"); 00102 fclose(child_info_file_r); 00103 fclose(child_info_file_w); 00104 signal(6, SIG_DFL); 00105 abort(); 00106 }
Here is the caller graph for this function:

| void childExit | ( | int | code, | |
| Uint32 | currentStartPhase | |||
| ) |
Definition at line 87 of file main.cpp.
Referenced by NdbShutdown().
00088 { 00089 writeChildInfo("sphase", currentStartPhase); 00090 writeChildInfo("exit", code); 00091 fprintf(child_info_file_w, "\n"); 00092 fclose(child_info_file_r); 00093 fclose(child_info_file_w); 00094 exit(code); 00095 }
Here is the caller graph for this function:

| void childReportError | ( | int | error | ) |
Definition at line 82 of file main.cpp.
References writeChildInfo().
00083 { 00084 writeChildInfo("error", error); 00085 }
Here is the call graph for this function:

| void childReportSignal | ( | int | signum | ) |
Definition at line 77 of file main.cpp.
References writeChildInfo().
Referenced by handler_error(), handler_shutdown(), and main().
00078 { 00079 writeChildInfo("signal", signum); 00080 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static bool get_int_property | ( | Properties & | info, | |
| const char * | token, | |||
| Uint32 * | int_val | |||
| ) | [static] |
Definition at line 131 of file main.cpp.
References endptr, Properties::get(), and strtol().
Referenced by reportShutdown().
00133 { 00134 const char *str_val= 0; 00135 if (!info.get(token, &str_val)) 00136 return false; 00137 char *endptr; 00138 long int tmp= strtol(str_val, &endptr, 10); 00139 if (str_val == endptr) 00140 return false; 00141 *int_val = tmp; 00142 return true; 00143 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void handler_error | ( | int | signum | ) |
Definition at line 613 of file main.cpp.
References childReportSignal(), ERROR_SET_SIGNAL, yaSSL::fatal, g_eventLogger, info, Logger::info(), my_thread_id(), NDBD_EXIT_OS_SIGNAL_RECEIVED, NdbMutex_Trylock(), NdbSleep_MilliSleep(), BaseString::snprintf(), theShutdownMutex, and thread_id.
Referenced by catchsigs().
00613 { 00614 // only let one thread run shutdown 00615 static long thread_id= 0; 00616 00617 if (thread_id != 0 && thread_id == my_thread_id()) 00618 { 00619 // Shutdown thread received signal 00620 #ifndef NDB_WIN32 00621 signal(signum, SIG_DFL); 00622 kill(getpid(), signum); 00623 #endif 00624 while(true) 00625 NdbSleep_MilliSleep(10); 00626 } 00627 if(theShutdownMutex && NdbMutex_Trylock(theShutdownMutex) != 0) 00628 while(true) 00629 NdbSleep_MilliSleep(10); 00630 thread_id= my_thread_id(); 00631 g_eventLogger.info("Received signal %d. Running error handler.", signum); 00632 childReportSignal(signum); 00633 // restart the system 00634 char errorData[64], *info= 0; 00635 #ifdef HAVE_STRSIGNAL 00636 info= strsignal(signum); 00637 #endif 00638 BaseString::snprintf(errorData, sizeof(errorData), "Signal %d received; %s", signum, 00639 info ? info : "No text for signal available"); 00640 ERROR_SET_SIGNAL(fatal, NDBD_EXIT_OS_SIGNAL_RECEIVED, errorData, __FILE__); 00641 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void handler_shutdown | ( | int | signum | ) |
Definition at line 604 of file main.cpp.
References childReportError(), childReportSignal(), g_eventLogger, globalData, Logger::info(), perform_stop, and GlobalData::theRestartFlag.
Referenced by catchsigs().
00604 { 00605 g_eventLogger.info("Received signal %d. Performing stop.", signum); 00606 childReportError(0); 00607 childReportSignal(signum); 00608 globalData.theRestartFlag = perform_stop; 00609 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void handler_sigusr1 | ( | int | signum | ) |
Definition at line 645 of file main.cpp.
References failed_startup_flag, failed_startups, g_eventLogger, and Logger::info().
Referenced by main().
00646 { 00647 if (!failed_startup_flag) 00648 { 00649 failed_startups++; 00650 failed_startup_flag = true; 00651 } 00652 g_eventLogger.info("Angel received ndbd startup failure count %u.", failed_startups); 00653 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int insert | ( | const char * | pair, | |
| Properties & | p | |||
| ) | [static] |
Definition at line 108 of file main.cpp.
References p, BaseString::split(), split(), trim(), and BaseString::trim().
00109 { 00110 BaseString tmp(pair); 00111 00112 tmp.trim(" \t\n\r"); 00113 Vector<BaseString> split; 00114 tmp.split(split, ":=", 2); 00115 if(split.size() != 2) 00116 return -1; 00117 p.put(split[0].trim().c_str(), split[1].trim().c_str()); 00118 return 0; 00119 }
Here is the call graph for this function:

| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 230 of file main.cpp.
References Logger::alert(), assert, buf, catchsigs(), child_info_file_r, child_info_file_w, childReportSignal(), Configuration::closeConfiguration(), TransporterRegistry::connect_client(), EmulatorData::create(), Logger::createConsoleHandler(), WatchDog::doStart(), ThreadConfig::doStart(), Logger::enable(), errno, Logger::error(), ERROR_SET, exit, failed_startup_flag, failed_startups, yaSSL::fatal, Configuration::fetch_configuration(), g_eventLogger, Configuration::get_config_retriever(), ConfigRetriever::get_mgmHandlePtr(), Configuration::getDaemonMode(), Configuration::getForegroundMode(), globalData, globalEmulatorData, globalTransporterRegistry, handler_sigusr1(), Logger::info(), Configuration::init(), initial_state, ThreadConfig::ipControlLoop(), Logger::LL_CRITICAL, Logger::LL_ERROR, Logger::LL_INFO, Logger::LL_ON, Logger::LL_WARNING, LogLevel::llStartUp, SimBlockList::load(), logfile, SignalLoggerManager::LogInOut, Configuration::m_logLevel, EventLoggerBase::m_logLevel, EmulatorData::m_socket_server, MAX_FAILED_STARTUPS, my_setwd(), MYF, NDB_INIT, NdbConfig_get_path(), NdbConfig_PidFileName(), NdbConfig_SignalLogFileName(), NdbConfig_StdoutFileName(), NDBD_EXIT_INVALID_CONFIG, NdbDaemon_ErrorText, NdbDaemon_Make(), ndbout(), ndbout_c(), NdbShutdown(), NdbThread_SetConcurrencyLevel(), NRT_Default, NRT_DoStart_InitialStart, NRT_DoStart_Restart, NRT_NoStart_InitialStart, NRT_NoStart_Restart, NST_ErrorHandlerStartup, NST_Normal, GlobalData::ownId, perform_start, reportShutdown(), Logger::setCategory(), ErrorReporter::setErrorHandlerShutdownType(), Configuration::setInitialStart(), LogLevel::setLogLevel(), Configuration::setupConfiguration(), SIGPIPE, NodeState::SL_CMVMI, NodeState::SL_STARTING, TransporterRegistry::start_clients(), TransporterRegistry::start_service(), TransporterRegistry::startReceiving(), TransporterRegistry::startSending(), SocketServer::startServer(), status, Configuration::stopOnError(), systemInfo(), GlobalData::testOn, EmulatorData::theConfiguration, GlobalData::theRestartFlag, EmulatorData::theSimBlockList, EmulatorData::theThreadConfig, EmulatorData::theWatchDog, WEXITSTATUS, and WIFEXITED.
00231 { 00232 NDB_INIT(argv[0]); 00233 // Print to stdout/console 00234 g_eventLogger.createConsoleHandler(); 00235 g_eventLogger.setCategory("ndbd"); 00236 g_eventLogger.enable(Logger::LL_ON, Logger::LL_INFO); 00237 g_eventLogger.enable(Logger::LL_ON, Logger::LL_CRITICAL); 00238 g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR); 00239 g_eventLogger.enable(Logger::LL_ON, Logger::LL_WARNING); 00240 00241 g_eventLogger.m_logLevel.setLogLevel(LogLevel::llStartUp, 15); 00242 00243 globalEmulatorData.create(); 00244 00245 // Parse command line options 00246 Configuration* theConfig = globalEmulatorData.theConfiguration; 00247 if(!theConfig->init(argc, argv)){ 00248 return NRT_Default; 00249 } 00250 00251 { // Do configuration 00252 #ifndef NDB_WIN32 00253 signal(SIGPIPE, SIG_IGN); 00254 #endif 00255 theConfig->fetch_configuration(); 00256 } 00257 00258 my_setwd(NdbConfig_get_path(0), MYF(0)); 00259 00260 if (theConfig->getDaemonMode()) { 00261 // Become a daemon 00262 char *lockfile= NdbConfig_PidFileName(globalData.ownId); 00263 char *logfile= NdbConfig_StdoutFileName(globalData.ownId); 00264 NdbAutoPtr<char> tmp_aptr1(lockfile), tmp_aptr2(logfile); 00265 00266 if (NdbDaemon_Make(lockfile, logfile, 0) == -1) { 00267 ndbout << "Cannot become daemon: " << NdbDaemon_ErrorText << endl; 00268 return 1; 00269 } 00270 } 00271 00272 #ifndef NDB_WIN32 00273 signal(SIGUSR1, handler_sigusr1); 00274 00275 pid_t child = -1; 00276 while (! theConfig->getForegroundMode()) // the cond is const 00277 { 00278 // setup reporting between child and parent 00279 int filedes[2]; 00280 if (pipe(filedes)) 00281 { 00282 g_eventLogger.error("pipe() failed with errno=%d (%s)", 00283 errno, strerror(errno)); 00284 return 1; 00285 } 00286 else 00287 { 00288 if (!(child_info_file_w= fdopen(filedes[1],"w"))) 00289 { 00290 g_eventLogger.error("fdopen() failed with errno=%d (%s)", 00291 errno, strerror(errno)); 00292 } 00293 if (!(child_info_file_r= fdopen(filedes[0],"r"))) 00294 { 00295 g_eventLogger.error("fdopen() failed with errno=%d (%s)", 00296 errno, strerror(errno)); 00297 } 00298 } 00299 00300 if ((child = fork()) <= 0) 00301 break; // child or error 00302 00307 catchsigs(true); 00308 00316 theConfig->closeConfiguration(false); 00317 00318 int status = 0, error_exit = 0, signum = 0; 00319 while(waitpid(child, &status, 0) != child); 00320 if(WIFEXITED(status)){ 00321 switch(WEXITSTATUS(status)){ 00322 case NRT_Default: 00323 g_eventLogger.info("Angel shutting down"); 00324 reportShutdown(theConfig, 0, 0); 00325 exit(0); 00326 break; 00327 case NRT_NoStart_Restart: 00328 theConfig->setInitialStart(false); 00329 globalData.theRestartFlag = initial_state; 00330 break; 00331 case NRT_NoStart_InitialStart: 00332 theConfig->setInitialStart(true); 00333 globalData.theRestartFlag = initial_state; 00334 break; 00335 case NRT_DoStart_InitialStart: 00336 theConfig->setInitialStart(true); 00337 globalData.theRestartFlag = perform_start; 00338 break; 00339 default: 00340 error_exit = 1; 00341 if(theConfig->stopOnError()){ 00345 reportShutdown(theConfig, error_exit, 0); 00346 exit(0); 00347 } 00348 // Fall-through 00349 case NRT_DoStart_Restart: 00350 theConfig->setInitialStart(false); 00351 globalData.theRestartFlag = perform_start; 00352 break; 00353 } 00354 } else { 00355 error_exit = 1; 00356 if (WIFSIGNALED(status)) 00357 { 00358 signum = WTERMSIG(status); 00359 childReportSignal(signum); 00360 } 00361 else 00362 { 00363 signum = 127; 00364 g_eventLogger.info("Unknown exit reason. Stopped."); 00365 } 00366 if(theConfig->stopOnError()){ 00370 reportShutdown(theConfig, error_exit, 0); 00371 exit(0); 00372 } 00373 } 00374 00375 if (!failed_startup_flag) 00376 { 00377 // Reset the counter for consecutive failed startups 00378 failed_startups = 0; 00379 } 00380 else if (failed_startups >= MAX_FAILED_STARTUPS && !theConfig->stopOnError()) 00381 { 00385 g_eventLogger.alert("Ndbd has failed %u consecutive startups. " 00386 "Not restarting", failed_startups); 00387 reportShutdown(theConfig, error_exit, 0); 00388 exit(0); 00389 } 00390 failed_startup_flag = false; 00391 reportShutdown(theConfig, error_exit, 1); 00392 g_eventLogger.info("Ndb has terminated (pid %d) restarting", child); 00393 theConfig->fetch_configuration(); 00394 } 00395 00396 if (child >= 0) 00397 g_eventLogger.info("Angel pid: %d ndb pid: %d", getppid(), getpid()); 00398 else if (child > 0) 00399 g_eventLogger.info("Ndb pid: %d", getpid()); 00400 else 00401 g_eventLogger.info("Ndb started in foreground"); 00402 #else 00403 g_eventLogger.info("Ndb started"); 00404 #endif 00405 theConfig->setupConfiguration(); 00406 systemInfo(* theConfig, * theConfig->m_logLevel); 00407 00408 // Load blocks 00409 globalEmulatorData.theSimBlockList->load(globalEmulatorData); 00410 00411 // Set thread concurrency for Solaris' light weight processes 00412 int status; 00413 status = NdbThread_SetConcurrencyLevel(30); 00414 assert(status == 0); 00415 00416 #ifdef VM_TRACE 00417 // Create a signal logger 00418 char *buf= NdbConfig_SignalLogFileName(globalData.ownId); 00419 NdbAutoPtr<char> tmp_aptr(buf); 00420 FILE * signalLog = fopen(buf, "a"); 00421 globalSignalLoggers.setOwnNodeId(globalData.ownId); 00422 globalSignalLoggers.setOutputStream(signalLog); 00423 #if 0 // to log startup 00424 globalSignalLoggers.log(SignalLoggerManager::LogInOut, "BLOCK=DBDICT,DBDIH"); 00425 globalData.testOn = 1; 00426 #endif 00427 #endif 00428 00429 catchsigs(false); 00430 00435 ErrorReporter::setErrorHandlerShutdownType(NST_ErrorHandlerStartup); 00436 00437 switch(globalData.theRestartFlag){ 00438 case initial_state: 00439 globalEmulatorData.theThreadConfig->doStart(NodeState::SL_CMVMI); 00440 break; 00441 case perform_start: 00442 globalEmulatorData.theThreadConfig->doStart(NodeState::SL_CMVMI); 00443 globalEmulatorData.theThreadConfig->doStart(NodeState::SL_STARTING); 00444 break; 00445 default: 00446 assert("Illegal state globalData.theRestartFlag" == 0); 00447 } 00448 00449 globalTransporterRegistry.startSending(); 00450 globalTransporterRegistry.startReceiving(); 00451 if (!globalTransporterRegistry.start_service(*globalEmulatorData.m_socket_server)){ 00452 ndbout_c("globalTransporterRegistry.start_service() failed"); 00453 exit(-1); 00454 } 00455 00456 // Re-use the mgm handle as a transporter 00457 if(!globalTransporterRegistry.connect_client( 00458 theConfig->get_config_retriever()->get_mgmHandlePtr())) 00459 ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, 00460 "Connection to mgmd terminated before setup was complete", 00461 "StopOnError missing"); 00462 00463 if (!globalTransporterRegistry.start_clients()){ 00464 ndbout_c("globalTransporterRegistry.start_clients() failed"); 00465 exit(-1); 00466 } 00467 00468 globalEmulatorData.theWatchDog->doStart(); 00469 00470 globalEmulatorData.m_socket_server->startServer(); 00471 00472 // theConfig->closeConfiguration(); 00473 00474 globalEmulatorData.theThreadConfig->ipControlLoop(); 00475 00476 NdbShutdown(NST_Normal); 00477 00478 return NRT_Default; 00479 }
Here is the call graph for this function:

| static int readChildInfo | ( | Properties & | info | ) | [static] |
Definition at line 121 of file main.cpp.
References buf, child_info_file_r, child_info_file_w, and insert().
Referenced by reportShutdown().
00122 { 00123 fclose(child_info_file_w); 00124 char buf[128]; 00125 while (fgets(buf,sizeof(buf),child_info_file_r)) 00126 insert(buf,info); 00127 fclose(child_info_file_r); 00128 return 0; 00129 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int reportShutdown | ( | class Configuration * | config, | |
| int | error_exit, | |||
| int | restart | |||
| ) |
Definition at line 145 of file main.cpp.
References BaseString::append(), BaseString::c_str(), Logger::error(), error, g_eventLogger, get_int_property(), EventReport::getEventType(), EventReport::getNodeId(), globalData, h, handle_error(), info, initial_state, EventLogger::log(), n, NDB_LE_NDBStopCompleted, NDB_LE_NDBStopForced, ndb_mgm_connect(), ndb_mgm_create_handle(), ndb_mgm_destroy_handle(), ndb_mgm_disconnect(), ndb_mgm_get_latest_error_desc(), ndb_mgm_get_latest_error_msg(), ndb_mgm_report_event(), ndb_mgm_set_connectstring(), GlobalData::ownId, readChildInfo(), EventReport::setEventType(), EventReport::setNodeId(), GlobalData::theRestartFlag, and Logger::warning().
Referenced by main().
00146 { 00147 Uint32 error= 0, signum= 0, sphase= 256; 00148 Properties info; 00149 readChildInfo(info); 00150 00151 get_int_property(info, "signal", &signum); 00152 get_int_property(info, "error", &error); 00153 get_int_property(info, "sphase", &sphase); 00154 00155 Uint32 length, theData[25]; 00156 EventReport *rep = (EventReport *)theData; 00157 00158 rep->setNodeId(globalData.ownId); 00159 if (restart) 00160 theData[1] = 1 | 00161 (globalData.theRestartFlag == initial_state ? 2 : 0) | 00162 (config->getInitialStart() ? 4 : 0); 00163 else 00164 theData[1] = 0; 00165 00166 if (error_exit == 0) 00167 { 00168 rep->setEventType(NDB_LE_NDBStopCompleted); 00169 theData[2] = signum; 00170 length = 3; 00171 } 00172 else 00173 { 00174 rep->setEventType(NDB_LE_NDBStopForced); 00175 theData[2] = signum; 00176 theData[3] = error; 00177 theData[4] = sphase; 00178 theData[5] = 0; // extra 00179 length = 6; 00180 } 00181 00182 { // Log event 00183 const EventReport * const eventReport = (EventReport *)&theData[0]; 00184 g_eventLogger.log(eventReport->getEventType(), theData, 00185 eventReport->getNodeId(), 0); 00186 } 00187 00188 for (unsigned n = 0; n < config->m_mgmds.size(); n++) 00189 { 00190 NdbMgmHandle h = ndb_mgm_create_handle(); 00191 if (h == 0 || 00192 ndb_mgm_set_connectstring(h, config->m_mgmds[n].c_str()) || 00193 ndb_mgm_connect(h, 00194 1, //no_retries 00195 0, //retry_delay_in_seconds 00196 0 //verbose 00197 )) 00198 goto handle_error; 00199 00200 { 00201 if (ndb_mgm_report_event(h, theData, length)) 00202 goto handle_error; 00203 } 00204 goto do_next; 00205 00206 handle_error: 00207 if (h) 00208 { 00209 BaseString tmp(ndb_mgm_get_latest_error_msg(h)); 00210 tmp.append(" : "); 00211 tmp.append(ndb_mgm_get_latest_error_desc(h)); 00212 g_eventLogger.warning("Unable to report shutdown reason to %s: %s", 00213 config->m_mgmds[n].c_str(), tmp.c_str()); 00214 } 00215 else 00216 { 00217 g_eventLogger.error("Unable to report shutdown reason to %s", 00218 config->m_mgmds[n].c_str()); 00219 } 00220 do_next: 00221 if (h) 00222 { 00223 ndb_mgm_disconnect(h); 00224 ndb_mgm_destroy_handle(&h); 00225 } 00226 } 00227 return 0; 00228 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void systemInfo | ( | const Configuration & | conf, | |
| const LogLevel & | ll | |||
| ) |
Definition at line 483 of file main.cpp.
References g_eventLogger, LogLevel::getLogLevel(), globalData, Logger::info(), int(), LogLevel::llStartUp, memset, NDB_VERSION_STRING, and GlobalData::ownId.
Referenced by main().
00483 { 00484 #ifdef NDB_WIN32 00485 int processors = 0; 00486 int speed; 00487 SYSTEM_INFO sinfo; 00488 GetSystemInfo(&sinfo); 00489 processors = sinfo.dwNumberOfProcessors; 00490 HKEY hKey; 00491 if(ERROR_SUCCESS==RegOpenKeyEx 00492 (HKEY_LOCAL_MACHINE, 00493 TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"), 00494 0, KEY_READ, &hKey)) { 00495 DWORD dwMHz; 00496 DWORD cbData = sizeof(dwMHz); 00497 if(ERROR_SUCCESS==RegQueryValueEx(hKey, 00498 "~MHz", 0, 0, (LPBYTE)&dwMHz, &cbData)) { 00499 speed = int(dwMHz); 00500 } 00501 RegCloseKey(hKey); 00502 } 00503 #elif defined NDB_SOLARIS // ok 00504 // Search for at max 16 processors among the first 256 processor ids 00505 processor_info_t pinfo; memset(&pinfo, 0, sizeof(pinfo)); 00506 int pid = 0; 00507 while(processors < 16 && pid < 256){ 00508 if(!processor_info(pid++, &pinfo)) 00509 processors++; 00510 } 00511 speed = pinfo.pi_clock; 00512 #endif 00513 00514 if(logLevel.getLogLevel(LogLevel::llStartUp) > 0){ 00515 g_eventLogger.info("NDB Cluster -- DB node %d", globalData.ownId); 00516 g_eventLogger.info("%s --", NDB_VERSION_STRING); 00517 if (config.get_mgmd_host()) 00518 g_eventLogger.info("Configuration fetched at %s port %d", 00519 config.get_mgmd_host(), config.get_mgmd_port()); 00520 #ifdef NDB_SOLARIS // ok 00521 g_eventLogger.info("NDB is running on a machine with %d processor(s) at %d MHz", 00522 processor, speed); 00523 #endif 00524 } 00525 if(logLevel.getLogLevel(LogLevel::llStartUp) > 3){ 00526 Uint32 t = config.timeBetweenWatchDogCheck(); 00527 g_eventLogger.info("WatchDog timer is set to %d ms", t); 00528 } 00529 00530 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void writeChildInfo | ( | const char * | token, | |
| int | val | |||
| ) | [static] |
Definition at line 71 of file main.cpp.
References child_info_file_w.
Referenced by childAbort(), childExit(), childReportError(), and childReportSignal().
00072 { 00073 fprintf(child_info_file_w, "%s=%d\n", token, val); 00074 fflush(child_info_file_w); 00075 }
Here is the caller graph for this function:

FILE* child_info_file_r = stdin [static] |
Definition at line 68 of file main.cpp.
Referenced by childAbort(), childExit(), main(), and readChildInfo().
FILE* child_info_file_w = stdout [static] |
Definition at line 69 of file main.cpp.
Referenced by childAbort(), childExit(), main(), readChildInfo(), and writeChildInfo().
bool failed_startup_flag = false [static] |
Uint32 failed_startups = 0 [static] |
Definition at line 71 of file Emulator.cpp.
Referenced by EmulatorData::create(), EmulatorData::destroy(), EmulatorData::EmulatorData(), handler_error(), and NdbShutdown().
1.4.7

