diff --git a/src/Interpreters/Context.cpp b/src/Interpreters/Context.cpp index e099721acdc..f6aa2890816 100644 --- a/src/Interpreters/Context.cpp +++ b/src/Interpreters/Context.cpp @@ -1709,13 +1709,13 @@ StoragePolicyPtr Context::getStoragePolicy(const String & name) const } -const std::map & Context::getDisksMap() const +std::map Context::getDisksMap() const { std::lock_guard lock(shared->storage_policies_mutex); return getDiskSelector(lock)->getDisksMap(); } -const std::map & Context::getPoliciesMap() const +std::map Context::getPoliciesMap() const { std::lock_guard lock(shared->storage_policies_mutex); return getStoragePolicySelector(lock)->getPoliciesMap(); diff --git a/src/Interpreters/Context.h b/src/Interpreters/Context.h index 65c9ed6749f..1f59648a525 100644 --- a/src/Interpreters/Context.h +++ b/src/Interpreters/Context.h @@ -545,8 +545,8 @@ public: /// Provides storage disks DiskPtr getDisk(const String & name) const; - const std::map & getPoliciesMap() const; - const std::map & getDisksMap() const; + std::map getPoliciesMap() const; + std::map getDisksMap() const; void updateStorageConfiguration(const Poco::Util::AbstractConfiguration & config); /// Provides storage politics schemes diff --git a/src/Storages/System/StorageSystemStoragePolicies.cpp b/src/Storages/System/StorageSystemStoragePolicies.cpp index c4f43b0a5bf..acbc9d72a20 100644 --- a/src/Storages/System/StorageSystemStoragePolicies.cpp +++ b/src/Storages/System/StorageSystemStoragePolicies.cpp @@ -45,9 +45,7 @@ Pipes StorageSystemStoragePolicies::read( MutableColumnPtr col_max_part_size = ColumnUInt64::create(); MutableColumnPtr col_move_factor = ColumnFloat32::create(); - const auto & policies_map = context.getPoliciesMap(); - - for (const auto & [policy_name, policy_ptr] : policies_map) + for (const auto & [policy_name, policy_ptr] : context.getPoliciesMap()) { const auto & volumes = policy_ptr->getVolumes(); for (size_t i = 0; i != volumes.size(); ++i)