xingtanzjr opened a new issue #8122:
URL: https://github.com/apache/incubator-doris/issues/8122


   I am reading BE's code recently. For the data stream part, I think I get the 
idea of Doris about  how to exchange data steam between fragments in different 
node. But I still have a question when I reading the code in 
`data_stream_mgr.cpp`. 
   
   For the method `find_recvr()` in `data_stream_mgr.cpp`, it returns an new 
object of `DataStreamRecvr` and doesn't put it in `DataStreamMgr`'s 
`_receiver_map `. See the code snippet below. 
   ```
   shared_ptr<DataStreamRecvr> DataStreamMgr::find_recvr(const TUniqueId& 
fragment_instance_id,
                                                         PlanNodeId node_id, 
bool acquire_lock) {
       VLOG_ROW << "looking up fragment_instance_id=" << fragment_instance_id 
<< ", node=" << node_id;
       size_t hash_value = get_hash_value(fragment_instance_id, node_id);
       if (acquire_lock) {
           _lock.lock();
       }
       std::pair<StreamMap::iterator, StreamMap::iterator> range =
               _receiver_map.equal_range(hash_value);
       while (range.first != range.second) {
           shared_ptr<DataStreamRecvr> recvr = range.first->second;
           if (recvr->fragment_instance_id() == fragment_instance_id &&
               recvr->dest_node_id() == node_id) {
               if (acquire_lock) {
                   _lock.unlock();
               }
               return recvr;
           }
           ++range.first;
       }
       if (acquire_lock) {
           _lock.unlock();
       }
       // QUESTION IS HERE: It return am empty DataSteamRecvr without put it in 
_receiver_map
       return shared_ptr<DataStreamRecvr>();
   }
   ```
   
   So, the question is... how the ExchangeNode find this DataSteamRecvr if it 
is not put in the map.
   
   I know it definitely works but I am confused about it. Can anyone answer 
this question ? 
   
   Thanks,


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