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 2021/11/25 03:47:25 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #7216: [Feature]. Improve DeltaWriter's performance.

morningman commented on a change in pull request #7216:
URL: https://github.com/apache/incubator-doris/pull/7216#discussion_r756552049



##########
File path: be/src/olap/delta_writer.cpp
##########
@@ -179,6 +180,26 @@ OLAPStatus DeltaWriter::write(Tuple* tuple) {
     return OLAP_SUCCESS;
 }
 
+OLAPStatus DeltaWriter::write(const RowBatch* row_batch, const std::vector<int>& row_idxs) {
+    std::lock_guard<std::mutex> l(_lock);
+    if (!_is_init && !_is_cancelled) {
+        RETURN_NOT_OK(init());
+    }
+
+    if (_is_cancelled) {
+        return OLAP_ERR_ALREADY_CANCELLED;
+    }
+
+    for (const auto& row_idx : row_idxs) {
+        _mem_table->insert(row_batch->get_row(row_idx)->get_tuple(0));
+        if (_mem_table->memory_usage() >= config::write_buffer_size) {

Review comment:
       I think we can move this memory check outside the for loop.
   Maybe inaccurate, but its ok~




-- 
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