mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Config: Allow multiple dictionaries_config
This commit is contained in:
parent
e6344f9048
commit
139d9e5c19
@ -5,7 +5,7 @@
|
||||
|
||||
namespace DB
|
||||
{
|
||||
std::vector<std::string> getMultipleKeysFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name)
|
||||
std::vector<std::string> getMultipleKeysFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name)
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
Poco::Util::AbstractConfiguration::Keys config_keys;
|
||||
@ -20,7 +20,7 @@ std::vector<std::string> getMultipleKeysFromConfig(Poco::Util::AbstractConfigura
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> getMultipleValuesFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name)
|
||||
std::vector<std::string> getMultipleValuesFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name)
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
for (const auto & key : DB::getMultipleKeysFromConfig(config, root, name))
|
||||
|
@ -12,7 +12,7 @@ namespace Util
|
||||
namespace DB
|
||||
{
|
||||
/// get all internal key names for given key
|
||||
std::vector<std::string> getMultipleKeysFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name);
|
||||
std::vector<std::string> getMultipleKeysFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name);
|
||||
/// Get all values for given key
|
||||
std::vector<std::string> getMultipleValuesFromConfig(Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name);
|
||||
std::vector<std::string> getMultipleValuesFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Dictionaries/IDictionarySource.h>
|
||||
#include <Common/StringUtils.h>
|
||||
#include <Common/MemoryTracker.h>
|
||||
#include <Common/getMultipleKeysFromConfig.h>
|
||||
#include <ext/scope_guard.h>
|
||||
#include <Poco/Util/Application.h>
|
||||
#include <Poco/Glob.h>
|
||||
@ -64,17 +65,17 @@ ExternalDictionaries::~ExternalDictionaries()
|
||||
reloading_thread.join();
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
std::set<std::string> getDictionariesConfigPaths(const Poco::Util::AbstractConfiguration & config)
|
||||
std::set<std::string> getDictionariesConfigPaths(const Poco::Util::AbstractConfiguration & config)
|
||||
{
|
||||
std::set<std::string> files;
|
||||
auto patterns = getMultipleValuesFromConfig(config, "", "dictionaries_config");
|
||||
for (auto & pattern : patterns)
|
||||
{
|
||||
auto pattern = config.getString("dictionaries_config", "");
|
||||
if (pattern.empty())
|
||||
return {};
|
||||
continue;
|
||||
|
||||
std::set<std::string> 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)
|
||||
|
Loading…
Reference in New Issue
Block a user