mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Merge pull request #62925 from ClickHouse/fix-temporary-data-in-cache-base-directory-creation
Fix temporary data in cache incorrectly processing failure of cache key directory creation
This commit is contained in:
commit
ce5ea3b05a
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user