mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
PerformanceTest: use getMultiple*FromConfig, fix debug helpers (#915)
* PerformanceTest: use getMultiple*FromConfig, fix debug helpers * Missing file
This commit is contained in:
parent
990e62e579
commit
70d9fb06b4
@ -18,4 +18,14 @@ std::vector<std::string> getMultipleKeysFromConfig(Poco::Util::AbstractConfigura
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> getMultipleValuesFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name)
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
for (const auto & key : DB::getMultipleKeysFromConfig(config, root, name))
|
||||
values.emplace_back(config.getString(key));
|
||||
return values;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,4 +13,6 @@ namespace DB
|
||||
{
|
||||
/// get all internal key names for given key
|
||||
std::vector<std::string> getMultipleKeysFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name);
|
||||
/// Get all values for given key
|
||||
std::vector<std::string> getMultipleValuesFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <IO/WriteBufferFromFile.h>
|
||||
#include <Interpreters/Settings.h>
|
||||
#include <common/getMemoryAmount.h>
|
||||
|
||||
#include <Common/getMultipleKeysFromConfig.h>
|
||||
|
||||
#include <Poco/AutoPtr.h>
|
||||
#include <Poco/Exception.h>
|
||||
@ -857,15 +857,7 @@ private:
|
||||
|
||||
if (test_config->has("query"))
|
||||
{
|
||||
queries.push_back(test_config->getString("query"));
|
||||
for (size_t i = 1; ; ++i)
|
||||
{
|
||||
std::string key = "query[" + std::to_string(i) + "]";
|
||||
if (!test_config->has(key))
|
||||
break;
|
||||
|
||||
queries.push_back(test_config->getString(key));
|
||||
}
|
||||
queries = DB::getMultipleValuesFromConfig(*test_config, "", "query");
|
||||
}
|
||||
|
||||
if (test_config->has("query_file"))
|
||||
|
@ -439,11 +439,7 @@ int Server::main(const std::vector<std::string> & args)
|
||||
|
||||
std::vector<std::unique_ptr<Poco::Net::TCPServer>> servers;
|
||||
|
||||
std::vector<std::string> listen_hosts;
|
||||
for (const auto & key : DB::getMultipleKeysFromConfig(config(), "", "listen_host"))
|
||||
{
|
||||
listen_hosts.emplace_back(config().getString(key));
|
||||
}
|
||||
std::vector<std::string> listen_hosts = DB::getMultipleValuesFromConfig(config(), "", "listen_host");
|
||||
|
||||
bool try_listen = false;
|
||||
if (listen_hosts.empty())
|
||||
|
@ -27,6 +27,7 @@ add_library (common
|
||||
src/exp10.cpp
|
||||
src/JSON.cpp
|
||||
src/getMemoryAmount.cpp
|
||||
src/iostream_debug_helpers.cpp
|
||||
|
||||
include/common/ApplicationServerExt.h
|
||||
include/common/Types.h
|
||||
@ -43,6 +44,7 @@ add_library (common
|
||||
include/common/strong_typedef.h
|
||||
include/common/JSON.h
|
||||
include/common/getMemoryAmount.h
|
||||
include/common/iostream_debug_helpers.h
|
||||
|
||||
include/ext/bit_cast.h
|
||||
include/ext/collection_cast.h
|
||||
|
@ -160,13 +160,7 @@ std::ostream & operator<<(std::ostream & stream, const std::experimental::option
|
||||
}
|
||||
|
||||
|
||||
#include <exception>
|
||||
|
||||
std::ostream & operator<<(std::ostream & stream, const std::exception & what)
|
||||
{
|
||||
stream << "exception{" << what.what() << "}";
|
||||
return stream;
|
||||
}
|
||||
|
||||
namespace std { class exception; }
|
||||
std::ostream & operator<<(std::ostream & stream, const std::exception & what);
|
||||
|
||||
// TODO: add more types
|
||||
|
10
libs/libcommon/src/iostream_debug_helpers.cpp
Normal file
10
libs/libcommon/src/iostream_debug_helpers.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
#include "common/iostream_debug_helpers.h"
|
||||
|
||||
#include <exception>
|
||||
|
||||
std::ostream & operator<<(std::ostream & stream, const std::exception & what)
|
||||
{
|
||||
stream << "exception{" << what.what() << "}";
|
||||
return stream;
|
||||
}
|
Loading…
Reference in New Issue
Block a user