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


##########
be/src/pipeline/local_exchange/local_exchanger.cpp:
##########
@@ -27,28 +27,67 @@
 namespace doris::pipeline {
 
 template <typename BlockType>
-bool Exchanger<BlockType>::_enqueue_data_and_set_ready(int channel_id,
+void Exchanger<BlockType>::_enqueue_data_and_set_ready(int channel_id,
                                                        
LocalExchangeSinkLocalState& local_state,
-                                                       BlockType&& block) {
+                                                       BlockType&& block,
+                                                       bool 
update_total_mem_usage) {
+    size_t allocated_bytes = 0;
+    if constexpr (std::is_same_v<PartitionedBlock, BlockType>) {

Review Comment:
   add comment for this if branch



##########
be/src/pipeline/local_exchange/local_exchanger.cpp:
##########
@@ -27,28 +27,67 @@
 namespace doris::pipeline {
 
 template <typename BlockType>
-bool Exchanger<BlockType>::_enqueue_data_and_set_ready(int channel_id,
+void Exchanger<BlockType>::_enqueue_data_and_set_ready(int channel_id,
                                                        
LocalExchangeSinkLocalState& local_state,
-                                                       BlockType&& block) {
+                                                       BlockType&& block,
+                                                       bool 
update_total_mem_usage) {
+    size_t allocated_bytes = 0;
+    if constexpr (std::is_same_v<PartitionedBlock, BlockType>) {
+        allocated_bytes = block.first->data_block.allocated_bytes();
+    } else {
+        allocated_bytes = block->data_block.allocated_bytes();
+    }
     std::unique_lock l(_m);
     if (_data_queue[channel_id].enqueue(std::move(block))) {
+        local_state._shared_state->add_mem_usage(channel_id, allocated_bytes,
+                                                 update_total_mem_usage);
         local_state._shared_state->set_ready_to_read(channel_id);
-        return true;
+    } else {

Review Comment:
   add comment for this if branch



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