You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/01/04 09:27:28 UTC

[GitHub] [iotdb] Alima777 commented on a change in pull request #2352: [IOTDB-965] Add timeout in query

Alima777 commented on a change in pull request #2352:
URL: https://github.com/apache/iotdb/pull/2352#discussion_r551200366



##########
File path: server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
##########
@@ -319,6 +331,25 @@ private void operateCreateSnapshot() {
     IoTDB.metaManager.createMTreeSnapshot();
   }
 
+  private void operateKillQuery(KillQueryPlan killQueryPlan) throws QueryIdNotExsitException {
+    QueryTimeManager queryTimeManager = QueryTimeManager.getInstance();
+    if (killQueryPlan.getQueryId() != -1) {
+      if (queryTimeManager.getQueryThreadMap().get(killQueryPlan.getQueryId()) != null) {
+        queryTimeManager.killQuery(killQueryPlan.getQueryId());
+      } else {
+        throw new QueryIdNotExsitException(String
+            .format("Query Id %d is not exist, please check it.", killQueryPlan.getQueryId()));
+      }
+    } else {
+      // if queryId is not specified, kill all running queries
+      if (!queryTimeManager.getQueryThreadMap().isEmpty()) {
+        for (Long queryId : queryTimeManager.getQueryThreadMap().keySet()) {
+          queryTimeManager.killQuery(queryId);
+        }

Review comment:
       Fixed. Thanks for the reminder.




----------------------------------------------------------------
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:
users@infra.apache.org