mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
allow implicit initialization
This commit is contained in:
parent
1a63972a4b
commit
f0fbba5522
@ -560,8 +560,6 @@ int mainEntryClickHouseBenchmark(int argc, char ** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalThreadPool::initialize();
|
|
||||||
|
|
||||||
print_stacktrace = options.count("stacktrace");
|
print_stacktrace = options.count("stacktrace");
|
||||||
|
|
||||||
UseSSL use_ssl;
|
UseSSL use_ssl;
|
||||||
|
@ -439,9 +439,6 @@ private:
|
|||||||
registerFunctions();
|
registerFunctions();
|
||||||
registerAggregateFunctions();
|
registerAggregateFunctions();
|
||||||
|
|
||||||
// Needed for parallel parsing.
|
|
||||||
GlobalThreadPool::initialize();
|
|
||||||
|
|
||||||
/// Batch mode is enabled if one of the following is true:
|
/// Batch mode is enabled if one of the following is true:
|
||||||
/// - -e (--query) command line option is present.
|
/// - -e (--query) command line option is present.
|
||||||
/// The value of the option is used as the text of query (or of multiple queries).
|
/// The value of the option is used as the text of query (or of multiple queries).
|
||||||
|
@ -147,8 +147,6 @@ try
|
|||||||
return Application::EXIT_OK;
|
return Application::EXIT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalThreadPool::initialize();
|
|
||||||
|
|
||||||
shared_context = Context::createShared();
|
shared_context = Context::createShared();
|
||||||
context = std::make_unique<Context>(Context::createGlobal(shared_context.get()));
|
context = std::make_unique<Context>(Context::createGlobal(shared_context.get()));
|
||||||
context->makeGlobalContext();
|
context->makeGlobalContext();
|
||||||
|
@ -1040,9 +1040,6 @@ try
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed for parallel parsing.
|
|
||||||
GlobalThreadPool::initialize();
|
|
||||||
|
|
||||||
UInt64 seed = sipHash64(options["seed"].as<std::string>());
|
UInt64 seed = sipHash64(options["seed"].as<std::string>());
|
||||||
|
|
||||||
std::string structure = options["structure"].as<std::string>();
|
std::string structure = options["structure"].as<std::string>();
|
||||||
|
@ -136,7 +136,6 @@
|
|||||||
-->
|
-->
|
||||||
<max_server_memory_usage>0</max_server_memory_usage>
|
<max_server_memory_usage>0</max_server_memory_usage>
|
||||||
|
|
||||||
<!-- Maximum thread pool size -->
|
|
||||||
<!-- Maximum number of threads in the Global thread pool.
|
<!-- Maximum number of threads in the Global thread pool.
|
||||||
This will default to a maximum of 10000 threads if not specified.
|
This will default to a maximum of 10000 threads if not specified.
|
||||||
This setting will be useful in scenarios where there are a large number
|
This setting will be useful in scenarios where there are a large number
|
||||||
|
@ -269,8 +269,7 @@ std::unique_ptr<GlobalThreadPool> GlobalThreadPool::the_instance;
|
|||||||
|
|
||||||
void GlobalThreadPool::initialize(size_t max_threads)
|
void GlobalThreadPool::initialize(size_t max_threads)
|
||||||
{
|
{
|
||||||
// There should be an assert, but we can't add it because of the unit tests...
|
assert(!the_instance);
|
||||||
// assert(!the_instance);
|
|
||||||
|
|
||||||
the_instance.reset(new GlobalThreadPool(max_threads,
|
the_instance.reset(new GlobalThreadPool(max_threads,
|
||||||
1000 /*max_free_threads*/, 10000 /*max_queue_size*/,
|
1000 /*max_free_threads*/, 10000 /*max_queue_size*/,
|
||||||
@ -281,8 +280,9 @@ GlobalThreadPool & GlobalThreadPool::instance()
|
|||||||
{
|
{
|
||||||
if (!the_instance)
|
if (!the_instance)
|
||||||
{
|
{
|
||||||
throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR,
|
// Allow implicit initialization. This is needed for old code that is
|
||||||
"The global thread pool is not initalized");
|
// impractical to redo now, especially Arcadia users and unit tests.
|
||||||
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
return *the_instance;
|
return *the_instance;
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
TEST(ThreadPool, GlobalFull1)
|
TEST(ThreadPool, GlobalFull1)
|
||||||
{
|
{
|
||||||
GlobalThreadPool::initialize();
|
|
||||||
|
|
||||||
GlobalThreadPool & global_pool = GlobalThreadPool::instance();
|
GlobalThreadPool & global_pool = GlobalThreadPool::instance();
|
||||||
|
|
||||||
static constexpr size_t capacity = 5;
|
static constexpr size_t capacity = 5;
|
||||||
@ -51,8 +49,6 @@ TEST(ThreadPool, GlobalFull1)
|
|||||||
|
|
||||||
TEST(ThreadPool, GlobalFull2)
|
TEST(ThreadPool, GlobalFull2)
|
||||||
{
|
{
|
||||||
GlobalThreadPool::initialize();
|
|
||||||
|
|
||||||
GlobalThreadPool & global_pool = GlobalThreadPool::instance();
|
GlobalThreadPool & global_pool = GlobalThreadPool::instance();
|
||||||
|
|
||||||
static constexpr size_t capacity = 5;
|
static constexpr size_t capacity = 5;
|
||||||
|
Loading…
Reference in New Issue
Block a user