dbms: do not attempt loading builtin dictionaries if config has no corresponding keys. [#METR-15691]

This commit is contained in:
Andrey Mironov 2015-03-27 18:44:32 +03:00
parent 9d3b8c6ec2
commit 082620d054

View File

@ -64,42 +64,53 @@ private:
LOG_INFO(log, "Loading dictionaries.");
auto & config = Poco::Util::Application::instance().config();
bool was_exception = false;
try
if (config.has(TechDataHierarchy::required_key))
{
MultiVersion<TechDataHierarchy>::Version new_tech_data_hierarchy = new TechDataHierarchy;
tech_data_hierarchy.set(new_tech_data_hierarchy);
}
catch (...)
{
handleException(throw_on_error);
was_exception = true;
try
{
auto new_tech_data_hierarchy = std::make_unique<TechDataHierarchy>();
tech_data_hierarchy.set(new_tech_data_hierarchy.release());
}
catch (...)
{
handleException(throw_on_error);
was_exception = true;
}
}
try
{
MultiVersion<RegionsHierarchies>::Version new_regions_hierarchies = new RegionsHierarchies;
new_regions_hierarchies->reload();
regions_hierarchies.set(new_regions_hierarchies);
}
catch (...)
if (config.has(RegionsHierarchies::required_key))
{
handleException(throw_on_error);
was_exception = true;
try
{
auto new_regions_hierarchies = std::make_unique<RegionsHierarchies>();
new_regions_hierarchies->reload();
regions_hierarchies.set(new_regions_hierarchies.release());
}
catch (...)
{
handleException(throw_on_error);
was_exception = true;
}
}
try
if (config.has(RegionsNames::required_key))
{
MultiVersion<RegionsNames>::Version new_regions_names = new RegionsNames;
new_regions_names->reload();
regions_names.set(new_regions_names);
}
catch (...)
{
handleException(throw_on_error);
was_exception = true;
try
{
auto new_regions_names = std::make_unique<RegionsNames>();
new_regions_names->reload();
regions_names.set(new_regions_names.release());
}
catch (...)
{
handleException(throw_on_error);
was_exception = true;
}
}
if (!was_exception)