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 2022/04/14 05:42:13 UTC

[iotdb] branch master updated: [IOTDB-2905] IoTDBRecoverUnclosedIT failed in ci (#5514)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new becb89fe61 [IOTDB-2905] IoTDBRecoverUnclosedIT failed in ci  (#5514)
becb89fe61 is described below

commit becb89fe61f48bf8c046c2e935c517ff26c2661c
Author: Alan Choo <43...@users.noreply.github.com>
AuthorDate: Thu Apr 14 13:42:08 2022 +0800

    [IOTDB-2905] IoTDBRecoverUnclosedIT failed in ci  (#5514)
---
 .../iotdb/db/integration/IoTDBRecoverUnclosedIT.java    | 17 +++++++++++++++--
 .../org/apache/iotdb/db/utils/EnvironmentUtils.java     |  2 --
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBRecoverUnclosedIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBRecoverUnclosedIT.java
index 86730b0a28..2d415d7dfb 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBRecoverUnclosedIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBRecoverUnclosedIT.java
@@ -20,7 +20,10 @@
 package org.apache.iotdb.db.integration;
 
 import org.apache.iotdb.commons.exception.StartupException;
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.wal.utils.WALMode;
 import org.apache.iotdb.itbase.category.LocalStandaloneTest;
 import org.apache.iotdb.jdbc.Config;
 
@@ -46,6 +49,7 @@ import static org.junit.Assert.fail;
 
 @Category({LocalStandaloneTest.class})
 public class IoTDBRecoverUnclosedIT {
+  private static final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
 
   private static final String TIMESTAMP_STR = "Time";
   private static final String TEMPERATURE_STR = "root.ln.wf01.wt01.temperature";
@@ -83,8 +87,12 @@ public class IoTDBRecoverUnclosedIT {
   private String insertTemplate =
       "INSERT INTO root.vehicle.d0(timestamp,s0,s1,s2,s3,s4)" + " VALUES(%d,%d,%d,%f,%s,%s)";
 
+  private WALMode prevWALMode;
+
   @Before
   public void setUp() throws Exception {
+    prevWALMode = config.getWalMode();
+    config.setWalMode(WALMode.SYNC);
     EnvironmentUtils.envSetUp();
     Class.forName(Config.JDBC_DRIVER_NAME);
     prepareData();
@@ -93,6 +101,7 @@ public class IoTDBRecoverUnclosedIT {
   @After
   public void tearDown() throws Exception {
     EnvironmentUtils.cleanEnv();
+    config.setWalMode(prevWALMode);
   }
 
   @Test
@@ -170,13 +179,17 @@ public class IoTDBRecoverUnclosedIT {
       Assert.fail();
     }
 
-    // maxminValueTest
+    // test count, max, min value
     retArray = new String[] {"0,8499,500.0", "0,2499,500.0"};
     try (Connection connection =
             DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
         Statement statement = connection.createStatement()) {
+      boolean hasResultSet = statement.execute("select count(*) from root.vehicle.d0");
+      Assert.assertTrue(hasResultSet);
+      statement.getResultSet().next();
+      Assert.assertEquals(7500, statement.getResultSet().getInt("count(" + d0s0 + ")"));
 
-      boolean hasResultSet =
+      hasResultSet =
           statement.execute(
               "select max_value(s0),min_value(s2) "
                   + "from root.vehicle.d0 where time >= 100 and time < 9000");
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/EnvironmentUtils.java b/server/src/main/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
index 72fe252602..fb8d60db8c 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
@@ -50,7 +50,6 @@ import org.apache.iotdb.db.rescon.TsFileResourceManager;
 import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.sync.pipedata.queue.PipeDataQueueFactory;
 import org.apache.iotdb.db.wal.WALManager;
-import org.apache.iotdb.db.wal.utils.WALMode;
 import org.apache.iotdb.metrics.config.MetricConfigDescriptor;
 import org.apache.iotdb.rpc.TConfigurationConst;
 import org.apache.iotdb.rpc.TSocketWrapper;
@@ -282,7 +281,6 @@ public class EnvironmentUtils {
     MetricConfigDescriptor.getInstance().getMetricConfig().setEnableMetric(false);
     config.setAvgSeriesPointNumberThreshold(Integer.MAX_VALUE);
     // use async wal mode in test
-    config.setWalMode(WALMode.ASYNC);
     config.setAvgSeriesPointNumberThreshold(Integer.MAX_VALUE);
     if (daemon == null) {
       daemon = new IoTDB();