From 1d8cab3379f9bca85b8987f7640f72771e7c7215 Mon Sep 17 00:00:00 2001 From: alesapin Date: Tue, 21 Jul 2020 11:13:23 +0300 Subject: [PATCH] Better function name and comment --- src/Dictionaries/CacheDictionary.cpp | 2 +- src/Dictionaries/CacheDictionary.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Dictionaries/CacheDictionary.cpp b/src/Dictionaries/CacheDictionary.cpp index ff87d1d2730..63d64492447 100644 --- a/src/Dictionaries/CacheDictionary.cpp +++ b/src/Dictionaries/CacheDictionary.cpp @@ -865,7 +865,7 @@ void CacheDictionary::update(BunchUpdateUnit & bunch_update_unit) const { try { - auto current_source_ptr = getDictionarySourceOrUpdate(); + auto current_source_ptr = getSourceAndUpdateIfNeeded(); Stopwatch watch; diff --git a/src/Dictionaries/CacheDictionary.h b/src/Dictionaries/CacheDictionary.h index 3526f94623e..7e2fc0441d3 100644 --- a/src/Dictionaries/CacheDictionary.h +++ b/src/Dictionaries/CacheDictionary.h @@ -92,7 +92,7 @@ public: database, name, dict_struct, - getDictionarySourceOrUpdate()->clone(), + getSourceAndUpdateIfNeeded()->clone(), dict_lifetime, strict_max_lifetime_seconds, size, @@ -295,7 +295,7 @@ private: /// MultiVersion is not used here because it works with constant pointers. /// For some reason almost all methods in IDictionarySource interface are /// not constant. - SharedDictionarySourcePtr getDictionarySourceOrUpdate() const + SharedDictionarySourcePtr getSourceAndUpdateIfNeeded() const { std::lock_guard lock(source_mutex); if (error_count) @@ -326,7 +326,7 @@ private: const std::string full_name; const DictionaryStructure dict_struct; - /// Dictionary source should be used without mutex + /// Dictionary source should be used with mutex mutable std::mutex source_mutex; mutable SharedDictionarySourcePtr source_ptr;