| 543 | } |
| 544 | |
| 545 | int Server::main(const std::vector<std::string> & /*args*/) |
| 546 | { |
| 547 | Poco::Logger * log = &logger(); |
| 548 | |
| 549 | UseSSL use_ssl; |
| 550 | |
| 551 | MainThreadStatus::getInstance(); |
| 552 | |
| 553 | registerFunctions(); |
| 554 | registerHints(); |
| 555 | registerAggregateFunctions(); |
| 556 | registerTableFunctions(); |
| 557 | /// Init cgroup |
| 558 | CGroupManagerFactory::loadFromConfig(config()); |
| 559 | registerStorages(); |
| 560 | registerDictionaries(); |
| 561 | registerDisks(); |
| 562 | registerFormats(); |
| 563 | registerServiceDiscovery(); |
| 564 | initMetrics2(); |
| 565 | |
| 566 | CurrentMetrics::set(CurrentMetrics::Revision, ClickHouseRevision::getVersionRevision()); |
| 567 | CurrentMetrics::set(CurrentMetrics::VersionInteger, ClickHouseRevision::getVersionInteger()); |
| 568 | |
| 569 | if (ThreadFuzzer::instance().isEffective()) |
| 570 | LOG_WARNING(log, "ThreadFuzzer is enabled. Application will run slowly and unstable."); |
| 571 | |
| 572 | #if !defined(NDEBUG) || !defined(__OPTIMIZE__) |
| 573 | LOG_WARNING(log, "Server was built in debug mode. It will work slowly."); |
| 574 | #endif |
| 575 | |
| 576 | #if defined(SANITIZER) |
| 577 | LOG_WARNING(log, "Server was built with sanitizer. It will work slowly."); |
| 578 | #endif |
| 579 | |
| 580 | /** Context contains all that query execution is dependent: |
| 581 | * settings, available functions, data types, aggregate functions, databases, ... |
| 582 | */ |
| 583 | auto shared_context = Context::createShared(); |
| 584 | global_context = Context::createGlobal(shared_context.get()); |
| 585 | global_context->setServerType(config().getString("cnch_type", "standalone")); |
| 586 | global_context->makeGlobalContext(); |
| 587 | global_context->setApplicationType(Context::ApplicationType::SERVER); |
| 588 | global_context->setIsRestrictSettingsToWhitelist(config().getBool("restrict_tenanted_users_to_whitelist_settings", false)); |
| 589 | if (global_context->getIsRestrictSettingsToWhitelist()) |
| 590 | { |
| 591 | auto setting_names = getMultipleValuesFromConfig(config(), "tenant_whitelist_settings", "name"); |
| 592 | global_context->addRestrictSettingsToWhitelist(setting_names); |
| 593 | } |
| 594 | |
| 595 | global_context->initCnchConfig(config()); |
| 596 | global_context->setBlockPrivilegedOp(config().getBool("restrict_tenanted_users_to_privileged_operations", false)); |
| 597 | global_context->initRootConfig(config()); |
| 598 | const auto & root_config = global_context->getRootConfig(); |
| 599 | |
| 600 | // Initialize global thread pool. Do it before we fetch configs from zookeeper |
| 601 | // nodes (`from_zk`), because ZooKeeper interface uses the pool. We will |
| 602 | // ignore `max_thread_pool_size` in configs we fetch from ZK, but oh well. |
nothing calls this directly
no test coverage detected