mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
fix bug for local cache
This commit is contained in:
parent
a1e54c3918
commit
b91f18033c
@ -646,6 +646,13 @@ void FileSegment::assertNotDetached() const
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Operation not allowed, file segment is detached");
|
||||
}
|
||||
|
||||
void FileSegment::assertDetachedStatus() const
|
||||
{
|
||||
assert(
|
||||
(download_state == State::EMPTY) || (download_state == State::PARTIALLY_DOWNLOADED)
|
||||
|| (download_state == State::PARTIALLY_DOWNLOADED_NO_CONTINUATION) || (downloaded_stated == State::SKIP_CACHE));
|
||||
}
|
||||
|
||||
FileSegmentPtr FileSegment::getSnapshot(const FileSegmentPtr & file_segment, std::lock_guard<std::mutex> & /* cache_lock */)
|
||||
{
|
||||
auto snapshot = std::make_shared<FileSegment>(
|
||||
@ -683,7 +690,7 @@ FileSegmentsHolder::~FileSegmentsHolder()
|
||||
{
|
||||
/// This file segment is not owned by cache, so it will be destructed
|
||||
/// at this point, therefore no completion required.
|
||||
assert(file_segment->state() == FileSegment::State::EMPTY);
|
||||
file_segment->assertDetachedStatus();
|
||||
file_segment_it = file_segments.erase(current_file_segment_it);
|
||||
continue;
|
||||
}
|
||||
|
@ -151,6 +151,7 @@ private:
|
||||
String getInfoForLogImpl(std::lock_guard<std::mutex> & segment_lock) const;
|
||||
void assertCorrectnessImpl(std::lock_guard<std::mutex> & segment_lock) const;
|
||||
void assertNotDetached() const;
|
||||
void assertDetachedStatus() const;
|
||||
|
||||
void setDownloaded(std::lock_guard<std::mutex> & segment_lock);
|
||||
void setDownloadFailed(std::lock_guard<std::mutex> & segment_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user