You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/06/21 07:59:51 UTC

[GitHub] [doris] yiguolei commented on a diff in pull request #10289: [bugfix][compaction][vectorized]fix compaction OOM

yiguolei commented on code in PR #10289:
URL: https://github.com/apache/doris/pull/10289#discussion_r902282330


##########
be/src/olap/rowset/segment_v2/segment_writer.cpp:
##########
@@ -165,8 +165,11 @@ Status SegmentWriter::append_block(const vectorized::Block* block, size_t row_po
 }
 
 int64_t SegmentWriter::max_row_to_add(size_t row_avg_size_in_bytes) {
-    int64_t size_rows =
-            ((int64_t)MAX_SEGMENT_SIZE - (int64_t)estimate_segment_size()) / row_avg_size_in_bytes;
+    auto segment_size = estimate_segment_size();
+    if (PREDICT_FALSE(segment_size >= MAX_SEGMENT_SIZE || _row_count >= _max_row_per_segment)) {

Review Comment:
   why not just use if (segment_size >= MAX_SEGMENT_SIZE || _row_count >= _max_row_per_segment) ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org