mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #5627 from proller/fix25
Allow run query with remote() in clickhouse-local; Allow redefine config from command line for clickhouse-local
This commit is contained in:
commit
b0188e6e86
@ -34,6 +34,7 @@
|
||||
#include <Dictionaries/registerDictionaries.h>
|
||||
#include <boost/program_options/options_description.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <common/argsToConfig.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -497,6 +498,11 @@ void LocalServer::init(int argc, char ** argv)
|
||||
config().setString("logger.level", options["logger.level"].as<std::string>());
|
||||
if (options.count("ignore-error"))
|
||||
config().setBool("ignore-error", true);
|
||||
|
||||
std::vector<std::string> arguments;
|
||||
for (int arg_num = 1; arg_num < argc; ++arg_num)
|
||||
arguments.emplace_back(argv[arg_num]);
|
||||
argsToConfig(arguments, config(), 100);
|
||||
}
|
||||
|
||||
void LocalServer::applyCmdOptions()
|
||||
|
@ -1524,7 +1524,7 @@ UInt16 Context::getTCPPort() const
|
||||
auto lock = getLock();
|
||||
|
||||
auto & config = getConfigRef();
|
||||
return config.getInt("tcp_port");
|
||||
return config.getInt("tcp_port", DBMS_DEFAULT_PORT);
|
||||
}
|
||||
|
||||
std::optional<UInt16> Context::getTCPPortSecure() const
|
||||
|
@ -9,3 +9,5 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
1
|
||||
|
@ -24,3 +24,7 @@ $CLICKHOUSE_CLIENT -q "SELECT * FROM remote('${CLICKHOUSE_HOST}:${CLICKHOUSE_POR
|
||||
$CLICKHOUSE_CLIENT -q "SELECT * FROM remote(test_shard_localhost, system, one);"
|
||||
$CLICKHOUSE_CLIENT -q "SELECT * FROM remote(test_shard_localhost, system, one, 'default', '');"
|
||||
$CLICKHOUSE_CLIENT -q "SELECT * FROM cluster('test_shard_localhost', system, one);"
|
||||
|
||||
# Actually tcp_port is not used because we query localhost and it is done without IPC into clickhouse-local itself.
|
||||
$CLICKHOUSE_LOCAL --query "SELECT count() FROM remote('127.0.0.1', system.one)"
|
||||
$CLICKHOUSE_LOCAL --query "SELECT count() FROM remote('127.0.0.1', system.one)" -- --tcp_port=59000
|
||||
|
@ -13,15 +13,14 @@ class AbstractConfiguration;
|
||||
class Loggers
|
||||
{
|
||||
public:
|
||||
/// Строит необходимые логгеры
|
||||
void buildLoggers(Poco::Util::AbstractConfiguration & config, Poco::Logger & logger, const std::string & cmd_name = "");
|
||||
|
||||
/// Закрыть файлы с логами. При следующей записи, будут созданы новые файлы.
|
||||
/// Close log files. On next log write files will be reopened.
|
||||
void closeLogs(Poco::Logger & logger);
|
||||
|
||||
std::optional<size_t> getLayer() const
|
||||
{
|
||||
return layer; /// layer выставляется в классе-наследнике BaseDaemonApplication.
|
||||
return layer; /// layer setted in inheritor class BaseDaemonApplication.
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include "Loggers.h"
|
||||
|
||||
|
||||
OwnPatternFormatter::OwnPatternFormatter(const Loggers * daemon_, OwnPatternFormatter::Options options_)
|
||||
: Poco::PatternFormatter(""), daemon(daemon_), options(options_)
|
||||
OwnPatternFormatter::OwnPatternFormatter(const Loggers * loggers_, OwnPatternFormatter::Options options_)
|
||||
: Poco::PatternFormatter(""), loggers(loggers_), options(options_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -25,9 +25,9 @@ void OwnPatternFormatter::formatExtended(const DB::ExtendedLogMessage & msg_ext,
|
||||
|
||||
/// For syslog: tag must be before message and first whitespace.
|
||||
/// This code is only used in Yandex.Metrika and unneeded in ClickHouse.
|
||||
if ((options & ADD_LAYER_TAG) && daemon)
|
||||
if ((options & ADD_LAYER_TAG) && loggers)
|
||||
{
|
||||
auto layer = daemon->getLayer();
|
||||
auto layer = loggers->getLayer();
|
||||
if (layer)
|
||||
{
|
||||
writeCString("layer[", wb);
|
||||
|
@ -31,12 +31,12 @@ public:
|
||||
ADD_LAYER_TAG = 1 << 0
|
||||
};
|
||||
|
||||
OwnPatternFormatter(const Loggers * daemon_, Options options_ = ADD_NOTHING);
|
||||
OwnPatternFormatter(const Loggers * loggers_, Options options_ = ADD_NOTHING);
|
||||
|
||||
void format(const Poco::Message & msg, std::string & text) override;
|
||||
void formatExtended(const DB::ExtendedLogMessage & msg_ext, std::string & text);
|
||||
|
||||
private:
|
||||
const Loggers * daemon;
|
||||
const Loggers * loggers;
|
||||
Options options;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user