mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
Merge pull request #19872 from ClickHouse/benchmark-reconnect-option
clickhouse-benchmark: add --reconnect option
This commit is contained in:
commit
eb7ebef6d6
@ -62,12 +62,12 @@ public:
|
|||||||
bool randomize_, size_t max_iterations_, double max_time_,
|
bool randomize_, size_t max_iterations_, double max_time_,
|
||||||
const String & json_path_, size_t confidence_,
|
const String & json_path_, size_t confidence_,
|
||||||
const String & query_id_, const String & query_to_execute_, bool continue_on_errors_,
|
const String & query_id_, const String & query_to_execute_, bool continue_on_errors_,
|
||||||
bool print_stacktrace_, const Settings & settings_)
|
bool reconnect_, bool print_stacktrace_, const Settings & settings_)
|
||||||
:
|
:
|
||||||
concurrency(concurrency_), delay(delay_), queue(concurrency), randomize(randomize_),
|
concurrency(concurrency_), delay(delay_), queue(concurrency), randomize(randomize_),
|
||||||
cumulative(cumulative_), max_iterations(max_iterations_), max_time(max_time_),
|
cumulative(cumulative_), max_iterations(max_iterations_), max_time(max_time_),
|
||||||
json_path(json_path_), confidence(confidence_), query_id(query_id_),
|
json_path(json_path_), confidence(confidence_), query_id(query_id_),
|
||||||
query_to_execute(query_to_execute_), continue_on_errors(continue_on_errors_),
|
query_to_execute(query_to_execute_), continue_on_errors(continue_on_errors_), reconnect(reconnect_),
|
||||||
print_stacktrace(print_stacktrace_), settings(settings_),
|
print_stacktrace(print_stacktrace_), settings(settings_),
|
||||||
shared_context(Context::createShared()), global_context(Context::createGlobal(shared_context.get())),
|
shared_context(Context::createShared()), global_context(Context::createGlobal(shared_context.get())),
|
||||||
pool(concurrency)
|
pool(concurrency)
|
||||||
@ -155,6 +155,7 @@ private:
|
|||||||
String query_id;
|
String query_id;
|
||||||
String query_to_execute;
|
String query_to_execute;
|
||||||
bool continue_on_errors;
|
bool continue_on_errors;
|
||||||
|
bool reconnect;
|
||||||
bool print_stacktrace;
|
bool print_stacktrace;
|
||||||
const Settings & settings;
|
const Settings & settings;
|
||||||
SharedContextHolder shared_context;
|
SharedContextHolder shared_context;
|
||||||
@ -404,9 +405,14 @@ private:
|
|||||||
void execute(EntryPtrs & connection_entries, Query & query, size_t connection_index)
|
void execute(EntryPtrs & connection_entries, Query & query, size_t connection_index)
|
||||||
{
|
{
|
||||||
Stopwatch watch;
|
Stopwatch watch;
|
||||||
|
|
||||||
|
Connection & connection = **connection_entries[connection_index];
|
||||||
|
|
||||||
|
if (reconnect)
|
||||||
|
connection.disconnect();
|
||||||
|
|
||||||
RemoteBlockInputStream stream(
|
RemoteBlockInputStream stream(
|
||||||
*(*connection_entries[connection_index]),
|
connection, query, {}, global_context, nullptr, Scalars(), Tables(), query_processing_stage);
|
||||||
query, {}, global_context, nullptr, Scalars(), Tables(), query_processing_stage);
|
|
||||||
if (!query_id.empty())
|
if (!query_id.empty())
|
||||||
stream.setQueryId(query_id);
|
stream.setQueryId(query_id);
|
||||||
|
|
||||||
@ -589,6 +595,7 @@ int mainEntryClickHouseBenchmark(int argc, char ** argv)
|
|||||||
("confidence", value<size_t>()->default_value(5), "set the level of confidence for T-test [0=80%, 1=90%, 2=95%, 3=98%, 4=99%, 5=99.5%(default)")
|
("confidence", value<size_t>()->default_value(5), "set the level of confidence for T-test [0=80%, 1=90%, 2=95%, 3=98%, 4=99%, 5=99.5%(default)")
|
||||||
("query_id", value<std::string>()->default_value(""), "")
|
("query_id", value<std::string>()->default_value(""), "")
|
||||||
("continue_on_errors", "continue testing even if a query fails")
|
("continue_on_errors", "continue testing even if a query fails")
|
||||||
|
("reconnect", "establish new connection for every query")
|
||||||
;
|
;
|
||||||
|
|
||||||
Settings settings;
|
Settings settings;
|
||||||
@ -638,7 +645,8 @@ int mainEntryClickHouseBenchmark(int argc, char ** argv)
|
|||||||
options["confidence"].as<size_t>(),
|
options["confidence"].as<size_t>(),
|
||||||
options["query_id"].as<std::string>(),
|
options["query_id"].as<std::string>(),
|
||||||
options["query"].as<std::string>(),
|
options["query"].as<std::string>(),
|
||||||
options.count("continue_on_errors") > 0,
|
options.count("continue_on_errors"),
|
||||||
|
options.count("reconnect"),
|
||||||
print_stacktrace,
|
print_stacktrace,
|
||||||
settings);
|
settings);
|
||||||
return benchmark.run();
|
return benchmark.run();
|
||||||
|
Loading…
Reference in New Issue
Block a user