stdpain commented on a change in pull request #5850:
URL: https://github.com/apache/incubator-doris/pull/5850#discussion_r637699457



##########
File path: be/src/runtime/fragment_mgr.cpp
##########
@@ -436,7 +437,7 @@ void 
FragmentMgr::_exec_actual(std::shared_ptr<FragmentExecState> exec_state, Fi
     {
         std::lock_guard<std::mutex> lock(_lock);
         _fragment_map.erase(exec_state->fragment_instance_id());
-        if (all_done) {
+        if (all_done && fragments_ctx) {

Review comment:
       ```c++
       std::shared_ptr<QueryFragmentsCtx> fragments_ctx = 
exec_state->get_fragments_ctx();
       bool all_done = false;
       // what will happen if fragments_ctx is null ? 
       if (fragments_ctx != nullptr) {
           // decrease the number of unfinished fragments
           all_done = fragments_ctx->countdown();
       }
       // remove exec state after this fragment finished
       {
           std::lock_guard<std::mutex> lock(_lock);
           _fragment_map.erase(exec_state->fragment_instance_id());
           if (all_done && fragments_ctx) {
                 //  it seems that the fragments_ctxmay be NULL 
               _fragments_ctx_map.erase(fragments_ctx->query_id);
   ```

##########
File path: be/src/runtime/fragment_mgr.cpp
##########
@@ -436,7 +437,7 @@ void 
FragmentMgr::_exec_actual(std::shared_ptr<FragmentExecState> exec_state, Fi
     {
         std::lock_guard<std::mutex> lock(_lock);
         _fragment_map.erase(exec_state->fragment_instance_id());
-        if (all_done) {
+        if (all_done && fragments_ctx) {

Review comment:
       ```c++
       std::shared_ptr<QueryFragmentsCtx> fragments_ctx = 
exec_state->get_fragments_ctx();
       bool all_done = false;
       // what will happen if fragments_ctx is null ? 
       if (fragments_ctx != nullptr) {
           // decrease the number of unfinished fragments
           all_done = fragments_ctx->countdown();
       }
       // remove exec state after this fragment finished
       {
           std::lock_guard<std::mutex> lock(_lock);
           _fragment_map.erase(exec_state->fragment_instance_id());
           if (all_done && fragments_ctx) {
               //  it seems that the fragments_ctxmay be NULL 
               _fragments_ctx_map.erase(fragments_ctx->query_id);
   ```
   
    it seems that the fragments_ctxmay be NULL 




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

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