MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / mainEntryClickHouseServer

Function mainEntryClickHouseServer

programs/server/Server.cpp:517–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515
516int mainEntryClickHouseServer(int argc, char ** argv);
517int mainEntryClickHouseServer(int argc, char ** argv)
518{
519 DB::Server app;
520
521 /// Do not fork separate process from watchdog if we attached to terminal.
522 /// Otherwise it breaks gdb usage.
523 /// Can be overridden by environment variable (cannot use server config at this moment).
524 if (argc > 0)
525 {
526 const char * env_watchdog = getenv("CLICKHOUSE_WATCHDOG_ENABLE"); // NOLINT(concurrency-mt-unsafe)
527 if (env_watchdog)
528 {
529 if (0 == strcmp(env_watchdog, "1"))
530 app.shouldSetupWatchdog(argv[0]);
531
532 /// Other values disable watchdog explicitly.
533 }
534 else if (!isatty(STDIN_FILENO) && !isatty(STDOUT_FILENO) && !isatty(STDERR_FILENO))
535 app.shouldSetupWatchdog(argv[0]);
536 }
537
538 try
539 {
540 return app.run(argc, argv);
541 }
542 catch (...)
543 {
544 std::cerr << DB::getCurrentExceptionMessage(true) << "\n";
545 auto code = DB::getCurrentExceptionCode();
546 return static_cast<UInt8>(code) ? code : 1;
547 }
548}
549
550namespace DB
551{

Callers

nothing calls this directly

Calls 4

getCurrentExceptionCodeFunction · 0.85
shouldSetupWatchdogMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected