From cb9927cd00c7998124a0f1f39881be4866666cbe Mon Sep 17 00:00:00 2001 From: KinderRiven <1339764596@qq.com> Date: Sun, 5 Jun 2022 16:52:01 +0800 Subject: [PATCH] fix --- src/Common/FileCache.cpp | 2 +- src/Common/MultilevelFileCacheWrapper.cpp | 89 ----------------------- src/Common/MultilevelFileCacheWrapper.h | 48 ------------ 3 files changed, 1 insertion(+), 138 deletions(-) delete mode 100644 src/Common/MultilevelFileCacheWrapper.cpp delete mode 100644 src/Common/MultilevelFileCacheWrapper.h diff --git a/src/Common/FileCache.cpp b/src/Common/FileCache.cpp index 76b7582a853..ff893ce0a33 100644 --- a/src/Common/FileCache.cpp +++ b/src/Common/FileCache.cpp @@ -497,7 +497,7 @@ bool LRUFileCache::tryReserve(const Key & key, size_t offset, size_t size, std:: if (res == ReserveResult::NO_ENOUGH_SPACE) { /// The query currently does not have enough space to reserve. - /// It returns false and reads data directly from the remote end. + /// It returns false and reads data directly from the remote fs. return false; } else if (res == ReserveResult::NO_NEED) diff --git a/src/Common/MultilevelFileCacheWrapper.cpp b/src/Common/MultilevelFileCacheWrapper.cpp deleted file mode 100644 index d007c8fe550..00000000000 --- a/src/Common/MultilevelFileCacheWrapper.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "MultilevelFileCacheWrapper.h" - -namespace DB -{ - -namespace ErrorCodes -{ - extern const int NOT_IMPLEMENTED; -} - -MultiplelevelFileCacheWarpper::MultiplelevelFileCacheWarpper( - const String & cache_base_path_, const FileCacheSettings & cache_settings_, FileCachePtr cache_) - : IFileCache(cache_base_path_, cache_settings_), cache(cache_) -{ -} - -void MultiplelevelFileCacheWarpper::initialize() -{ - cache->initialize(); -} - -void MultiplelevelFileCacheWarpper::remove(const Key & key) -{ - cache->remove(key); -} - -std::vector MultiplelevelFileCacheWarpper::tryGetCachePaths(const Key & key) -{ - return cache->tryGetCachePaths(key); -} - -FileSegmentsHolder MultiplelevelFileCacheWarpper::getOrSet(const Key & key, size_t offset, size_t size) -{ - return cache->getOrSet(key, offset, size); -} - -FileSegmentsHolder MultiplelevelFileCacheWarpper::get(const Key & key, size_t offset, size_t size) -{ - return cache->get(key, offset, size); -} - -FileSegmentsHolder MultiplelevelFileCacheWarpper::setDownloading(const Key & key, size_t offset, size_t size) -{ - return cache->setDownloading(key, offset, size); -} - -FileSegments MultiplelevelFileCacheWarpper::getSnapshot() const -{ - return cache->getSnapshot(); -} - -String MultiplelevelFileCacheWarpper::dumpStructure(const Key & key) -{ - return cache->dumpStructure(key); -} - -size_t MultiplelevelFileCacheWarpper::getUsedCacheSize() const -{ - return cache->getUsedCacheSize(); -} - -size_t MultiplelevelFileCacheWarpper::getFileSegmentsNum() const -{ - return cache->getFileSegmentsNum(); -} - -bool MultiplelevelFileCacheWarpper::tryReserve(const Key &, size_t, size_t, std::lock_guard &) -{ - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "tryReserve not implemented"); -} - -void MultiplelevelFileCacheWarpper::remove(Key, size_t, std::lock_guard &, std::lock_guard &) -{ - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "remove"); -} - -bool MultiplelevelFileCacheWarpper::isLastFileSegmentHolder( - const Key &, size_t, std::lock_guard &, std::lock_guard &) -{ - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "isLastFileSegmentHolder"); -} - -void MultiplelevelFileCacheWarpper::reduceSizeToDownloaded( - const Key &, size_t, std::lock_guard &, std::lock_guard &) -{ - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "reduceSizeToDownloaded"); -} - -}; diff --git a/src/Common/MultilevelFileCacheWrapper.h b/src/Common/MultilevelFileCacheWrapper.h deleted file mode 100644 index d7c4bfaa4b4..00000000000 --- a/src/Common/MultilevelFileCacheWrapper.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include "FileCache.h" - -namespace DB -{ - -class MultiplelevelFileCacheWarpper : public IFileCache -{ -public: - MultiplelevelFileCacheWarpper(const String & cache_base_path_, const FileCacheSettings & cache_settings_, FileCachePtr cache_); - - void initialize() override; - - void remove(const Key & key) override; - - std::vector tryGetCachePaths(const Key & key) override; - - FileSegmentsHolder getOrSet(const Key & key, size_t offset, size_t size) override; - - FileSegmentsHolder get(const Key & key, size_t offset, size_t size) override; - - FileSegmentsHolder setDownloading(const Key & key, size_t offset, size_t size) override; - - FileSegments getSnapshot() const override; - - String dumpStructure(const Key & key) override; - - size_t getUsedCacheSize() const override; - - size_t getFileSegmentsNum() const override; - -private: - bool tryReserve(const Key & key, size_t offset, size_t size, std::lock_guard & cache_lock) override; - - void remove(Key key, size_t offset, std::lock_guard & cache_lock, std::lock_guard & segment_lock) override; - - bool isLastFileSegmentHolder( - const Key & key, size_t offset, std::lock_guard & cache_lock, std::lock_guard & segment_lock) override; - - void reduceSizeToDownloaded( - const Key & key, size_t offset, std::lock_guard & cache_lock, std::lock_guard & segment_lock) override; - -private: - FileCachePtr cache; -}; - -};