From 7530dd57f112c58a626a5fa653340c7aea34ec94 Mon Sep 17 00:00:00 2001 From: kssenii Date: Wed, 24 Apr 2024 18:51:45 +0200 Subject: [PATCH] Fix --- src/Interpreters/Cache/Metadata.cpp | 4 ++-- src/Interpreters/Cache/Metadata.h | 2 +- src/Interpreters/TemporaryDataOnDisk.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Interpreters/Cache/Metadata.cpp b/src/Interpreters/Cache/Metadata.cpp index b21ccd5b234..c832473c4cd 100644 --- a/src/Interpreters/Cache/Metadata.cpp +++ b/src/Interpreters/Cache/Metadata.cpp @@ -118,7 +118,7 @@ LockedKeyPtr KeyMetadata::lockNoStateCheck() return std::make_unique(shared_from_this()); } -bool KeyMetadata::createBaseDirectory() +bool KeyMetadata::createBaseDirectory(bool throw_if_failed) { if (!created_base_directory.exchange(true)) { @@ -131,7 +131,7 @@ bool KeyMetadata::createBaseDirectory() { created_base_directory = false; - if (e.code() == std::errc::no_space_on_device) + if (!throw_if_failed && e.code() == std::errc::no_space_on_device) { LOG_TRACE(cache_metadata->log, "Failed to create base directory for key {}, " "because no space left on device", key); diff --git a/src/Interpreters/Cache/Metadata.h b/src/Interpreters/Cache/Metadata.h index 1f320f8df5e..31651149998 100644 --- a/src/Interpreters/Cache/Metadata.h +++ b/src/Interpreters/Cache/Metadata.h @@ -113,7 +113,7 @@ struct KeyMetadata : private std::map, LockedKeyPtr tryLock(); - bool createBaseDirectory(); + bool createBaseDirectory(bool throw_if_failed = false); std::string getPath() const; diff --git a/src/Interpreters/TemporaryDataOnDisk.cpp b/src/Interpreters/TemporaryDataOnDisk.cpp index 4a30c0ae726..26a78d53aab 100644 --- a/src/Interpreters/TemporaryDataOnDisk.cpp +++ b/src/Interpreters/TemporaryDataOnDisk.cpp @@ -111,7 +111,7 @@ FileSegmentsHolderPtr TemporaryDataOnDisk::createCacheFile(size_t max_file_size) CreateFileSegmentSettings(FileSegmentKind::Temporary, /* unbounded */ true), FileCache::getCommonUser()); chassert(holder->size() == 1); - holder->back().getKeyMetadata()->createBaseDirectory(); + holder->back().getKeyMetadata()->createBaseDirectory(/* throw_if_failed */true); return holder; }