HappenLee commented on code in PR #9459:
URL: https://github.com/apache/incubator-doris/pull/9459#discussion_r876523763


##########
be/src/olap/delta_writer.cpp:
##########
@@ -222,9 +222,12 @@ Status DeltaWriter::write(const vectorized::Block* block, 
const std::vector<int>
         }
     }
 
-    if (_mem_table->memory_usage() >= config::write_buffer_size) {
-        RETURN_NOT_OK(_flush_memtable_async());
-        _reset_mem_table();
+    if (_mem_table->need_to_agg()) {
+        _mem_table->shrink_memtable_by_agg();
+        if (UNLIKELY(_mem_table->is_flush())) {

Review Comment:
   why here is unlikely? if unlikely means need_to_agg config is not suitiable? 



##########
be/src/olap/memtable.cpp:
##########
@@ -126,11 +126,12 @@ void MemTable::insert(const vectorized::Block* block, 
size_t row_pos, size_t num
         }
     }
     size_t cursor_in_mutableblock = _input_mutable_block.rows();
-    size_t oldsize = _input_mutable_block.allocated_bytes();
     _input_mutable_block.add_rows(block, row_pos, num_rows);
-    size_t newsize = _input_mutable_block.allocated_bytes();
-    _mem_usage += newsize - oldsize;
-    _mem_tracker->consume(newsize - oldsize);
+    size_t input_size = block->allocated_bytes() * num_rows / block->rows();

Review Comment:
   what the logic means ?



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to