Skip to content

Commit

Permalink
[fix](compaction) fix the issue of writing segment with 0 rows during…
Browse files Browse the repository at this point in the history
… compaction (#38251)

#37960 introduced this issue
  • Loading branch information
luwei16 authored and dataroaring committed Jul 24, 2024
1 parent 7d98223 commit b5c4643
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions be/src/olap/rowset/vertical_beta_rowset_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Status VerticalBetaRowsetWriter<T>::add_columns(const vectorized::Block* block,
VLOG_NOTICE << "num_rows_written: " << num_rows_written
<< ", _cur_writer_idx: " << _cur_writer_idx;
uint32_t num_rows_key_group = _segment_writers[_cur_writer_idx]->row_count();
CHECK_LE(num_rows_written, num_rows_key_group);
CHECK_LT(num_rows_written, num_rows_key_group);
// init if it's first value column write in current segment
if (num_rows_written == 0) {
VLOG_NOTICE << "init first value column segment writer";
Expand All @@ -104,7 +104,8 @@ Status VerticalBetaRowsetWriter<T>::add_columns(const vectorized::Block* block,
left -= to_write;
CHECK_GE(left, 0);

if (left > 0) {
if (num_rows_key_group == num_rows_written + to_write &&
_cur_writer_idx < _segment_writers.size() - 1) {
++_cur_writer_idx;
}
}
Expand Down

0 comments on commit b5c4643

Please sign in to comment.