we have to ensure only
| 401 | |
| 402 | // we have to ensure only |
| 403 | void 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 | |
| 422 | AutoStatisticsManager * AutoStatisticsManager::tryGetInstance() |
| 423 | { |
nothing calls this directly
no test coverage detected