You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2020/06/01 16:49:56 UTC

[incubator-iotdb] branch fix-IOTDB-615 updated: add testInsert* in SessionPool

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

hxd pushed a commit to branch fix-IOTDB-615
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/fix-IOTDB-615 by this push:
     new e906b9d  add testInsert* in SessionPool
e906b9d is described below

commit e906b9d7e44b7f5c32c86f1660bd818eef2ddb43
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Tue Jun 2 00:49:38 2020 +0800

    add testInsert* in SessionPool
---
 pom.xml                                            |  3 +-
 service-rpc/src/main/thrift/rpc.thrift             |  2 +
 .../org/apache/iotdb/session/pool/SessionPool.java | 46 ++++++++++++++++++++++
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 05b0a5b..95f0fb0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1222,7 +1222,8 @@
         <!-- upload code coverage report to coveralls.io-->
         <!-- to enable coveralls locally, you need to get the repoToken from https://coveralls.io/github/apache/incubator-iotdb.
              use `mvn post-integration-test -Pcode-coverage -DrepoToken=TOKEN`-->
-        <!-- enable site--><!-- use `mvn package -P site -pl site` to compile the site module only -->
+        <!-- enable site-->
+        <!-- use `mvn package -P site -pl site` to compile the site module only -->
         <profile>
             <id>site</id>
             <modules>
diff --git a/service-rpc/src/main/thrift/rpc.thrift b/service-rpc/src/main/thrift/rpc.thrift
index 0073669..6dd4edf 100644
--- a/service-rpc/src/main/thrift/rpc.thrift
+++ b/service-rpc/src/main/thrift/rpc.thrift
@@ -303,6 +303,8 @@ service TSIService {
 
 	TSExecuteBatchStatementResp testInsertTablet(1:TSInsertTabletReq req);
 
+  TSExecuteBatchStatementResp testInsertTablets(1:TSInsertTabletsReq req);
+
   TSStatus testInsertRecord(1:TSInsertRecordReq req);
 
   TSExecuteBatchStatementResp testInsertRecords(1:TSInsertRecordsReq req);
diff --git a/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java b/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
index c08cf9d..8221f6b 100644
--- a/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
+++ b/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
@@ -446,6 +446,28 @@ public class SessionPool {
    * This method NOT insert data into database and the server just return after accept the request,
    * this method should be used to test other time cost in client
    */
+  public void testInsertTablets(Map<String, Tablet> tablets)
+      throws IoTDBConnectionException, BatchExecutionException {
+    for (int i = 0; i < RETRY; i++) {
+      Session session = getSession();
+      try {
+        session.testInsertTablets(tablets);
+        putBack(session);
+        return;
+      } catch (IoTDBConnectionException e) {
+        // TException means the connection is broken, remove it and get a new one.
+        cleanSessionAndMayThrowConnectionException(session, i, e);
+      } catch (BatchExecutionException e) {
+        putBack(session);
+        throw e;
+      }
+    }
+  }
+
+  /**
+   * This method NOT insert data into database and the server just return after accept the request,
+   * this method should be used to test other time cost in client
+   */
   public void testInsertRecords(List<String> deviceIds, List<Long> times,
       List<List<String>> measurementsList, List<List<String>> valuesList)
       throws IoTDBConnectionException, BatchExecutionException {
@@ -469,6 +491,30 @@ public class SessionPool {
    * This method NOT insert data into database and the server just return after accept the request,
    * this method should be used to test other time cost in client
    */
+  public void testInsertRecords(List<String> deviceIds, List<Long> times,
+      List<List<String>> measurementsList, List<List<TSDataType>> typesList,
+      List<List<Object>> valuesList)
+      throws IoTDBConnectionException, BatchExecutionException {
+    for (int i = 0; i < RETRY; i++) {
+      Session session = getSession();
+      try {
+        session.testInsertRecords(deviceIds, times, measurementsList, typesList, valuesList);
+        putBack(session);
+        return;
+      } catch (IoTDBConnectionException e) {
+        // TException means the connection is broken, remove it and get a new one.
+        cleanSessionAndMayThrowConnectionException(session, i, e);
+      } catch (BatchExecutionException e) {
+        putBack(session);
+        throw e;
+      }
+    }
+  }
+
+  /**
+   * This method NOT insert data into database and the server just return after accept the request,
+   * this method should be used to test other time cost in client
+   */
   public void testInsertRecord(String deviceId, long time, List<String> measurements,
       List<String> values) throws IoTDBConnectionException, StatementExecutionException {
     for (int i = 0; i < RETRY; i++) {