diff --git a/src/Common/FileCache.cpp b/src/Common/FileCache.cpp index 5d5851d0b84..05d32f5ffe4 100644 --- a/src/Common/FileCache.cpp +++ b/src/Common/FileCache.cpp @@ -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; diff --git a/src/Common/FileSegment.cpp b/src/Common/FileSegment.cpp index 4def08c6817..ba4129a0ef6 100644 --- a/src/Common/FileSegment.cpp +++ b/src/Common/FileSegment.cpp @@ -608,18 +608,19 @@ void FileSegment::assertCorrectnessImpl(std::lock_guard & /* 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 & /* cache_lock */) { auto snapshot = std::make_shared( 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; } diff --git a/src/Common/FileSegment.h b/src/Common/FileSegment.h index a02d8e85a46..615fd9a56de 100644 --- a/src/Common/FileSegment.h +++ b/src/Common/FileSegment.h @@ -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 & cache_lock); private: size_t availableSize() const { return reserved_size - downloaded_size; } diff --git a/src/Disks/DiskCacheWrapper.cpp b/src/Disks/DiskCacheWrapper.cpp index a86f13f55af..cc2c330975a 100644 --- a/src/Disks/DiskCacheWrapper.cpp +++ b/src/Disks/DiskCacheWrapper.cpp @@ -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)); diff --git a/tests/queries/0_stateless/02240_system_remote_filesystem_cache.sql b/tests/queries/0_stateless/02240_system_remote_filesystem_cache.sql index 757f792b931..aa469779130 100644 --- a/tests/queries/0_stateless/02240_system_remote_filesystem_cache.sql +++ b/tests/queries/0_stateless/02240_system_remote_filesystem_cache.sql @@ -1,4 +1,4 @@ --- Tags: no-parallel, no-fasttest +-- Tags: no-parallel, no-fasttest, no-s3-storage -- { echo } diff --git a/tests/queries/0_stateless/02241_remote_filesystem_cache_on_insert.sql b/tests/queries/0_stateless/02241_remote_filesystem_cache_on_insert.sql index 7b0ff2c70ca..c3ab1de3693 100644 --- a/tests/queries/0_stateless/02241_remote_filesystem_cache_on_insert.sql +++ b/tests/queries/0_stateless/02241_remote_filesystem_cache_on_insert.sql @@ -1,4 +1,4 @@ --- Tags: no-parallel, no-fasttest +-- Tags: no-parallel, no-fasttest, no-s3-storage -- { echo }