From 13e711b27ed954c37744d54324664f4109c0cf7e Mon Sep 17 00:00:00 2001 From: nikitamikhaylov Date: Wed, 18 Nov 2020 16:38:14 +0300 Subject: [PATCH] rename back config --- src/Dictionaries/CacheDictionary.cpp | 8 ++++---- src/Dictionaries/CacheDictionary.h | 12 ++++++------ .../configs/dictionaries/cache_ints_dictionary.xml | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Dictionaries/CacheDictionary.cpp b/src/Dictionaries/CacheDictionary.cpp index 988f0d63748..1244257043a 100644 --- a/src/Dictionaries/CacheDictionary.cpp +++ b/src/Dictionaries/CacheDictionary.cpp @@ -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(dict_lifetime.max_sec)); + const size_t strict_max_lifetime_seconds = + config.getUInt64(layout_prefix + ".cache.strict_max_lifetime_seconds", static_cast(dict_lifetime.max_sec)); const size_t max_update_queue_size = config.getUInt64(layout_prefix + ".cache.max_update_queue_size", 100000); diff --git a/src/Dictionaries/CacheDictionary.h b/src/Dictionaries/CacheDictionary.h index 94dc3f5a072..5db62cd5e76 100644 --- a/src/Dictionaries/CacheDictionary.h +++ b/src/Dictionaries/CacheDictionary.h @@ -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::max() - 2 * std::chrono::seconds(extra_lifetime_seconds)); + cell.setExpiresAt(std::chrono::time_point::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; diff --git a/tests/integration/test_dictionary_allow_read_expired_keys/configs/dictionaries/cache_ints_dictionary.xml b/tests/integration/test_dictionary_allow_read_expired_keys/configs/dictionaries/cache_ints_dictionary.xml index af1d21e1142..e01bcddd19a 100644 --- a/tests/integration/test_dictionary_allow_read_expired_keys/configs/dictionaries/cache_ints_dictionary.xml +++ b/tests/integration/test_dictionary_allow_read_expired_keys/configs/dictionaries/cache_ints_dictionary.xml @@ -19,7 +19,7 @@ 10000 10000 - 1000 + 1000 1 10