From 5d0a185cb3f69a5591fa137bd2cd5a2e777aa608 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Fri, 3 Jun 2022 21:27:27 +0300 Subject: [PATCH] Fix assertion for getImplementationBufferOffset() for Log family on S3 Test test_log_family_s3/test.py::test_log_family_s3[TinyLog]: clickhouse: ./src/Disks/IO/AsynchronousReadIndirectBufferFromRemoteFS.cpp:213: virtual bool DB::AsynchronousReadIndirectBufferFromRemoteFS::nextImpl(): Assertion `file_offset_of_buffer_end == impl->getImplementationBufferOffset()' failed. v2: fix assertion instead of adjusting file_offset_of_buffer_end in ReadBufferFromRemoteFSGather.cpp Signed-off-by: Azat Khuzhin --- src/Disks/IO/AsynchronousReadIndirectBufferFromRemoteFS.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Disks/IO/AsynchronousReadIndirectBufferFromRemoteFS.cpp b/src/Disks/IO/AsynchronousReadIndirectBufferFromRemoteFS.cpp index 5f2e19162f4..ca151a8608e 100644 --- a/src/Disks/IO/AsynchronousReadIndirectBufferFromRemoteFS.cpp +++ b/src/Disks/IO/AsynchronousReadIndirectBufferFromRemoteFS.cpp @@ -210,7 +210,11 @@ bool AsynchronousReadIndirectBufferFromRemoteFS::nextImpl() ProfileEvents::increment(ProfileEvents::AsynchronousReadWaitMicroseconds, watch.elapsedMicroseconds()); file_offset_of_buffer_end = impl->getFileOffsetOfBufferEnd(); - assert(file_offset_of_buffer_end == impl->getImplementationBufferOffset()); + /// In case of multiple files for the same file in clickhouse (i.e. log family) + /// file_offset_of_buffer_end will not match getImplementationBufferOffset() + /// so we use [impl->getImplementationBufferOffset(), impl->getFileSize()] + assert(file_offset_of_buffer_end >= impl->getImplementationBufferOffset()); + assert(file_offset_of_buffer_end <= impl->getFileSize()); prefetch_future = {}; return size;