Skip to content

Commit

Permalink
Optimize query uniqueness check in ProcessList - move after `cancelle…
Browse files Browse the repository at this point in the history
…d_cv.wait`
  • Loading branch information
adikus committed Nov 22, 2023
1 parent 9b549fd commit f447c54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Interpreters/ProcessList.cpp
Expand Up @@ -311,12 +311,12 @@ ProcessListEntry::~ProcessListEntry()
}
}

if (auto query_user = parent.queries_to_user.find(query_id); query_user != parent.queries_to_user.end())
parent.queries_to_user.erase(query_user);

/// Wait for the query if it is in the cancellation right now.
parent.cancelled_cv.wait(lock.lock, [&]() { return process_list_element_ptr->is_cancelling == false; });

if (auto query_user = parent.queries_to_user.find(query_id); query_user != parent.queries_to_user.end())
parent.queries_to_user.erase(query_user);

/// This removes the memory_tracker of one request.
parent.processes.erase(it);

Expand Down

0 comments on commit f447c54

Please sign in to comment.