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

Function mainEntryClickHouseLocal

programs/local/LocalServer.cpp:1887–1921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1885int mainEntryClickHouseLocal(int argc, char ** argv);
1886
1887int mainEntryClickHouseLocal(int argc, char ** argv)
1888{
1889 DB::MainThreadStatus::getInstance();
1890
1891 /// Join global-pool threads before the statics they may have accessed are destroyed.
1892 /// That way, accesses happen-before destruction.
1893 SCOPE_EXIT_SAFE({
1894 DB::StaticThreadPool::shutdownAll();
1895 GlobalThreadPool::shutdown();
1896 });
1897
1898 try
1899 {
1900 DB::LocalServer app;
1901 app.init(argc, argv);
1902 return app.run();
1903 }
1904 catch (DB::Exception & e)
1905 {
1906 std::cerr << DB::getExceptionMessageForLogging(e, false) << std::endl;
1907 auto code = DB::getCurrentExceptionCode();
1908 return static_cast<UInt8>(code) ? code : 1;
1909 }
1910 catch (const boost::program_options::error & e)
1911 {
1912 std::cerr << "Bad arguments: " << e.what() << std::endl;
1913 return DB::ErrorCodes::BAD_ARGUMENTS;
1914 }
1915 catch (...)
1916 {
1917 std::cerr << DB::getCurrentExceptionMessage(true) << '\n';
1918 auto code = DB::getCurrentExceptionCode();
1919 return static_cast<UInt8>(code) ? code : 1;
1920 }
1921}

Callers 1

clickhouseMainFunction · 0.85

Calls 7

shutdownFunction · 0.85
getCurrentExceptionCodeFunction · 0.85
initMethod · 0.45
runMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected