You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/06/22 06:38:35 UTC

[doris] branch master updated: [bugfix][compaction][vectorized]fix compaction OOM (#10289)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 994feb9dbe [bugfix][compaction][vectorized]fix compaction OOM (#10289)
994feb9dbe is described below

commit 994feb9dbed7af10e008d2779155355a0ef701e3
Author: TengJianPing <18...@users.noreply.github.com>
AuthorDate: Wed Jun 22 14:38:30 2022 +0800

    [bugfix][compaction][vectorized]fix compaction OOM (#10289)
---
 be/src/olap/rowset/segment_v2/segment_writer.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/segment_writer.cpp b/be/src/olap/rowset/segment_v2/segment_writer.cpp
index f95b62c9c2..2a60172ee8 100644
--- a/be/src/olap/rowset/segment_v2/segment_writer.cpp
+++ b/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)) {
+        return 0;
+    }
+    int64_t size_rows = ((int64_t)MAX_SEGMENT_SIZE - (int64_t)segment_size) / row_avg_size_in_bytes;
     int64_t count_rows = (int64_t)_max_row_per_segment - _row_count;
 
     return std::min(size_rows, count_rows);


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