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

Slow query. #1152

Merged
merged 34 commits into from
Jul 2, 2021
Merged

Slow query. #1152

merged 34 commits into from
Jul 2, 2021

Conversation

CPWstatic
Copy link
Contributor

@CPWstatic CPWstatic commented Jun 17, 2021

@CPWstatic CPWstatic added the wip Solution: work in progress label Jun 17, 2021
@CPWstatic CPWstatic added depend on common PR: this PR depends on PRs in the common repo depend on storage PR: this PR depends on PRs in the storage repo and removed wip Solution: work in progress labels Jun 24, 2021
@CPWstatic CPWstatic added the doc affected Solution: improvements or additions to documentation label Jun 29, 2021
Then an SemanticError should be raised at runtime: $-.eid, Session ID must be an integer but was STRING
When executing query:
"""
SHOW ALL QUERIES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should enable input/output of admin sentence.

src/executor/admin/KillQueryExecutor.cpp Outdated Show resolved Hide resolved
src/executor/admin/KillQueryExecutor.cpp Outdated Show resolved Hide resolved
src/executor/admin/KillQueryExecutor.cpp Outdated Show resolved Hide resolved
src/executor/admin/ShowQueriesExecutor.cpp Outdated Show resolved Hide resolved
src/executor/admin/KillQueryExecutor.h Outdated Show resolved Hide resolved
src/executor/test/ShowQueriesTest.cpp Outdated Show resolved Hide resolved
tests/tck/steps/test_slow_query.py Outdated Show resolved Hide resolved
tests/tck/slowquery/SlowQuery.feature Outdated Show resolved Hide resolved
src/executor/admin/KillQueryExecutor.cpp Show resolved Hide resolved
src/executor/admin/KillQueryExecutor.cpp Show resolved Hide resolved
src/session/ClientSession.cpp Outdated Show resolved Hide resolved
yixinglu
yixinglu previously approved these changes Jul 1, 2021
laura-ding
laura-ding previously approved these changes Jul 1, 2021
auto findPtr = activeSessions_.find(sid);
if (findPtr == activeSessions_.end()) {
VLOG(1) << "Create session id: " << sid << ", for user: " << userName;
auto sessionPtr = ClientSession::create(std::move(session), metaClient_);
sessionPtr->charge();
activeSessions_[sid] = sessionPtr;
auto ret = activeSessions_.emplace(sid, sessionPtr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to clear the queries of the session.

->getMetaClient()
->killQuery(std::move(killQueries))
.via(runner())
.thenValue([pro = std::move(pro), this](auto&& resp) mutable {
Copy link
Contributor

@yixinglu yixinglu Jul 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to chain these async futures, otherwise you must handle the exception threw by killQuery interface.

auto metaClient = qctx()->getMetaClient();
return metaClient->listSession()
  .via(runner())
  .thenValue([metaClient](listResp){
    // ...blabla
    return metaClient->killQuery(killedQueries);
  })
  .thenValue([](auto &&resp){
    // ... some status
    return status;
  });

laura-ding
laura-ding previously approved these changes Jul 1, 2021
@CPWstatic CPWstatic added the ready-for-testing PR: ready for the CI test label Jul 1, 2021
laura-ding
laura-ding previously approved these changes Jul 1, 2021
yixinglu
yixinglu previously approved these changes Jul 1, 2021
@CPWstatic CPWstatic merged commit 669694c into vesoft-inc:master Jul 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
depend on common PR: this PR depends on PRs in the common repo depend on storage PR: this PR depends on PRs in the storage repo doc affected Solution: improvements or additions to documentation ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants