Fix checks

This commit is contained in:
kssenii 2022-04-08 01:58:55 +02:00
parent 5dce2f18b5
commit 0b7af1f26c
6 changed files with 8 additions and 7 deletions

View File

@ -717,7 +717,7 @@ FileSegments LRUFileCache::getSnapshot() const
for (const auto & [key, cells_by_offset] : files)
{
for (const auto & [offset, cell] : cells_by_offset)
file_segments.push_back(FileSegment::getSnapshot(cell.file_segment));
file_segments.push_back(FileSegment::getSnapshot(cell.file_segment, cache_lock));
}
return file_segments;

View File

@ -608,18 +608,19 @@ void FileSegment::assertCorrectnessImpl(std::lock_guard<std::mutex> & /* segment
assert(download_state != FileSegment::State::DOWNLOADED || std::filesystem::file_size(cache->getPathInLocalCache(key(), offset())) > 0);
}
FileSegmentPtr FileSegment::getSnapshot(const FileSegmentPtr & file_segment)
FileSegmentPtr FileSegment::getSnapshot(const FileSegmentPtr & file_segment, std::lock_guard<std::mutex> & /* cache_lock */)
{
auto snapshot = std::make_shared<FileSegment>(
file_segment->offset(),
file_segment->range().size(),
file_segment->key(),
nullptr,
file_segment->state());
State::EMPTY);
snapshot->hits_count = file_segment->getHitsCount();
snapshot->ref_count = file_segment.use_count();
snapshot->downloaded_size = file_segment->getDownloadedSize();
snapshot->download_state = file_segment->state();
return snapshot;
}

View File

@ -142,7 +142,7 @@ public:
void assertCorrectness() const;
static FileSegmentPtr getSnapshot(const FileSegmentPtr & file_segment);
static FileSegmentPtr getSnapshot(const FileSegmentPtr & file_segment, std::lock_guard<std::mutex> & cache_lock);
private:
size_t availableSize() const { return reserved_size - downloaded_size; }

View File

@ -207,7 +207,7 @@ DiskCacheWrapper::writeFile(const String & path, size_t buf_size, WriteMode mode
WriteSettings current_settings = settings;
/// There are two different cache implementations. Disable second one if the first is enabled.
/// The firts will soon be removed, this disabling is temporary.
/// The first will soon be removed, this disabling is temporary.
current_settings.enable_filesystem_cache_on_write_operations = false;
LOG_TEST(log, "Write file {} to cache", backQuote(path));

View File

@ -1,4 +1,4 @@
-- Tags: no-parallel, no-fasttest
-- Tags: no-parallel, no-fasttest, no-s3-storage
-- { echo }

View File

@ -1,4 +1,4 @@
-- Tags: no-parallel, no-fasttest
-- Tags: no-parallel, no-fasttest, no-s3-storage
-- { echo }