You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ca...@apache.org on 2023/05/16 07:55:29 UTC

[iotdb] branch beyyes/optimize_tsbs updated (d55c494c32 -> 6a3315d726)

This is an automated email from the ASF dual-hosted git repository.

caogaofei pushed a change to branch beyyes/optimize_tsbs
in repository https://gitbox.apache.org/repos/asf/iotdb.git


    from d55c494c32 add special optimization for SimpleQueryTerminator when code is executed locally
     new 14b75d77db comment SetThreadName impl
     new 6a3315d726 add TsbsExample

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/iotdb/TsbsExample.java    | 51 ++++++++++++++++++++++
 .../java/org/apache/iotdb/db/conf/IoTDBConfig.java |  2 +-
 .../mpp/plan/scheduler/SimpleQueryTerminator.java  |  4 ++
 .../org/apache/iotdb/db/utils/SetThreadName.java   | 20 ++++-----
 4 files changed, 65 insertions(+), 12 deletions(-)
 create mode 100644 example/session/src/main/java/org/apache/iotdb/TsbsExample.java


[iotdb] 02/02: add TsbsExample

Posted by ca...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

caogaofei pushed a commit to branch beyyes/optimize_tsbs
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 6a3315d726af4d60969fc10a4686d6c3051a1044
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Tue May 16 14:09:03 2023 +0800

    add TsbsExample
---
 .../main/java/org/apache/iotdb/TsbsExample.java    | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/example/session/src/main/java/org/apache/iotdb/TsbsExample.java b/example/session/src/main/java/org/apache/iotdb/TsbsExample.java
new file mode 100644
index 0000000000..4b795ed821
--- /dev/null
+++ b/example/session/src/main/java/org/apache/iotdb/TsbsExample.java
@@ -0,0 +1,51 @@
+package org.apache.iotdb;
+
+import org.apache.iotdb.common.rpc.thrift.TAggregationType;
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+import org.apache.iotdb.session.pool.SessionPool;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class TsbsExample {
+
+  private static SessionPool sessionPool;
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(ReadTest.class);
+
+  private static int THREAD_NUMBER = 300;
+
+  private static int DEVICE_NUMBER = 20000;
+
+  private static int READ_LOOP = 10000000;
+
+  private static void constructRedirectSessionPool() {
+    List<String> nodeUrls = new ArrayList<>();
+    nodeUrls.add("127.0.0.1:6667");
+    sessionPool =
+        new SessionPool.Builder()
+            .nodeUrls(nodeUrls)
+            .user("root")
+            .password("root")
+            .maxSize(500)
+            .build();
+    sessionPool.setFetchSize(10000);
+  }
+
+  private static void executeQuery() throws IoTDBConnectionException, StatementExecutionException {
+    List<String> paths = Collections.singletonList("root.sg.cpu.host_931.usage_user");
+    List<TAggregationType> types = Collections.singletonList(TAggregationType.MAX_VALUE);
+    sessionPool.executeAggregationQuery(paths, types, 1451691893000L, 1451695493000L, 60000);
+  }
+
+  public static void main(String[] args)
+      throws IoTDBConnectionException, StatementExecutionException {
+    constructRedirectSessionPool();
+    executeQuery();
+  }
+}


[iotdb] 01/02: comment SetThreadName impl

Posted by ca...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

caogaofei pushed a commit to branch beyyes/optimize_tsbs
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 14b75d77db2217505a5aae4d96e1a6b499563307
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Tue May 16 14:08:38 2023 +0800

    comment SetThreadName impl
---
 .../java/org/apache/iotdb/db/conf/IoTDBConfig.java   |  2 +-
 .../db/mpp/plan/scheduler/SimpleQueryTerminator.java |  4 ++++
 .../org/apache/iotdb/db/utils/SetThreadName.java     | 20 +++++++++-----------
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index becba4918e..5bd109c6d4 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -825,7 +825,7 @@ public class IoTDBConfig {
   private int frequencyIntervalInMinute = 1;
 
   /** time cost(ms) threshold for slow query. Unit: millisecond */
-  private long slowQueryThreshold = 5000;
+  private long slowQueryThreshold = 5000000;
 
   private int patternMatchingThreshold = 1000000;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/SimpleQueryTerminator.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/SimpleQueryTerminator.java
index be1712c6c6..6aee653bc0 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/SimpleQueryTerminator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/SimpleQueryTerminator.java
@@ -116,6 +116,8 @@ public class SimpleQueryTerminator implements IQueryTerminator {
         return true;
       }
 
+      logger.error("!!!!!!!!unexpected!!!!!!!!!");
+
       try (SyncDataNodeInternalServiceClient client =
           internalServiceClientManager.borrowClient(endPoint)) {
         client.cancelQuery(new TCancelQueryReq(queryId.getId(), unfinishedFIs, false));
@@ -153,6 +155,8 @@ public class SimpleQueryTerminator implements IQueryTerminator {
         return true;
       }
 
+      logger.error("!!!!!!!!unexpected!!!!!!!!!");
+
       try (SyncDataNodeInternalServiceClient client =
           internalServiceClientManager.borrowClient(endPoint)) {
         client.cancelQuery(new TCancelQueryReq(queryId.getId(), unfinishedFIs, true));
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/SetThreadName.java b/server/src/main/java/org/apache/iotdb/db/utils/SetThreadName.java
index 43adca20b2..e6126b6908 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/SetThreadName.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/SetThreadName.java
@@ -20,20 +20,18 @@ package org.apache.iotdb.db.utils;
 
 import java.io.Closeable;
 
-import static java.util.Objects.requireNonNull;
-
 public class SetThreadName implements Closeable {
-  private final String originalThreadName;
+  private final String originalThreadName = "";
 
   public SetThreadName(String suffix) {
-    requireNonNull(suffix, "suffix is null");
-    originalThreadName = Thread.currentThread().getName();
-    int index = originalThreadName.indexOf("$");
-    if (index < 0) {
-      Thread.currentThread().setName(originalThreadName + '$' + suffix);
-    } else {
-      Thread.currentThread().setName(originalThreadName.substring(0, index) + '$' + suffix);
-    }
+    //    requireNonNull(suffix, "suffix is null");
+    //    originalThreadName = Thread.currentThread().getName();
+    //    int index = originalThreadName.indexOf("$");
+    //    if (index < 0) {
+    //      Thread.currentThread().setName(originalThreadName + '$' + suffix);
+    //    } else {
+    //      Thread.currentThread().setName(originalThreadName.substring(0, index) + '$' + suffix);
+    //    }
   }
 
   @Override