mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 18:02:24 +00:00
Update FileCache.cpp
This commit is contained in:
parent
6f6434d50d
commit
57d9697e21
@ -1023,7 +1023,7 @@ void FileCache::loadMetadataForKeys(const fs::path & keys_dir)
|
|||||||
|
|
||||||
if (limits_satisfied)
|
if (limits_satisfied)
|
||||||
{
|
{
|
||||||
KeyMetadata::iterator file_segment_metadata_it;
|
bool inserted = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto file_segment = std::make_shared<FileSegment>(key, offset, size,
|
auto file_segment = std::make_shared<FileSegment>(key, offset, size,
|
||||||
@ -1033,21 +1033,20 @@ void FileCache::loadMetadataForKeys(const fs::path & keys_dir)
|
|||||||
key_metadata,
|
key_metadata,
|
||||||
cache_it);
|
cache_it);
|
||||||
|
|
||||||
auto [_, inserted] = key_metadata->emplace(offset, std::make_shared<FileSegmentMetadata>(std::move(file_segment)));
|
inserted = key_metadata->emplace(offset, std::make_shared<FileSegmentMetadata>(std::move(file_segment))).second;
|
||||||
if (!inserted)
|
|
||||||
{
|
|
||||||
cache_it->remove(lockCache());
|
|
||||||
chassert(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||||
chassert(false);
|
chassert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inserted)
|
||||||
|
{
|
||||||
cache_it->remove(lockCache());
|
cache_it->remove(lockCache());
|
||||||
fs::remove(offset_it->path());
|
fs::remove(offset_it->path());
|
||||||
continue;
|
chassert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user