rename back config

This commit is contained in:
nikitamikhaylov 2020-11-18 16:38:14 +03:00
parent 70a08608f8
commit 13e711b27e
3 changed files with 11 additions and 11 deletions

View File

@ -65,7 +65,7 @@ CacheDictionary::CacheDictionary(
const DictionaryStructure & dict_struct_,
DictionarySourcePtr source_ptr_,
DictionaryLifetime dict_lifetime_,
size_t extra_lifetime_seconds_,
size_t strict_max_lifetime_seconds_,
size_t size_,
bool allow_read_expired_keys_,
size_t max_update_queue_size_,
@ -76,7 +76,7 @@ CacheDictionary::CacheDictionary(
, dict_struct(dict_struct_)
, source_ptr{std::move(source_ptr_)}
, dict_lifetime(dict_lifetime_)
, extra_lifetime_seconds(extra_lifetime_seconds_)
, strict_max_lifetime_seconds(strict_max_lifetime_seconds_)
, allow_read_expired_keys(allow_read_expired_keys_)
, max_update_queue_size(max_update_queue_size_)
, update_queue_push_timeout_milliseconds(update_queue_push_timeout_milliseconds_)
@ -750,8 +750,8 @@ void registerDictionaryCache(DictionaryFactory & factory)
const auto dict_id = StorageID::fromDictionaryConfig(config, config_prefix);
const DictionaryLifetime dict_lifetime{config, config_prefix + ".lifetime"};
const size_t extra_lifetime_seconds =
config.getUInt64(layout_prefix + ".cache.extra_lifetime_seconds", static_cast<size_t>(dict_lifetime.max_sec));
const size_t strict_max_lifetime_seconds =
config.getUInt64(layout_prefix + ".cache.strict_max_lifetime_seconds", static_cast<size_t>(dict_lifetime.max_sec));
const size_t max_update_queue_size =
config.getUInt64(layout_prefix + ".cache.max_update_queue_size", 100000);

View File

@ -54,7 +54,7 @@ public:
const DictionaryStructure & dict_struct_,
DictionarySourcePtr source_ptr_,
DictionaryLifetime dict_lifetime_,
size_t extra_lifetime_seconds,
size_t strict_max_lifetime_seconds,
size_t size_,
bool allow_read_expired_keys_,
size_t max_update_queue_size_,
@ -88,7 +88,7 @@ public:
dict_struct,
getSourceAndUpdateIfNeeded()->clone(),
dict_lifetime,
extra_lifetime_seconds,
strict_max_lifetime_seconds,
size,
allow_read_expired_keys,
max_update_queue_size,
@ -311,9 +311,9 @@ private:
}
else
{
/// This maybe not obvious, but when we define is this cell is expired or expired permanently, we add extra_lifetime_seconds
/// This maybe not obvious, but when we define is this cell is expired or expired permanently, we add strict_max_lifetime_seconds
/// to the expiration time. And it overflows pretty well.
cell.setExpiresAt(std::chrono::time_point<std::chrono::system_clock>::max() - 2 * std::chrono::seconds(extra_lifetime_seconds));
cell.setExpiresAt(std::chrono::time_point<std::chrono::system_clock>::max() - 2 * std::chrono::seconds(strict_max_lifetime_seconds));
}
}
@ -324,7 +324,7 @@ private:
inline bool isExpiredPermanently(time_point_t now, time_point_t deadline) const
{
return now > deadline + std::chrono::seconds(extra_lifetime_seconds);
return now > deadline + std::chrono::seconds(strict_max_lifetime_seconds);
}
enum class ResultState
@ -353,7 +353,7 @@ private:
mutable SharedDictionarySourcePtr source_ptr;
const DictionaryLifetime dict_lifetime;
const size_t extra_lifetime_seconds;
const size_t strict_max_lifetime_seconds;
const bool allow_read_expired_keys;
const size_t max_update_queue_size;
const size_t update_queue_push_timeout_milliseconds;

View File

@ -19,7 +19,7 @@
<cache>
<size_in_cells>10000</size_in_cells>
<max_update_queue_size>10000</max_update_queue_size>
<extra_lifetime_seconds>1000</extra_lifetime_seconds>
<strict_max_lifetime_seconds>1000</strict_max_lifetime_seconds>
<allow_read_expired_keys>1</allow_read_expired_keys>
<update_queue_push_timeout_milliseconds>10</update_queue_push_timeout_milliseconds>
</cache>