mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-23 10:10:50 +00:00
dbms: properly delay dictionary update time in case of exception [#METR-13298]
This commit is contained in:
parent
41b1a8dd25
commit
bfbe878f99
@ -3,6 +3,7 @@
|
||||
#include <DB/Dictionaries/DictionaryStructure.h>
|
||||
#include <DB/Dictionaries/IDictionarySource.h>
|
||||
#include <DB/Dictionaries/config_ptr_t.h>
|
||||
#include <statdaemons/ext/scope_guard.hpp>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -125,6 +126,12 @@ void Dictionaries::reloadExternals()
|
||||
if (std::chrono::system_clock::now() < update_time)
|
||||
continue;
|
||||
|
||||
scope_exit({
|
||||
/// calculate next update time
|
||||
std::uniform_int_distribution<std::uint64_t> distribution{lifetime.min_sec, lifetime.max_sec};
|
||||
update_time = std::chrono::system_clock::now() + std::chrono::seconds{distribution(rnd_engine)};
|
||||
});
|
||||
|
||||
/// check source modified
|
||||
if (current->getSource()->isModified())
|
||||
{
|
||||
@ -132,10 +139,6 @@ void Dictionaries::reloadExternals()
|
||||
auto new_version = current->clone();
|
||||
dictionary.second->set(new_version.release());
|
||||
}
|
||||
|
||||
/// calculate next update time
|
||||
std::uniform_int_distribution<std::uint64_t> distribution{lifetime.min_sec, lifetime.max_sec};
|
||||
update_time = std::chrono::system_clock::now() + std::chrono::seconds{distribution(rnd_engine)};
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
|
Loading…
Reference in New Issue
Block a user