Merge pull request #42874 from azat/query-hung-on-cancel-fix

This commit is contained in:
Vladimir C 2022-11-08 10:52:58 +01:00 committed by GitHub
commit 88033562cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -109,6 +109,13 @@ bool ExecutingGraph::expandPipeline(std::stack<uint64_t> & stack, uint64_t pid)
{
std::lock_guard guard(processors_mutex);
/// Do not add new processors to existing list, since the query was already cancelled.
if (cancelled)
{
for (auto & processor : new_processors)
processor->cancel();
return false;
}
processors->insert(processors->end(), new_processors.begin(), new_processors.end());
}
@ -388,6 +395,7 @@ void ExecutingGraph::cancel()
std::lock_guard guard(processors_mutex);
for (auto & processor : *processors)
processor->cancel();
cancelled = true;
}
}

View File

@ -157,6 +157,7 @@ private:
UpgradableMutex nodes_mutex;
const bool profile_processors;
bool cancelled = false;
};
}