allow implicit initialization

This commit is contained in:
Alexander Kuzmenkov 2020-06-23 20:31:46 +03:00
parent 1a63972a4b
commit f0fbba5522
7 changed files with 4 additions and 19 deletions

View File

@ -560,8 +560,6 @@ int mainEntryClickHouseBenchmark(int argc, char ** argv)
return 1;
}
GlobalThreadPool::initialize();
print_stacktrace = options.count("stacktrace");
UseSSL use_ssl;

View File

@ -439,9 +439,6 @@ private:
registerFunctions();
registerAggregateFunctions();
// Needed for parallel parsing.
GlobalThreadPool::initialize();
/// Batch mode is enabled if one of the following is true:
/// - -e (--query) command line option is present.
/// The value of the option is used as the text of query (or of multiple queries).

View File

@ -147,8 +147,6 @@ try
return Application::EXIT_OK;
}
GlobalThreadPool::initialize();
shared_context = Context::createShared();
context = std::make_unique<Context>(Context::createGlobal(shared_context.get()));
context->makeGlobalContext();

View File

@ -1040,9 +1040,6 @@ try
return 0;
}
// Needed for parallel parsing.
GlobalThreadPool::initialize();
UInt64 seed = sipHash64(options["seed"].as<std::string>());
std::string structure = options["structure"].as<std::string>();

View File

@ -136,7 +136,6 @@
-->
<max_server_memory_usage>0</max_server_memory_usage>
<!-- Maximum thread pool size -->
<!-- Maximum number of threads in the Global thread pool.
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

View File

@ -269,8 +269,7 @@ std::unique_ptr<GlobalThreadPool> GlobalThreadPool::the_instance;
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,
1000 /*max_free_threads*/, 10000 /*max_queue_size*/,
@ -281,8 +280,9 @@ GlobalThreadPool & GlobalThreadPool::instance()
{
if (!the_instance)
{
throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR,
"The global thread pool is not initalized");
// Allow implicit initialization. This is needed for old code that is
// impractical to redo now, especially Arcadia users and unit tests.
initialize();
}
return *the_instance;

View File

@ -13,8 +13,6 @@
TEST(ThreadPool, GlobalFull1)
{
GlobalThreadPool::initialize();
GlobalThreadPool & global_pool = GlobalThreadPool::instance();
static constexpr size_t capacity = 5;
@ -51,8 +49,6 @@ TEST(ThreadPool, GlobalFull1)
TEST(ThreadPool, GlobalFull2)
{
GlobalThreadPool::initialize();
GlobalThreadPool & global_pool = GlobalThreadPool::instance();
static constexpr size_t capacity = 5;