You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2021/08/12 00:29:25 UTC

[iotdb] branch CreateTimeseriesIT created (now e0e3a6c)

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

haonan pushed a change to branch CreateTimeseriesIT
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at e0e3a6c  [To rel/0.12] Fix CreateTimeseriesIT runs slow

This branch includes the following new commits:

     new e0e3a6c  [To rel/0.12] Fix CreateTimeseriesIT runs slow

The 1 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.


[iotdb] 01/01: [To rel/0.12] Fix CreateTimeseriesIT runs slow

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

haonan pushed a commit to branch CreateTimeseriesIT
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit e0e3a6c711cde0f6054a7c0996e08c8987015e25
Author: HTHou <hh...@outlook.com>
AuthorDate: Thu Aug 12 08:28:29 2021 +0800

    [To rel/0.12] Fix CreateTimeseriesIT runs slow
---
 .../db/integration/IoTDBCreateTimeseriesIT.java    | 32 +++++++++++++++-------
 .../apache/iotdb/db/utils/EnvironmentUtils.java    |  3 ++
 2 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateTimeseriesIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateTimeseriesIT.java
index ba076bb..502fc34 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateTimeseriesIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateTimeseriesIT.java
@@ -51,22 +51,19 @@ public class IoTDBCreateTimeseriesIT {
   @Before
   public void setUp() throws Exception {
     EnvironmentUtils.envSetUp();
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-    statement = connection.createStatement();
   }
 
   @After
   public void tearDown() throws Exception {
-    statement.close();
-    connection.close();
     EnvironmentUtils.cleanEnv();
   }
 
   /** Test creating a time series that is a prefix path of an existing time series */
   @Test
   public void testCreateTimeseries1() throws Exception {
+    Class.forName(Config.JDBC_DRIVER_NAME);
+    connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
+    statement = connection.createStatement();
     String[] timeSeriesArray = {"root.sg1.aa.bb", "root.sg1.aa.bb.cc", "root.sg1.aa"};
 
     for (String timeSeries : timeSeriesArray) {
@@ -79,11 +76,17 @@ public class IoTDBCreateTimeseriesIT {
     // ensure that current timeseries in cache is right.
     createTimeSeries1Tool(timeSeriesArray);
 
-    EnvironmentUtils.stopDaemon();
-    setUp();
+    statement.close();
+    connection.close();
+    EnvironmentUtils.restartDaemon();
 
+    Class.forName(Config.JDBC_DRIVER_NAME);
+    connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
+    statement = connection.createStatement();
     // ensure timeseries in cache is right after recovered.
     createTimeSeries1Tool(timeSeriesArray);
+    statement.close();
+    connection.close();
   }
 
   private void createTimeSeries1Tool(String[] timeSeriesArray) throws SQLException {
@@ -112,6 +115,9 @@ public class IoTDBCreateTimeseriesIT {
   /** Test if creating a time series will cause the storage group with same name to disappear */
   @Test
   public void testCreateTimeseries2() throws Exception {
+    Class.forName(Config.JDBC_DRIVER_NAME);
+    connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
+    statement = connection.createStatement();
     String storageGroup = "root.sg1.a.b.c";
 
     statement.execute(String.format("SET storage group TO %s", storageGroup));
@@ -126,11 +132,17 @@ public class IoTDBCreateTimeseriesIT {
     // ensure that current storage group in cache is right.
     createTimeSeries2Tool(storageGroup);
 
-    EnvironmentUtils.stopDaemon();
-    setUp();
+    statement.close();
+    connection.close();
+    EnvironmentUtils.restartDaemon();
 
+    Class.forName(Config.JDBC_DRIVER_NAME);
+    connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
+    statement = connection.createStatement();
     // ensure storage group in cache is right after recovered.
     createTimeSeries2Tool(storageGroup);
+    statement.close();
+    connection.close();
   }
 
   private void createTimeSeries2Tool(String storageGroup) throws SQLException {
diff --git a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
index c459760..7529329 100644
--- a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
+++ b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
@@ -38,6 +38,8 @@ import org.apache.iotdb.db.query.udf.service.UDFRegistrationService;
 import org.apache.iotdb.db.rescon.PrimitiveArrayManager;
 import org.apache.iotdb.db.rescon.SystemInfo;
 import org.apache.iotdb.db.service.IoTDB;
+import org.apache.iotdb.db.service.RPCService;
+import org.apache.iotdb.db.service.thrift.ThriftService;
 import org.apache.iotdb.rpc.TConfigurationConst;
 import org.apache.iotdb.rpc.TSocketWrapper;
 
@@ -93,6 +95,7 @@ public class EnvironmentUtils {
       fail(e.getMessage());
     }
 
+    RPCService.getInstance().stopService();
     logger.warn("EnvironmentUtil cleanEnv...");
     if (daemon != null) {
       daemon.stop();