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

gabriellee 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 4c731556090 [fix](exchanger) Fix DCHECK failure when ref count is not 
set correctly (#47535)
4c731556090 is described below

commit 4c731556090771b6c0fb6fdba38cbc946bdbc5ec
Author: Gabriel <liwenqi...@selectdb.com>
AuthorDate: Thu Feb 6 19:33:37 2025 +0800

    [fix](exchanger) Fix DCHECK failure when ref count is not set correctly 
(#47535)
    
    If execution meet an error, ref count in block wrapper may not count
    down which will lead to a DCHECK failure.
---
 be/src/pipeline/local_exchange/local_exchanger.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/be/src/pipeline/local_exchange/local_exchanger.cpp 
b/be/src/pipeline/local_exchange/local_exchanger.cpp
index f93bbf7eec0..06843e18d86 100644
--- a/be/src/pipeline/local_exchange/local_exchanger.cpp
+++ b/be/src/pipeline/local_exchange/local_exchanger.cpp
@@ -189,11 +189,13 @@ Status ShuffleExchanger::get_block(RuntimeState* state, 
vectorized::Block* block
             const auto* offset_start = 
partitioned_block.second.row_idxs->data() +
                                        partitioned_block.second.offset_start;
             auto block_wrapper = partitioned_block.first;
+            Defer defer {[&]() {
+                block_wrapper->unref(
+                        source_info.local_state ? 
source_info.local_state->_shared_state : nullptr,
+                        source_info.channel_id);
+            }};
             RETURN_IF_ERROR(mutable_block.add_rows(&block_wrapper->data_block, 
offset_start,
                                                    offset_start + 
partitioned_block.second.length));
-            block_wrapper->unref(
-                    source_info.local_state ? 
source_info.local_state->_shared_state : nullptr,
-                    source_info.channel_id);
         } while (mutable_block.rows() < state->batch_size() && !*eos &&
                  _dequeue_data(source_info.local_state, partitioned_block, 
eos, block,
                                source_info.channel_id));


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

Reply via email to