From 2a5385b4a0d7f46f64f36e5a03f5da3e78be98f7 Mon Sep 17 00:00:00 2001 From: kssenii Date: Fri, 15 Nov 2024 15:53:25 +0100 Subject: [PATCH] Try fix race --- src/Interpreters/Cache/FileSegment.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Interpreters/Cache/FileSegment.cpp b/src/Interpreters/Cache/FileSegment.cpp index 541f0f5607a..96229f15247 100644 --- a/src/Interpreters/Cache/FileSegment.cpp +++ b/src/Interpreters/Cache/FileSegment.cpp @@ -321,8 +321,10 @@ void FileSegment::resetRemoteFileReader() FileSegment::RemoteFileReaderPtr FileSegment::extractRemoteFileReader() { auto lk = lock(); - if (remote_file_reader && (download_state == State::DOWNLOADED - || download_state == State::PARTIALLY_DOWNLOADED_NO_CONTINUATION)) + if (remote_file_reader + && remote_file_reader.unique() + && (download_state == State::DOWNLOADED + || download_state == State::PARTIALLY_DOWNLOADED_NO_CONTINUATION)) { return std::move(remote_file_reader); }