MCPcopy Create free account
hub / github.com/ByConity/ByConity / initialize

Method initialize

src/Statistics/AutoStatisticsManager.cpp:403–420  ·  view source on GitHub ↗

we have to ensure only

Source from the content-addressed store, hash-verified

401
402// we have to ensure only
403void AutoStatisticsManager::initialize(ContextPtr context_, const Poco::Util::AbstractConfiguration & config)
404{
405 if (context_->getServerType() != ServerType::cnch_server)
406 return;
407 // use flush to create table if not exists
408 context_->getAutoStatsTaskLog()->flush(true);
409
410 // zk helper will make only one manager runs at the whole cluster
411 if (AutoStatisticsManager::is_initialized)
412 throw Exception("AutoStatisticsManager should call initialize only once", ErrorCodes::LOGICAL_ERROR);
413
414 the_instance = std::make_unique<AutoStatisticsManager>(context_);
415 the_instance->prepareNewConfig(config);
416
417 LOG_INFO(the_instance->logger, "Create Thread Pool with Setting (1, 0, 1)");
418 the_instance->thread_pool = std::make_unique<ThreadPool>(1, 0, 1);
419 AutoStatisticsManager::is_initialized = true; // ready for instance
420}
421
422AutoStatisticsManager * AutoStatisticsManager::tryGetInstance()
423{

Callers

nothing calls this directly

Calls 5

getServerTypeMethod · 0.80
getAutoStatsTaskLogMethod · 0.80
prepareNewConfigMethod · 0.80
ExceptionClass · 0.50
flushMethod · 0.45

Tested by

no test coverage detected