This commit is contained in:
kssenii 2024-04-24 18:51:45 +02:00
parent 931fb65762
commit 7530dd57f1
3 changed files with 4 additions and 4 deletions

View File

@ -118,7 +118,7 @@ LockedKeyPtr KeyMetadata::lockNoStateCheck()
return std::make_unique<LockedKey>(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);

View File

@ -113,7 +113,7 @@ struct KeyMetadata : private std::map<size_t, FileSegmentMetadataPtr>,
LockedKeyPtr tryLock();
bool createBaseDirectory();
bool createBaseDirectory(bool throw_if_failed = false);
std::string getPath() const;

View File

@ -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;
}