diff --git a/dbms/src/Server/Server.cpp b/dbms/src/Server/Server.cpp index 3ca6baa889a..0fe39f42edf 100644 --- a/dbms/src/Server/Server.cpp +++ b/dbms/src/Server/Server.cpp @@ -2,16 +2,13 @@ #include #include - #include #include #include - #include - +#include #include #include - #include #include #include @@ -22,22 +19,17 @@ #include #include #include - #include - #include #include #include #include - #include #include - #include #include #include #include - #include "ConfigReloader.h" #include "HTTPHandlerFactory.h" #include "MetricsTransmitter.h" @@ -49,7 +41,6 @@ #include #endif - namespace CurrentMetrics { extern const Metric Revision; @@ -76,6 +67,18 @@ static std::string getCanonicalPath(std::string && path) return path; } +void Server::uninitialize() +{ + logger().information("shutting down"); + BaseDaemon::uninitialize(); +} + +void Server::initialize(Poco::Util::Application & self) +{ + BaseDaemon::initialize(self); + logger().information("starting up"); +} + std::string Server::getDefaultCorePath() const { return getCanonicalPath(config().getString("path")) + "cores"; diff --git a/dbms/src/Server/Server.h b/dbms/src/Server/Server.h index b92b3755ee2..6cd6aa211bf 100644 --- a/dbms/src/Server/Server.h +++ b/dbms/src/Server/Server.h @@ -2,7 +2,6 @@ #include "IServer.h" -#include #include /** Server provides three interfaces: @@ -43,17 +42,9 @@ public: } protected: - void initialize(Application & self) override - { - BaseDaemon::initialize(self); - logger().information("starting up"); - } + void initialize(Application & self) override; - void uninitialize() override - { - logger().information("shutting down"); - BaseDaemon::uninitialize(); - } + void uninitialize() override; int main(const std::vector & args) override; diff --git a/dbms/src/Server/config.xml b/dbms/src/Server/config.xml index 3edc2cea553..62936425cbd 100644 --- a/dbms/src/Server/config.xml +++ b/dbms/src/Server/config.xml @@ -6,6 +6,7 @@ /var/log/clickhouse-server/clickhouse-server.err.log 1000M 10 + 8123 diff --git a/libs/libcommon/CMakeLists.txt b/libs/libcommon/CMakeLists.txt index 6f4be1c7b5c..0b150dd4413 100644 --- a/libs/libcommon/CMakeLists.txt +++ b/libs/libcommon/CMakeLists.txt @@ -17,7 +17,7 @@ if (APPLE) target_include_directories (apple_rt PUBLIC ${COMMON_INCLUDE_DIR}) endif () -add_library (common +add_library (common ${SPLIT_SHARED} src/DateLUT.cpp src/DateLUTImpl.cpp src/exp10.c diff --git a/libs/libdaemon/CMakeLists.txt b/libs/libdaemon/CMakeLists.txt index e0becc99fa4..ade93b7f659 100644 --- a/libs/libdaemon/CMakeLists.txt +++ b/libs/libdaemon/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library (daemon +add_library (daemon ${SPLIT_SHARED} src/BaseDaemon.cpp src/GraphiteWriter.cpp src/OwnPatternFormatter.cpp diff --git a/libs/libdaemon/src/BaseDaemon.cpp b/libs/libdaemon/src/BaseDaemon.cpp index 4029f03bfd9..54398be5c02 100644 --- a/libs/libdaemon/src/BaseDaemon.cpp +++ b/libs/libdaemon/src/BaseDaemon.cpp @@ -47,6 +47,8 @@ #include #include #include +#include +#include #include #include #include @@ -486,21 +488,9 @@ static void terminate_handler() static std::string createDirectory(const std::string & _path) { - Poco::Path path(_path); - std::string str; - for(int j=0;j map_config = new Poco::Util::MapConfiguration; + std::string key; + for(auto & arg : argv()) + { + auto key_start = arg.find_first_not_of('-'); + auto pos_minus = arg.find('-'); + auto pos_eq = arg.find('='); + + // old saved '--key', will set to some true value "1" + if (!key.empty() && pos_minus != std::string::npos && pos_minus < key_start) + { + map_config->setString(key, "1"); + key = ""; + } + + if (pos_eq == std::string::npos) + { + if (!key.empty()) + { + if (pos_minus == std::string::npos || pos_minus > key_start) + { + map_config->setString(key, arg); + } + key = ""; + } + if (pos_minus != std::string::npos && key_start != std::string::npos && pos_minus < key_start) + key = arg.substr(key_start); + continue; + } + else + { + key = ""; + } + + if (key_start == std::string::npos) + continue; + + if (pos_minus > key_start) + continue; + + key = arg.substr(key_start, pos_eq - key_start); + if (key.empty()) + continue; + std::string value; + if (arg.size() > pos_eq) + value = arg.substr(pos_eq+1); + + map_config->setString(key, value); + key = ""; + } + /// now highest priority (lowest value) is PRIO_APPLICATION = -100, we want higher! + config().add(map_config, PRIO_APPLICATION - 100); + } + bool is_daemon = config().getBool("application.runAsDaemon", false); if (is_daemon) diff --git a/libs/libmysqlxx/CMakeLists.txt b/libs/libmysqlxx/CMakeLists.txt index ca606c879d1..e3c9e836c22 100644 --- a/libs/libmysqlxx/CMakeLists.txt +++ b/libs/libmysqlxx/CMakeLists.txt @@ -1,5 +1,5 @@ -add_library (mysqlxx +add_library (mysqlxx ${SPLIT_SHARED} src/Connection.cpp src/Exception.cpp src/Query.cpp diff --git a/libs/libpocoext/CMakeLists.txt b/libs/libpocoext/CMakeLists.txt index 678d01b4c17..64745f6e8d2 100644 --- a/libs/libpocoext/CMakeLists.txt +++ b/libs/libpocoext/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library (pocoext +add_library (pocoext ${SPLIT_SHARED} src/LevelFilterChannel.cpp src/ThreadNumber.cpp