ClickHouse/dbms/src/Interpreters/ExternalDictionaries.cpp
Vitaly Baranov b4384ce2a9 Dictionaries can be loaded in parallel.
A bad dictionary cannot block all the loading anymore.
Implemented really lazy loading of external dictionaries.
Provided more detailed information about the loading of each dictionary
to make diagnostics easier.
2019-06-14 22:18:47 +03:00

31 lines
1.0 KiB
C++

#include <Interpreters/ExternalDictionaries.h>
#include <Interpreters/Context.h>
#include <Dictionaries/DictionaryFactory.h>
namespace DB
{
/// Must not acquire Context lock in constructor to avoid possibility of deadlocks.
ExternalDictionaries::ExternalDictionaries(
std::unique_ptr<IExternalLoaderConfigRepository> config_repository,
const Poco::Util::AbstractConfiguration & config,
Context & context)
: ExternalLoader(config,
"external dictionary",
&Logger::get("ExternalDictionaries")),
context(context)
{
addConfigRepository(std::move(config_repository), {"dictionary", "name", "dictionaries_config"});
enableAsyncLoading(true);
enablePeriodicUpdates(true);
}
ExternalLoader::LoadablePtr ExternalDictionaries::create(
const std::string & name, const Poco::Util::AbstractConfiguration & config, const std::string & key_in_config) const
{
return DictionaryFactory::instance().create(name, config, key_in_config, context);
}
}