Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
Return query desc when update sessions.
Browse files Browse the repository at this point in the history
  • Loading branch information
CPWstatic committed Jun 22, 2021
1 parent dde015e commit e32eb13
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/meta/processors/sessionMan/SessionManagerProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ void CreateSessionProcessor::process(const cpp2::CreateSessionReq& req) {
void UpdateSessionsProcessor::process(const cpp2::UpdateSessionsReq& req) {
folly::SharedMutex::WriteHolder wHolder(LockUtils::sessionLock());
std::vector<kvstore::KV> data;
std::unordered_map<nebula::SessionID, std::unordered_set<nebula::ExecutionPlanID>>
std::unordered_map<nebula::SessionID,
std::unordered_map<nebula::ExecutionPlanID, cpp2::QueryDesc>>
killedQueries;
for (auto& session : req.get_sessions()) {
auto sessionId = session.get_session_id();
Expand All @@ -66,7 +67,7 @@ void UpdateSessionsProcessor::process(const cpp2::UpdateSessionsReq& req) {

// update sessions to be saved if query is being killed, and return them to client.
auto& newQueries = *session.queries_ref();
std::unordered_set<nebula::ExecutionPlanID> killedQueriesInCurrentSession;
std::unordered_map<nebula::ExecutionPlanID, cpp2::QueryDesc> killedQueriesInCurrentSession;
auto sessionInMeta = MetaServiceUtils::parseSessionVal(nebula::value(ret));
for (const auto& savedQuery : sessionInMeta.get_queries()) {
auto epId = savedQuery.first;
Expand All @@ -77,7 +78,7 @@ void UpdateSessionsProcessor::process(const cpp2::UpdateSessionsReq& req) {
auto& desc = savedQuery.second;
if (desc.get_status() == cpp2::QueryStatus::KILLING) {
const_cast<cpp2::QueryDesc&>(newQuery->second).set_status(desc.get_status());
killedQueriesInCurrentSession.emplace(epId);
killedQueriesInCurrentSession.emplace(epId, desc);
}
}
if (!killedQueriesInCurrentSession.empty()) {
Expand Down

0 comments on commit e32eb13

Please sign in to comment.