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); }