From 738966b6b6bf1683787906c692308e8f870bc040 Mon Sep 17 00:00:00 2001 From: shuchaome Date: Thu, 31 Mar 2022 00:03:45 +0800 Subject: [PATCH] fix filebuffer pos in RemoteReadBuffer --- src/Storages/Cache/ExternalDataSourceCache.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Storages/Cache/ExternalDataSourceCache.cpp b/src/Storages/Cache/ExternalDataSourceCache.cpp index 18607c16ffa..17966d49c74 100644 --- a/src/Storages/Cache/ExternalDataSourceCache.cpp +++ b/src/Storages/Cache/ExternalDataSourceCache.cpp @@ -94,6 +94,8 @@ bool RemoteReadBuffer::nextImpl() return status; } + //file_buffer::pos should increase correspondingly when RemoteReadBuffer is consumed, otherwise start_offset will be incorrect. + local_file_holder->file_buffer->position() = local_file_holder->file_buffer->buffer().begin() + BufferBase::offset(); auto start_offset = local_file_holder->file_buffer->getPosition(); auto end_offset = start_offset + local_file_holder->file_buffer->internalBuffer().size(); local_file_holder->file_cache_controller->value().waitMoreData(start_offset, end_offset);