Skip to content

Commit 4c73155

Browse files
authored
[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.
1 parent a32e9c3 commit 4c73155

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

be/src/pipeline/local_exchange/local_exchanger.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,13 @@ Status ShuffleExchanger::get_block(RuntimeState* state, vectorized::Block* block
189189
const auto* offset_start = partitioned_block.second.row_idxs->data() +
190190
partitioned_block.second.offset_start;
191191
auto block_wrapper = partitioned_block.first;
192+
Defer defer {[&]() {
193+
block_wrapper->unref(
194+
source_info.local_state ? source_info.local_state->_shared_state : nullptr,
195+
source_info.channel_id);
196+
}};
192197
RETURN_IF_ERROR(mutable_block.add_rows(&block_wrapper->data_block, offset_start,
193198
offset_start + partitioned_block.second.length));
194-
block_wrapper->unref(
195-
source_info.local_state ? source_info.local_state->_shared_state : nullptr,
196-
source_info.channel_id);
197199
} while (mutable_block.rows() < state->batch_size() && !*eos &&
198200
_dequeue_data(source_info.local_state, partitioned_block, eos, block,
199201
source_info.channel_id));

0 commit comments

Comments
 (0)