Skip to content

Commit

Permalink
branch-3.0: [Opt](SegmentIterator) clear and release iterators memory…
Browse files Browse the repository at this point in the history
… footprint in advance when EOF #44768 (#44839)

Cherry-picked from #44768

Co-authored-by: lihangyu <[email protected]>
  • Loading branch information
github-actions[bot] and eldenmoon authored Dec 2, 2024
1 parent d8bed48 commit 9affc10
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions be/src/olap/rowset/segment_v2/segment_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1987,6 +1987,12 @@ Status SegmentIterator::copy_column_data_by_selector(vectorized::IColumn* input_
return input_col_ptr->filter_by_selector(sel_rowid_idx, select_size, output_col);
}

void SegmentIterator::_clear_iterators() {
_column_iterators.clear();
_bitmap_index_iterators.clear();
_inverted_index_iterators.clear();
}

Status SegmentIterator::_next_batch_internal(vectorized::Block* block) {
bool is_mem_reuse = block->mem_reuse();
DCHECK(is_mem_reuse);
Expand Down Expand Up @@ -2093,6 +2099,8 @@ Status SegmentIterator::_next_batch_internal(vectorized::Block* block) {
}
}
block->clear_column_data();
// clear and release iterators memory footprint in advance
_clear_iterators();
return Status::EndOfFile("no more data in segment");
}

Expand Down
2 changes: 2 additions & 0 deletions be/src/olap/rowset/segment_v2/segment_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ class SegmentIterator : public RowwiseIterator {

void _calculate_expr_in_remaining_conjunct_root();

void _clear_iterators();

class BitmapRangeIterator;
class BackwardBitmapRangeIterator;

Expand Down

0 comments on commit 9affc10

Please sign in to comment.