From ba42ca239d6b13701f1cdbb2328c172a2f60fbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E5=87=AF?= Date: Fri, 29 Dec 2023 23:31:38 +0800 Subject: [PATCH] [Fix](segment iterator) fix wrong segment cache remove --- be/src/olap/rowset/segment_v2/segment_iterator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp b/be/src/olap/rowset/segment_v2/segment_iterator.cpp index 6bc01ea0d4be6e..5c30423bb53d44 100644 --- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp +++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp @@ -2074,7 +2074,8 @@ Status SegmentIterator::_read_columns_by_rowids(std::vector& read_colu Status SegmentIterator::next_batch(vectorized::Block* block) { auto status = [&]() { RETURN_IF_CATCH_EXCEPTION({ return _next_batch_internal(block); }); }(); - if (!status.ok()) { + // if rows read by batch is 0, will return end of file, we should not remove segment cache in this situation. + if (!status.ok() && !status.is()) { _segment->remove_from_segment_cache(); } return status;