zclllyybb commented on code in PR #19545:
URL: https://github.com/apache/doris/pull/19545#discussion_r1190982213


##########
be/src/vec/runtime/vdata_stream_recvr.h:
##########
@@ -219,23 +218,21 @@ class VDataStreamRecvr::PipSenderQueue : public 
SenderQueue {
     PipSenderQueue(VDataStreamRecvr* parent_recvr, int num_senders, 
RuntimeProfile* profile)
             : SenderQueue(parent_recvr, num_senders, profile) {}
 
-    bool should_wait() override {
-        return !_is_cancelled && _block_queue_empty && _num_remaining_senders 
> 0;
-    }
-
-    void _update_block_queue_empty() override { _block_queue_empty = 
_block_queue.empty(); }
-
     Status get_batch(Block* block, bool* eos) override {
+        std::lock_guard<std::mutex> l(_lock); // protect _block_queue

Review Comment:
   this will make deadlock since we would lock `_lock` in `should_wait()`. 
maybe rewrite `should_wait` to `should_wait_without_lock`?



##########
be/src/vec/runtime/vdata_stream_recvr.h:
##########
@@ -219,23 +218,21 @@ class VDataStreamRecvr::PipSenderQueue : public 
SenderQueue {
     PipSenderQueue(VDataStreamRecvr* parent_recvr, int num_senders, 
RuntimeProfile* profile)
             : SenderQueue(parent_recvr, num_senders, profile) {}
 
-    bool should_wait() override {
-        return !_is_cancelled && _block_queue_empty && _num_remaining_senders 
> 0;
-    }
-
-    void _update_block_queue_empty() override { _block_queue_empty = 
_block_queue.empty(); }
-
     Status get_batch(Block* block, bool* eos) override {
+        std::lock_guard<std::mutex> l(_lock); // protect _block_queue
         CHECK(!should_wait()) << " _is_cancelled: " << _is_cancelled
                               << ", _block_queue_empty: " << _block_queue_empty

Review Comment:
   should change all usage of `_block_queue_empty` to `_block_queue.empty()` 
since won't update it any more.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to