From b25dfdd6af0b2ea5749938731b2e3ee2d4ca52cd Mon Sep 17 00:00:00 2001 From: kssenii Date: Mon, 2 Aug 2021 08:15:21 +0000 Subject: [PATCH] Use method which was added for s3 instead --- src/Disks/DiskLocal.cpp | 8 +++++--- src/Disks/DiskLocal.h | 4 +--- src/Disks/DiskSelector.cpp | 2 -- src/Disks/IDisk.h | 5 ----- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/Disks/DiskLocal.cpp b/src/Disks/DiskLocal.cpp index edebb6ff71e..b4d7f74f10f 100644 --- a/src/Disks/DiskLocal.cpp +++ b/src/Disks/DiskLocal.cpp @@ -367,15 +367,17 @@ SyncGuardPtr DiskLocal::getDirectorySyncGuard(const String & path) const return std::make_unique(fs::path(disk_path) / path); } -void DiskLocal::updateFromConfigIfChanged(const Poco::Util::AbstractConfiguration & config, - const String & config_prefix, ContextPtr context) + +void DiskLocal::applyNewSettings(const Poco::Util::AbstractConfiguration & config, ContextPtr context, const String & config_prefix, const DisksMap &) { String new_disk_path; UInt64 new_keep_free_space_bytes; + loadDiskLocalConfig(name, config, config_prefix, context, new_disk_path, new_keep_free_space_bytes); if (disk_path != new_disk_path) - throw Exception("Disk path can't update from config " + name, ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG); + throw Exception("Disk path can't be updated from config " + name, ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG); + if (keep_free_space_bytes != new_keep_free_space_bytes) keep_free_space_bytes = new_keep_free_space_bytes; } diff --git a/src/Disks/DiskLocal.h b/src/Disks/DiskLocal.h index 714d4683590..0cf0cf39bbc 100644 --- a/src/Disks/DiskLocal.h +++ b/src/Disks/DiskLocal.h @@ -105,9 +105,7 @@ public: SyncGuardPtr getDirectorySyncGuard(const String & path) const override; - void updateFromConfigIfChanged(const Poco::Util::AbstractConfiguration & config, - const String & config_prefix, - ContextPtr context) override; + void applyNewSettings(const Poco::Util::AbstractConfiguration & config, ContextPtr context, const String & config_prefix, const DisksMap &) override; private: bool tryReserve(UInt64 bytes); diff --git a/src/Disks/DiskSelector.cpp b/src/Disks/DiskSelector.cpp index 1e081a59701..bc7810479c5 100644 --- a/src/Disks/DiskSelector.cpp +++ b/src/Disks/DiskSelector.cpp @@ -74,8 +74,6 @@ DiskSelectorPtr DiskSelector::updateFromConfig( disk->applyNewSettings(config, context, disk_config_prefix, result->getDisksMap()); old_disks_minus_new_disks.erase(disk_name); - - result->getDisksMap().find(disk_name)->second->updateFromConfigIfChanged(config, disk_config_prefix, context); } } diff --git a/src/Disks/IDisk.h b/src/Disks/IDisk.h index 0f902dd8338..61c805961ae 100644 --- a/src/Disks/IDisk.h +++ b/src/Disks/IDisk.h @@ -231,11 +231,6 @@ public: /// Required for remote disk to ensure that replica has access to data written by other node virtual bool checkUniqueId(const String & id) const { return exists(id); } - /// Reload config if it was changed - virtual void updateFromConfigIfChanged(const Poco::Util::AbstractConfiguration & /* config */, - const String & /* config_prefix */, - ContextPtr /* context */) { } - /// Invoked on partitions freeze query. virtual void onFreeze(const String &) { }