diff --git a/dbms/src/Common/getMultipleKeysFromConfig.cpp b/dbms/src/Common/getMultipleKeysFromConfig.cpp index c6a462f0867..a6cfed57d22 100644 --- a/dbms/src/Common/getMultipleKeysFromConfig.cpp +++ b/dbms/src/Common/getMultipleKeysFromConfig.cpp @@ -5,7 +5,7 @@ namespace DB { -std::vector getMultipleKeysFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name) +std::vector getMultipleKeysFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name) { std::vector values; Poco::Util::AbstractConfiguration::Keys config_keys; @@ -20,7 +20,7 @@ std::vector getMultipleKeysFromConfig(Poco::Util::AbstractConfigura } -std::vector getMultipleValuesFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name) +std::vector getMultipleValuesFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name) { std::vector values; for (const auto & key : DB::getMultipleKeysFromConfig(config, root, name)) diff --git a/dbms/src/Common/getMultipleKeysFromConfig.h b/dbms/src/Common/getMultipleKeysFromConfig.h index 45b0d80cd7a..1c58af7bb45 100644 --- a/dbms/src/Common/getMultipleKeysFromConfig.h +++ b/dbms/src/Common/getMultipleKeysFromConfig.h @@ -12,7 +12,7 @@ namespace Util namespace DB { /// get all internal key names for given key -std::vector getMultipleKeysFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name); +std::vector getMultipleKeysFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name); /// Get all values for given key -std::vector getMultipleValuesFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name); +std::vector getMultipleValuesFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name); } diff --git a/dbms/src/Interpreters/ExternalDictionaries.cpp b/dbms/src/Interpreters/ExternalDictionaries.cpp index 929f1d79da2..4d3dc137131 100644 --- a/dbms/src/Interpreters/ExternalDictionaries.cpp +++ b/dbms/src/Interpreters/ExternalDictionaries.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -64,17 +65,17 @@ ExternalDictionaries::~ExternalDictionaries() reloading_thread.join(); } - - namespace { - std::set getDictionariesConfigPaths(const Poco::Util::AbstractConfiguration & config) +std::set getDictionariesConfigPaths(const Poco::Util::AbstractConfiguration & config) +{ + std::set files; + auto patterns = getMultipleValuesFromConfig(config, "", "dictionaries_config"); + for (auto & pattern : patterns) { - auto pattern = config.getString("dictionaries_config", ""); if (pattern.empty()) - return {}; + continue; - std::set files; if (pattern[0] != '/') { const auto app_config_path = config.getString("config-file", "config.xml"); @@ -82,13 +83,14 @@ namespace const auto absolute_path = config_dir + pattern; Poco::Glob::glob(absolute_path, files, 0); if (!files.empty()) - return files; + continue; } Poco::Glob::glob(pattern, files, 0); - - return files; } + + return files; +} } void ExternalDictionaries::reloadImpl(const bool throw_on_error)