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

jackietien 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 de0b507523 [IOTDB-2179] New IT framework supports Windows platform 
(#6313)
de0b507523 is described below

commit de0b5075234dbaa9b10a0fb2b20c9c8fcb58a744
Author: BaiJian <[email protected]>
AuthorDate: Sun Jun 19 11:18:16 2022 +0800

    [IOTDB-2179] New IT framework supports Windows platform (#6313)
---
 .github/workflows/cluster-it.yml                   |  17 +-
 .../src/assembly/resources/conf/confignode-env.bat |   8 +-
 confignode/src/assembly/resources/conf/logback.xml |  13 +-
 .../org/apache/iotdb/it/env/ClusterEnvBase.java    | 164 ++++++++++++------
 .../org/apache/iotdb/it/env/ClusterNodeBase.java   | 188 ++++++++++++++-------
 .../java/org/apache/iotdb/it/env/ConfigNode.java   | 152 ++++++++---------
 .../java/org/apache/iotdb/it/env/DataNode.java     | 128 ++++++--------
 .../iotdb/itbase/runtime/ClusterTestStatement.java |  42 +++--
 .../itbase/runtime/ParallelRequestDelegate.java    |   2 +-
 ...gregationWithoutValueFilterWithDeletion2IT.java |   3 +
 ...ggregationWithoutValueFilterWithDeletionIT.java |   3 +
 ...upByQueryWithoutValueFilterWithDeletion2IT.java |   3 +
 ...oupByQueryWithoutValueFilterWithDeletionIT.java |   3 +
 server/src/assembly/resources/conf/iotdb-env.bat   |   8 +-
 server/src/assembly/resources/conf/logback.xml     |  13 +-
 15 files changed, 431 insertions(+), 316 deletions(-)

diff --git a/.github/workflows/cluster-it.yml b/.github/workflows/cluster-it.yml
index 724d818cfd..66709637b0 100644
--- a/.github/workflows/cluster-it.yml
+++ b/.github/workflows/cluster-it.yml
@@ -22,13 +22,13 @@ env:
   MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false 
-Dmaven.wagon.http.retryHandler.class=standard 
-Dmaven.wagon.http.retryHandler.count=3
 
 jobs:
-  unix:
+  ClusterIT:
     strategy:
       fail-fast: false
       max-parallel: 20
       matrix:
         java: [ 8, 11, 17 ]
-        os: [ ubuntu-latest, macos-latest ]
+        os: [ ubuntu-latest, macos-latest, windows-latest ]
     runs-on: ${{ matrix.os }}
 
     steps:
@@ -45,6 +45,18 @@ jobs:
           restore-keys: ${{ runner.os }}-m2-
       - name: Check Apache Rat
         run: mvn -B apache-rat:check -P site -P code-coverage
+      - name: Adjust network dynamic TCP ports range
+        if: ${{ runner.os == 'Windows' }}
+        shell: pwsh
+        run: netsh int ipv4 set dynamicport tcp start=32768 num=32768
+      - name: Adjust Linux kernel somaxconn
+        if: ${{ runner.os == 'Linux' }}
+        shell: bash
+        run: sudo sysctl -w net.core.somaxconn=65535
+      - name: Adjust Mac kernel somaxconn
+        if: ${{ runner.os == 'macOS' }}
+        shell: bash
+        run: sudo sysctl -w kern.ipc.somaxconn=65535
       - name: IT/UT Test
         shell: bash
         # we do not compile client-cpp for saving time, it is tested in 
client.yml
@@ -69,4 +81,3 @@ jobs:
           name: cluster-log-java${{ matrix.java }}-${{ runner.os }}
           path: integration-test/target/cluster-logs
           retention-days: 1
-
diff --git a/confignode/src/assembly/resources/conf/confignode-env.bat 
b/confignode/src/assembly/resources/conf/confignode-env.bat
index 294b52be03..e00a464764 100644
--- a/confignode/src/assembly/resources/conf/confignode-env.bat
+++ b/confignode/src/assembly/resources/conf/confignode-env.bat
@@ -53,9 +53,9 @@ for /f  %%b in ('wmic ComputerSystem get TotalPhysicalMemory 
^| findstr "[0-9]"'
        set system_memory=%%b
 )
 
-echo wsh.echo FormatNumber(cdbl(%system_memory%)/(1024*1024), 0) > 
%temp%\tmp.vbs
-for /f "tokens=*" %%a in ('cscript //nologo %temp%\tmp.vbs') do set 
system_memory_in_mb=%%a
-del %temp%\tmp.vbs
+echo wsh.echo FormatNumber(cdbl(%system_memory%)/(1024*1024), 0) > 
%CONFIGNODE_HOME%\sbin\tmp.vbs
+for /f "tokens=*" %%a in ('cscript //nologo %CONFIGNODE_HOME%\sbin\tmp.vbs') 
do set system_memory_in_mb=%%a
+del %CONFIGNODE_HOME%\sbin\tmp.vbs
 set system_memory_in_mb=%system_memory_in_mb:,=%
 
 set /a half_=%system_memory_in_mb%/2
@@ -111,7 +111,7 @@ set temp_buffer_pool_size=1024
 @REM which equals DIRECT_MEMORY_SIZE / threads_number / temp_buffer_pool_size
 set 
MAX_CACHED_BUFFER_SIZE=%max_heap_size_in_mb%*1024*1024/%threads_number%/%temp_buffer_pool_size%
 
-set CONFIGNODE_HEAP_OPTS=-Xmx%MAX_HEAP_SIZE% -Xms%HEAP_NEWSIZE% 
-Xlog:gc:"..\gc.log"
+set CONFIGNODE_HEAP_OPTS=-Xmx%MAX_HEAP_SIZE% -Xms%HEAP_NEWSIZE% 
-Xlog:gc:"%CONFIGNODE_HOME%\gc.log"
 set CONFIGNODE_HEAP_OPTS=%CONFIGNODE_HEAP_OPTS% 
-XX:MaxDirectMemorySize=%MAX_DIRECT_MEMORY_SIZE%
 set CONFIGNODE_HEAP_OPTS=%CONFIGNODE_HEAP_OPTS% 
-Djdk.nio.maxCachedBufferSize=%MAX_CACHED_BUFFER_SIZE%
 
diff --git a/confignode/src/assembly/resources/conf/logback.xml 
b/confignode/src/assembly/resources/conf/logback.xml
index 63d7725412..28d214b2a4 100644
--- a/confignode/src/assembly/resources/conf/logback.xml
+++ b/confignode/src/assembly/resources/conf/logback.xml
@@ -106,7 +106,7 @@
             <charset>utf-8</charset>
         </encoder>
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-            <level>DEBUG</level>
+            <level>${CONSOLE_LOG_LEVEL:-DEBUG}</level>
         </filter>
     </appender>
     <!-- a log appender that collect all log records whose level is greater 
than debug-->
@@ -127,16 +127,6 @@
             <level>INFO</level>
         </filter>
     </appender>
-    <appender class="ch.qos.logback.core.FileAppender" name="ITForCluster">
-        <file>${IT_LOG_PATH:-/dev/null}</file>
-        <encoder>
-            <pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
-            <charset>utf-8</charset>
-        </encoder>
-        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-            <level>${IT_LOG_LEVEL:-OFF}</level>
-        </filter>
-    </appender>
     <root level="info">
         <appender-ref ref="FILEDEBUG"/>
         <appender-ref ref="FILEWARN"/>
@@ -144,7 +134,6 @@
         <appender-ref ref="FILEINFO"/>
         <appender-ref ref="FILEALL"/>
         <appender-ref ref="stdout"/>
-        <appender-ref ref="ITForCluster"/>
     </root>
     <logger level="info" name="org.apache.iotdb.confignode"/>
     <logger level="info" name="org.apache.ratis"/>
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/ClusterEnvBase.java 
b/integration-test/src/main/java/org/apache/iotdb/it/env/ClusterEnvBase.java
index bcd2fba58c..1a97596600 100644
--- a/integration-test/src/main/java/org/apache/iotdb/it/env/ClusterEnvBase.java
+++ b/integration-test/src/main/java/org/apache/iotdb/it/env/ClusterEnvBase.java
@@ -21,6 +21,9 @@ package org.apache.iotdb.it.env;
 import org.apache.iotdb.itbase.env.BaseEnv;
 import org.apache.iotdb.itbase.runtime.ClusterTestConnection;
 import org.apache.iotdb.itbase.runtime.NodeConnection;
+import org.apache.iotdb.itbase.runtime.ParallelRequestDelegate;
+import org.apache.iotdb.itbase.runtime.RequestDelegate;
+import org.apache.iotdb.itbase.runtime.SerialRequestDelegate;
 import org.apache.iotdb.jdbc.Config;
 import org.apache.iotdb.jdbc.Constant;
 import org.apache.iotdb.jdbc.IoTDBConnection;
@@ -30,21 +33,22 @@ import org.slf4j.LoggerFactory;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
-import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.sql.Statement;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Random;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
 
 import static org.apache.iotdb.jdbc.Config.VERSION;
 import static org.junit.Assert.fail;
 
 public abstract class ClusterEnvBase implements BaseEnv {
   private static final Logger logger = 
LoggerFactory.getLogger(ClusterEnvBase.class);
+  private final int NODE_START_TIMEOUT = 10;
   private List<ConfigNode> configNodes;
   private List<DataNode> dataNodes;
   private final Random rand = new Random();
@@ -54,10 +58,7 @@ public abstract class ClusterEnvBase implements BaseEnv {
     this.configNodes = new ArrayList<>();
     this.dataNodes = new ArrayList<>();
 
-    String testName = getTestClassName();
-    if (nextTestCase != null) {
-      testName = testName + "_" + nextTestCase;
-    }
+    final String testName = getTestClassName() + getNextTestCaseString();
 
     ConfigNode seedConfigNode = new ConfigNode(true, "", testName);
     seedConfigNode.createDir();
@@ -67,22 +68,50 @@ public abstract class ClusterEnvBase implements BaseEnv {
     this.configNodes.add(seedConfigNode);
     logger.info("In test " + testName + " SeedConfigNode " + 
seedConfigNode.getId() + " started.");
 
+    List<String> configNodeEndpoints = new ArrayList<>();
+    RequestDelegate<Void> configNodesDelegate = new 
SerialRequestDelegate<>(configNodeEndpoints);
     for (int i = 1; i < configNodesNum; i++) {
       ConfigNode configNode = new ConfigNode(false, targetConfignode, 
testName);
+      this.configNodes.add(configNode);
+      configNodeEndpoints.add(configNode.getIpAndPortString());
       configNode.createDir();
       configNode.changeConfig(null);
-      configNode.start();
-      this.configNodes.add(configNode);
-      logger.info("In test " + testName + " ConfigNode " + configNode.getId() 
+ " started.");
+      configNodesDelegate.addRequest(
+          () -> {
+            configNode.start();
+            logger.info("In test " + testName + " ConfigNode " + 
configNode.getId() + " started.");
+            return null;
+          });
+    }
+    try {
+      configNodesDelegate.requestAll();
+    } catch (SQLException e) {
+      logger.error("Start configNodes failed", e);
+      fail();
     }
 
+    List<String> dataNodeEndpoints = new ArrayList<>();
+    RequestDelegate<Void> dataNodesDelegate =
+        new ParallelRequestDelegate<>(dataNodeEndpoints, NODE_START_TIMEOUT);
     for (int i = 0; i < dataNodesNum; i++) {
       DataNode dataNode = new DataNode(targetConfignode, testName);
+      this.dataNodes.add(dataNode);
+      dataNodeEndpoints.add(dataNode.getIpAndPortString());
       dataNode.createDir();
       dataNode.changeConfig(ConfigFactory.getConfig().getEngineProperties());
-      dataNode.start();
-      this.dataNodes.add(dataNode);
-      logger.info("In test " + testName + " DataNode " + dataNode.getId() + " 
started.");
+      dataNodesDelegate.addRequest(
+          () -> {
+            dataNode.start();
+            logger.info("In test " + testName + " DataNode " + 
dataNode.getId() + " started.");
+            return null;
+          });
+    }
+
+    try {
+      dataNodesDelegate.requestAll();
+    } catch (SQLException e) {
+      logger.error("Start dataNodes failed", e);
+      fail();
     }
 
     testWorking();
@@ -127,33 +156,49 @@ public abstract class ClusterEnvBase implements BaseEnv {
   }
 
   public void testWorking() throws InterruptedException {
-    int counter = 0;
-    TimeUnit.SECONDS.sleep(2);
-
-    do {
-      TimeUnit.SECONDS.sleep(1);
-
-      counter++;
-      if (counter > 30) {
-        fail("After 30 times retry, the cluster can't work!");
+    List<String> endpoints =
+        
dataNodes.stream().map(ClusterNodeBase::getIpAndPortString).collect(Collectors.toList());
+    boolean[] success = new boolean[dataNodes.size()];
+    Exception[] exceptions = new Exception[dataNodes.size()];
+    final int probeTimeout = 5;
+    AtomicInteger successCount = new AtomicInteger(0);
+    for (int counter = 0; counter < 30; counter++) {
+      RequestDelegate<Void> testDelegate = new 
ParallelRequestDelegate<>(endpoints, probeTimeout);
+      for (int i = 0; i < dataNodes.size(); i++) {
+        final int idx = i;
+        final String dataNodeEndpoint = dataNodes.get(i).getIpAndPortString();
+        testDelegate.addRequest(
+            () -> {
+              if (!success[idx]) {
+                try (Connection ignored = getConnection(dataNodeEndpoint, 
probeTimeout)) {
+                  success[idx] = true;
+                  successCount.incrementAndGet();
+                } catch (Exception e) {
+                  exceptions[idx] = e;
+                  logger.debug("Open connection of {} failed", 
dataNodeEndpoint, e);
+                }
+              }
+              return null;
+            });
       }
-
-      try (IoTDBConnection connection = getConnection(60);
-          Statement statement = connection.createStatement()) {
-        statement.execute("SET STORAGE GROUP TO root.test" + counter);
-        statement.execute(
-            "CREATE TIMESERIES root.test" + counter + ".d0.s0 WITH 
DATATYPE=INT32, ENCODING=RLE");
-        try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES")) {
-          if (resultSet.next()) {
-            statement.execute("DELETE STORAGE GROUP root.*");
-            logger.info("The whole cluster is ready.");
-            break;
-          }
-        }
+      try {
+        testDelegate.requestAll();
       } catch (SQLException e) {
-        logger.debug(counter + " time(s) connect to cluster failed!", e);
+        // It will never be thrown as it has already caught in the request.
+      }
+      if (successCount.get() == dataNodes.size()) {
+        logger.info("The whole cluster is ready.");
+        return;
+      }
+      TimeUnit.SECONDS.sleep(1);
+    }
+    // The cluster is not ready after 30 times to try
+    for (int i = 0; i < dataNodes.size(); i++) {
+      if (!success[i] && exceptions[i] != null) {
+        logger.error("Connect to {} failed", 
dataNodes.get(i).getIpAndPortString(), exceptions[i]);
       }
-    } while (true);
+    }
+    fail("After 30 times retry, the cluster can't work!");
   }
 
   @Override
@@ -176,14 +221,11 @@ public abstract class ClusterEnvBase implements BaseEnv {
     nextTestCase = testCaseName;
   }
 
-  private IoTDBConnection getConnection(int queryTimeout) throws SQLException {
+  private Connection getConnection(String endpoint, int queryTimeout) throws 
SQLException {
     IoTDBConnection connection =
         (IoTDBConnection)
             DriverManager.getConnection(
-                Config.IOTDB_URL_PREFIX
-                    + this.dataNodes.get(0).getIp()
-                    + ":"
-                    + this.dataNodes.get(0).getPort(),
+                Config.IOTDB_URL_PREFIX + endpoint,
                 System.getProperty("User", "root"),
                 System.getProperty("Password", "root"));
     connection.setQueryTimeout(queryTimeout);
@@ -212,22 +254,27 @@ public abstract class ClusterEnvBase implements BaseEnv {
   }
 
   protected List<NodeConnection> getReadConnections(Constant.Version version) 
throws SQLException {
-    List<NodeConnection> readConnections = new ArrayList<>();
+    List<String> endpoints = new ArrayList<>();
+    ParallelRequestDelegate<NodeConnection> readConnRequestDelegate =
+        new ParallelRequestDelegate<>(endpoints, NODE_START_TIMEOUT);
     for (DataNode dataNode : this.dataNodes) {
-      String endpoint = dataNode.getIp() + ":" + dataNode.getPort();
-      Connection readConnection =
-          DriverManager.getConnection(
-              Config.IOTDB_URL_PREFIX + endpoint + getVersionParam(version),
-              System.getProperty("User", "root"),
-              System.getProperty("Password", "root"));
-      readConnections.add(
-          new NodeConnection(
-              endpoint,
-              NodeConnection.NodeRole.DATA_NODE,
-              NodeConnection.ConnectionRole.READ,
-              readConnection));
+      final String endpoint = dataNode.getIpAndPortString();
+      endpoints.add(endpoint);
+      readConnRequestDelegate.addRequest(
+          () -> {
+            Connection readConnection =
+                DriverManager.getConnection(
+                    Config.IOTDB_URL_PREFIX + endpoint + 
getVersionParam(version),
+                    System.getProperty("User", "root"),
+                    System.getProperty("Password", "root"));
+            return new NodeConnection(
+                endpoint,
+                NodeConnection.NodeRole.DATA_NODE,
+                NodeConnection.ConnectionRole.READ,
+                readConnection);
+          });
     }
-    return readConnections;
+    return readConnRequestDelegate.requestAll();
   }
 
   private String getVersionParam(Constant.Version version) {
@@ -236,4 +283,11 @@ public abstract class ClusterEnvBase implements BaseEnv {
     }
     return "?" + VERSION + "=" + version;
   }
+
+  private String getNextTestCaseString() {
+    if (nextTestCase != null) {
+      return "_" + nextTestCase;
+    }
+    return "";
+  }
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/ClusterNodeBase.java 
b/integration-test/src/main/java/org/apache/iotdb/it/env/ClusterNodeBase.java
index 42cf9f662c..408956a1f9 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/ClusterNodeBase.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/ClusterNodeBase.java
@@ -21,66 +21,45 @@ package org.apache.iotdb.it.env;
 import org.apache.iotdb.itbase.env.BaseNode;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.SystemUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileWriter;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
 import static org.junit.Assert.fail;
 
 public abstract class ClusterNodeBase implements BaseNode {
   private static final Logger logger = 
LoggerFactory.getLogger(ClusterNodeBase.class);
-
   private final String templateNodePath =
       System.getProperty("user.dir") + File.separator + "target" + 
File.separator + "template-node";
-
-  private String id;
-  private final String ip = "127.0.0.1";
-  private int rpcPort;
-
-  private String nodePath;
-  private String scriptPath;
-  private String logPath;
+  private final File NULL_FILE =
+      SystemUtils.IS_OS_WINDOWS ? new File("nul") : new File("/dev/null");
 
   private Process instance;
+  protected final String testName;
 
-  protected void setId(String id) {
-    this.id = id;
-  }
-
-  protected String getId() {
-    return this.id;
-  }
-
-  protected void setPort(int rpcPort) {
-    this.rpcPort = rpcPort;
-  }
-
-  protected String getNodePath() {
-    return this.nodePath;
-  }
-
-  protected void setNodePath(String nodePath) {
-    this.nodePath = nodePath;
+  public ClusterNodeBase(String testName) {
+    this.testName = testName;
   }
 
-  protected void setScriptPath(String scriptPath) {
-    this.scriptPath = scriptPath;
+  protected final String getId() {
+    return "node" + getPort();
   }
 
-  protected void setLogPath(String logPath) {
-    this.logPath = logPath;
-  }
-
-  protected int[] searchAvailablePorts() {
-    String cmd = "lsof -iTCP -sTCP:LISTEN -P -n | awk '{print $9}' | grep -E ";
-    boolean flag = true;
-    int portStart = 10001;
-
+  protected final int[] searchAvailablePorts() {
     do {
       int randomPortStart = 1000 + (int) (Math.random() * (1999 - 1000));
       randomPortStart = randomPortStart * 10 + 1;
@@ -95,38 +74,61 @@ public abstract class ClusterNodeBase implements BaseNode {
         continue;
       }
 
-      StringBuilder port = new StringBuilder(randomPortStart);
-      for (int i = 0; i < 9; i++) {
-        port.append("|");
-        randomPortStart++;
-        port.append(randomPortStart);
-      }
+      List<Integer> requiredPorts =
+          IntStream.rangeClosed(randomPortStart, randomPortStart + 9)
+              .boxed()
+              .collect(Collectors.toList());
+      String cmd = getSearchAvailablePortCmd(requiredPorts);
 
       try {
-        Process proc = Runtime.getRuntime().exec(cmd + "\"" + port + "\"");
+        Process proc = Runtime.getRuntime().exec(cmd);
         BufferedReader br = new BufferedReader(new 
InputStreamReader(proc.getInputStream()));
         String line;
         while ((line = br.readLine()) != null) {
           logger.debug(line);
         }
         if (proc.waitFor() == 1) {
-          flag = false;
-          portStart = randomPortStart - 9;
+          return requiredPorts.stream().mapToInt(Integer::intValue).toArray();
         }
       } catch (IOException | InterruptedException ex) {
         // ignore
       }
-    } while (flag);
+    } while (true);
+  }
 
-    return IntStream.rangeClosed(portStart, portStart + 9).toArray();
+  private String getSearchAvailablePortCmd(List<Integer> ports) {
+    if (SystemUtils.IS_OS_WINDOWS) {
+      return getWindowsSearchPortCmd(ports);
+    }
+    return getUnixSearchPortCmd(ports);
+  }
+
+  private String getWindowsSearchPortCmd(List<Integer> ports) {
+    String cmd = "netstat -aon -p tcp | findStr ";
+    return cmd
+        + ports.stream().map(v -> "/C:'127.0.0.1:" + v + 
"'").collect(Collectors.joining(" "));
+  }
+
+  private String getUnixSearchPortCmd(List<Integer> ports) {
+    String cmd = "lsof -iTCP -sTCP:LISTEN -P -n | awk '{print $9}' | grep -E ";
+    return cmd + 
ports.stream().map(String::valueOf).collect(Collectors.joining("|")) + "\"";
   }
 
   @Override
   public void createDir() {
     // Copy templateNodePath to nodePath
     try {
-      FileUtils.copyDirectoryToDirectory(new File(this.templateNodePath), new 
File(this.nodePath));
-      new File(this.scriptPath).setExecutable(true);
+      FileUtils.copyDirectoryToDirectory(new File(this.templateNodePath), new 
File(getNodePath()));
+      String startScriptPath = getStartScriptPath();
+      String stopScriptPath = getStopScriptPath();
+      if (!new File(startScriptPath).setExecutable(true)) {
+        logger.error("Change {} to executable failed.", startScriptPath);
+      }
+      if (!new File(stopScriptPath).setExecutable(true)) {
+        logger.error("Change {} to executable failed.", stopScriptPath);
+      }
+      // Make sure the log dir exist, as the first file is output by starting 
script directly.
+      FileUtils.createParentDirectories(new File(getLogPath()));
     } catch (IOException ex) {
       fail("Copy node dir failed. " + ex);
     }
@@ -136,7 +138,7 @@ public abstract class ClusterNodeBase implements BaseNode {
   public void destroyDir() {
     // rm this.path
     try {
-      FileUtils.forceDelete(new File(this.nodePath));
+      FileUtils.forceDelete(new File(getNodePath()));
     } catch (IOException ex) {
       fail("Delete node dir failed. " + ex);
     }
@@ -145,12 +147,11 @@ public abstract class ClusterNodeBase implements BaseNode 
{
   @Override
   public void start() {
     try {
+      File stdoutFile = new File(getLogPath());
       ProcessBuilder processBuilder =
-          new ProcessBuilder(this.scriptPath)
-              .redirectOutput(new File("/dev/null"))
-              .redirectError(new File("/dev/null"));
-      processBuilder.environment().put("IT_LOG_PATH", this.logPath);
-      processBuilder.environment().put("IT_LOG_LEVEL", "DEBUG");
+          new ProcessBuilder(getStartScriptPath())
+              .redirectOutput(stdoutFile)
+              .redirectError(stdoutFile);
       this.instance = processBuilder.start();
     } catch (IOException ex) {
       fail("Start node failed. " + ex);
@@ -159,7 +160,29 @@ public abstract class ClusterNodeBase implements BaseNode {
 
   @Override
   public void stop() {
+    if (this.instance == null) {
+      return;
+    }
     this.instance.destroy();
+    // In Windows, the IoTDB process is started as a subprocess of the 
original batch script with a
+    // new pid, so we need to kill the new subprocess as well.
+    if (SystemUtils.IS_OS_WINDOWS) {
+      ProcessBuilder processBuilder =
+          new ProcessBuilder(getStopScriptPath())
+              .redirectOutput(NULL_FILE)
+              .redirectError(NULL_FILE);
+      processBuilder.environment().put("CONSOLE_LOG_LEVEL", "DEBUG");
+      Process p = null;
+      try {
+        p = processBuilder.start();
+        p.waitFor(5, TimeUnit.SECONDS);
+      } catch (IOException | InterruptedException e) {
+        logger.error("Stop instance in Windows failed", e);
+        if (p != null) {
+          p.destroyForcibly();
+        }
+      }
+    }
   }
 
   @Override
@@ -174,17 +197,56 @@ public abstract class ClusterNodeBase implements BaseNode 
{
   }
 
   @Override
-  public String getIp() {
-    return ip;
+  public void changeConfig(Properties properties) {
+    try {
+      String configPath = getConfigPath();
+      Properties configProperties = new Properties();
+      try (InputStream confInput = 
Files.newInputStream(Paths.get(configPath))) {
+        configProperties.load(confInput);
+      }
+      updateConfig(configProperties);
+      if (properties != null && !properties.isEmpty()) {
+        configProperties.putAll(properties);
+      }
+      try (FileWriter confOutput = new FileWriter(configPath)) {
+        configProperties.store(confOutput, null);
+      }
+    } catch (IOException ex) {
+      fail("Change the config of data node failed. " + ex);
+    }
   }
 
   @Override
-  public int getPort() {
-    return rpcPort;
+  public final String getIp() {
+    return "127.0.0.1";
   }
 
   @Override
-  public String getIpAndPortString() {
-    return this.getIp() + ":" + this.rpcPort;
+  public final String getIpAndPortString() {
+    return this.getIp() + ":" + this.getPort();
+  }
+
+  protected String workDirFilePath(String dirName, String fileName) {
+    return getNodePath()
+        + File.separator
+        + "template-node"
+        + File.separator
+        + dirName
+        + File.separator
+        + fileName;
+  }
+
+  protected abstract String getConfigPath();
+
+  protected abstract void updateConfig(Properties properties);
+
+  protected abstract String getStartScriptPath();
+
+  protected abstract String getStopScriptPath();
+
+  protected abstract String getLogPath();
+
+  protected String getNodePath() {
+    return System.getProperty("user.dir") + File.separator + "target" + 
File.separator + getId();
   }
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/ConfigNode.java 
b/integration-test/src/main/java/org/apache/iotdb/it/env/ConfigNode.java
index f2461568f9..8bd7e973da 100644
--- a/integration-test/src/main/java/org/apache/iotdb/it/env/ConfigNode.java
+++ b/integration-test/src/main/java/org/apache/iotdb/it/env/ConfigNode.java
@@ -18,71 +18,23 @@
  */
 package org.apache.iotdb.it.env;
 
+import org.apache.commons.lang3.SystemUtils;
+
 import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
 import java.util.Properties;
 
-import static org.junit.Assert.fail;
-
 public class ConfigNode extends ClusterNodeBase {
 
   private final int consensusPort;
-  private final String configPath;
   private final String targetConfigNode;
+  private final int[] portList;
 
   public ConfigNode(boolean isSeed, String targetConfigNode, String testName) {
+    super(testName);
 
-    int[] portList = super.searchAvailablePorts();
-    super.setPort(portList[0]);
+    portList = super.searchAvailablePorts();
     this.consensusPort = portList[1];
 
-    super.setId("node" + this.getPort());
-
-    String nodePath =
-        System.getProperty("user.dir") + File.separator + "target" + 
File.separator + super.getId();
-    super.setNodePath(nodePath);
-
-    String logPath =
-        System.getProperty("user.dir")
-            + File.separator
-            + "target"
-            + File.separator
-            + "cluster-logs"
-            + File.separator
-            + testName
-            + File.separator
-            + "Config"
-            + super.getId()
-            + ".log";
-    super.setLogPath(logPath);
-
-    String scriptPath =
-        super.getNodePath()
-            + File.separator
-            + "template-node"
-            + File.separator
-            + "confignode"
-            + File.separator
-            + "sbin"
-            + File.separator
-            + "start-confignode"
-            + ".sh";
-    super.setScriptPath(scriptPath);
-
-    this.configPath =
-        super.getNodePath()
-            + File.separator
-            + "template-node"
-            + File.separator
-            + "confignode"
-            + File.separator
-            + "conf"
-            + File.separator
-            + "iotdb-confignode.properties";
-
     if (isSeed) {
       this.targetConfigNode = getIpAndPortString();
     } else {
@@ -91,32 +43,74 @@ public class ConfigNode extends ClusterNodeBase {
   }
 
   @Override
-  public void changeConfig(Properties properties) {
-    try {
-      Properties configProperties = new Properties();
-      configProperties.load(Files.newInputStream(Paths.get(this.configPath)));
-      configProperties.setProperty("rpc_address", super.getIp());
-      configProperties.setProperty("rpc_port", 
String.valueOf(super.getPort()));
-      configProperties.setProperty("consensus_port", 
String.valueOf(this.consensusPort));
-      configProperties.setProperty("target_confignode", this.targetConfigNode);
-      configProperties.setProperty(
-          "config_node_consensus_protocol_class",
-          "org.apache.iotdb.consensus.standalone.StandAloneConsensus");
-      configProperties.setProperty(
-          "schema_region_consensus_protocol_class",
-          "org.apache.iotdb.consensus.standalone.StandAloneConsensus");
-      configProperties.setProperty(
-          "data_region_consensus_protocol_class",
-          "org.apache.iotdb.consensus.standalone.StandAloneConsensus");
-      configProperties.setProperty("schema_replication_factor", "1");
-      configProperties.setProperty("data_replication_factor", "1");
-      configProperties.setProperty("connection_timeout_ms", "30000");
-      if (properties != null && !properties.isEmpty()) {
-        configProperties.putAll(properties);
-      }
-      configProperties.store(new FileWriter(this.configPath), null);
-    } catch (IOException ex) {
-      fail("Change the config of config node failed. " + ex);
+  protected void updateConfig(Properties properties) {
+    properties.setProperty("rpc_address", super.getIp());
+    properties.setProperty("rpc_port", String.valueOf(getPort()));
+    properties.setProperty("consensus_port", 
String.valueOf(this.consensusPort));
+    properties.setProperty("target_confignode", this.targetConfigNode);
+    properties.setProperty(
+        "config_node_consensus_protocol_class",
+        "org.apache.iotdb.consensus.standalone.StandAloneConsensus");
+    properties.setProperty(
+        "schema_region_consensus_protocol_class",
+        "org.apache.iotdb.consensus.standalone.StandAloneConsensus");
+    properties.setProperty(
+        "data_region_consensus_protocol_class",
+        "org.apache.iotdb.consensus.standalone.StandAloneConsensus");
+    properties.setProperty("schema_replication_factor", "1");
+    properties.setProperty("data_replication_factor", "1");
+    properties.setProperty("connection_timeout_ms", "30000");
+  }
+
+  @Override
+  protected String getConfigPath() {
+    return workDirFilePath("confignode" + File.separator + "conf", 
"iotdb-confignode.properties");
+  }
+
+  @Override
+  protected String getStartScriptPath() {
+    String scriptName = "start-confignode.sh";
+    if (SystemUtils.IS_OS_WINDOWS) {
+      scriptName = "start-confignode.bat";
+    }
+    return workDirFilePath("confignode" + File.separator + "sbin", scriptName);
+  }
+
+  @Override
+  protected String getStopScriptPath() {
+    String scriptName = "stop-confignode.sh";
+    if (SystemUtils.IS_OS_WINDOWS) {
+      scriptName = "stop-confignode.bat";
     }
+    return workDirFilePath("confignode" + File.separator + "sbin", scriptName);
+  }
+
+  @Override
+  protected String getLogPath() {
+    return System.getProperty("user.dir")
+        + File.separator
+        + "target"
+        + File.separator
+        + "cluster-logs"
+        + File.separator
+        + testName
+        + File.separator
+        + "Config"
+        + super.getId()
+        + ".log";
+  }
+
+  @Override
+  protected String getNodePath() {
+    return System.getProperty("user.dir")
+        + File.separator
+        + "target"
+        + File.separator
+        + super.getId();
+  }
+
+  @Override
+  public int getPort() {
+    return portList[0];
   }
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/DataNode.java 
b/integration-test/src/main/java/org/apache/iotdb/it/env/DataNode.java
index b49c0ec540..0bd1c2ffb0 100644
--- a/integration-test/src/main/java/org/apache/iotdb/it/env/DataNode.java
+++ b/integration-test/src/main/java/org/apache/iotdb/it/env/DataNode.java
@@ -18,104 +18,86 @@
  */
 package org.apache.iotdb.it.env;
 
+import org.apache.commons.lang3.SystemUtils;
+
 import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
 import java.util.Properties;
 
-import static org.junit.Assert.fail;
-
 public class DataNode extends ClusterNodeBase {
 
   private final String targetConfigNode;
-  private final String configPath;
 
   private final int dataBlockManagerPort;
   private final int internalPort;
   private final int dataRegionConsensusPort;
   private final int schemaRegionConsensusPort;
+  private final int[] portList;
 
   public DataNode(String targetConfigNode, String testName) {
-
+    super(testName);
     this.targetConfigNode = targetConfigNode;
-
-    int[] portList = super.searchAvailablePorts();
-    super.setPort(portList[0]);
+    portList = super.searchAvailablePorts();
     this.dataBlockManagerPort = portList[1];
     this.internalPort = portList[2];
     this.dataRegionConsensusPort = portList[3];
     this.schemaRegionConsensusPort = portList[4];
+  }
 
-    super.setId("node" + this.getPort());
+  @Override
+  protected void updateConfig(Properties properties) {
+    properties.setProperty("rpc_address", super.getIp());
+    properties.setProperty("internal_ip", "127.0.0.1");
+    properties.setProperty("rpc_port", String.valueOf(getPort()));
+    properties.setProperty("data_block_manager_port", 
String.valueOf(this.dataBlockManagerPort));
+    properties.setProperty("internal_port", String.valueOf(this.internalPort));
+    properties.setProperty(
+        "data_region_consensus_port", 
String.valueOf(this.dataRegionConsensusPort));
+    properties.setProperty(
+        "schema_region_consensus_port", 
String.valueOf(this.schemaRegionConsensusPort));
+    properties.setProperty("connection_timeout_ms", "30000");
+    properties.setProperty("config_nodes", this.targetConfigNode);
+  }
 
-    String nodePath =
-        System.getProperty("user.dir") + File.separator + "target" + 
File.separator + super.getId();
-    super.setNodePath(nodePath);
+  @Override
+  protected String getConfigPath() {
+    return workDirFilePath("datanode" + File.separator + "conf", 
"iotdb-engine.properties");
+  }
 
-    String logPath =
-        System.getProperty("user.dir")
-            + File.separator
-            + "target"
-            + File.separator
-            + "cluster-logs"
-            + File.separator
-            + testName
-            + File.separator
-            + "Data"
-            + super.getId()
-            + ".log";
-    super.setLogPath(logPath);
+  @Override
+  protected String getStartScriptPath() {
+    String scriptName = "start-datanode.sh";
+    if (SystemUtils.IS_OS_WINDOWS) {
+      scriptName = "start-datanode.bat";
+    }
+    return workDirFilePath("datanode" + File.separator + "sbin", scriptName);
+  }
 
-    String scriptPath =
-        super.getNodePath()
-            + File.separator
-            + "template-node"
-            + File.separator
-            + "datanode"
-            + File.separator
-            + "sbin"
-            + File.separator
-            + "start-datanode"
-            + ".sh";
-    super.setScriptPath(scriptPath);
+  @Override
+  protected String getStopScriptPath() {
+    String scriptName = "stop-datanode.sh";
+    if (SystemUtils.IS_OS_WINDOWS) {
+      scriptName = "stop-datanode.bat";
+    }
+    return workDirFilePath("datanode" + File.separator + "sbin", scriptName);
+  }
 
-    this.configPath =
-        super.getNodePath()
-            + File.separator
-            + "template-node"
-            + File.separator
-            + "datanode"
-            + File.separator
-            + "conf"
-            + File.separator
-            + "iotdb-engine.properties";
+  @Override
+  protected String getLogPath() {
+    return System.getProperty("user.dir")
+        + File.separator
+        + "target"
+        + File.separator
+        + "cluster-logs"
+        + File.separator
+        + testName
+        + File.separator
+        + "Data"
+        + super.getId()
+        + ".log";
   }
 
   @Override
-  public void changeConfig(Properties properties) {
-    try {
-      Properties configProperties = new Properties();
-      configProperties.load(Files.newInputStream(Paths.get(this.configPath)));
-      configProperties.setProperty("rpc_address", super.getIp());
-      configProperties.setProperty("internal_ip", "127.0.0.1");
-      configProperties.setProperty("rpc_port", 
String.valueOf(super.getPort()));
-      configProperties.setProperty(
-          "data_block_manager_port", 
String.valueOf(this.dataBlockManagerPort));
-      configProperties.setProperty("internal_port", 
String.valueOf(this.internalPort));
-      configProperties.setProperty(
-          "data_region_consensus_port", 
String.valueOf(this.dataRegionConsensusPort));
-      configProperties.setProperty(
-          "schema_region_consensus_port", 
String.valueOf(this.schemaRegionConsensusPort));
-      configProperties.setProperty("connection_timeout_ms", "30000");
-      configProperties.setProperty("config_nodes", this.targetConfigNode);
-      if (properties != null && !properties.isEmpty()) {
-        configProperties.putAll(properties);
-      }
-      configProperties.store(new FileWriter(this.configPath), null);
-    } catch (IOException ex) {
-      fail("Change the config of data node failed. " + ex);
-    }
+  public int getPort() {
+    return portList[0];
   }
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ClusterTestStatement.java
 
b/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ClusterTestStatement.java
index 5731303cc8..3f8a84cc16 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ClusterTestStatement.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ClusterTestStatement.java
@@ -31,6 +31,7 @@ public class ClusterTestStatement implements Statement {
 
   private static final int DEFAULT_QUERY_TIMEOUT = 10;
   private final Statement writeStatement;
+  private final String writEndpoint;
   private final List<Statement> readStatements = new ArrayList<>();
   private final List<String> readEndpoints = new ArrayList<>();
   private boolean closed = false;
@@ -41,6 +42,7 @@ public class ClusterTestStatement implements Statement {
       throws SQLException {
     this.writeStatement = 
writeConnection.getUnderlyingConnecton().createStatement();
     updateConfig(writeStatement);
+    writEndpoint = writeConnection.toString();
     for (NodeConnection readConnection : readConnections) {
       Statement readStatement = 
readConnection.getUnderlyingConnecton().createStatement();
       this.readStatements.add(readStatement);
@@ -51,6 +53,7 @@ public class ClusterTestStatement implements Statement {
 
   private void updateConfig(Statement statement) throws SQLException {
     maxRows = Math.min(statement.getMaxRows(), maxRows);
+    statement.setQueryTimeout(queryTimeout);
   }
 
   @Override
@@ -65,17 +68,32 @@ public class ClusterTestStatement implements Statement {
 
   @Override
   public void close() throws SQLException {
-    if (writeStatement != null) {
-      writeStatement.close();
-    }
-    readStatements.forEach(
-        r -> {
-          try {
-            r.close();
-          } catch (SQLException e) {
-            throw new RuntimeException(e);
+    List<String> endpoints = new ArrayList<>();
+    endpoints.add(writEndpoint);
+    endpoints.addAll(readEndpoints);
+    RequestDelegate<Void> delegate = new ParallelRequestDelegate<>(endpoints, 
queryTimeout);
+    delegate.addRequest(
+        () -> {
+          if (writeStatement != null) {
+            writeStatement.close();
           }
+          return null;
         });
+
+    readStatements.forEach(
+        r ->
+            delegate.addRequest(
+                () -> {
+                  if (r != null) {
+                    try {
+                      r.close();
+                    } catch (SQLException e) {
+                      throw new RuntimeException(e);
+                    }
+                  }
+                  return null;
+                }));
+    delegate.requestAll();
     closed = true;
   }
 
@@ -116,12 +134,16 @@ public class ClusterTestStatement implements Statement {
   }
 
   @Override
-  public void setQueryTimeout(int seconds) {
+  public void setQueryTimeout(int seconds) throws SQLException {
     if (seconds > 0) {
       queryTimeout = seconds;
     } else {
       queryTimeout = DEFAULT_QUERY_TIMEOUT;
     }
+    writeStatement.setQueryTimeout(queryTimeout);
+    for (Statement readStatement : readStatements) {
+      readStatement.setQueryTimeout(queryTimeout);
+    }
   }
 
   @Override
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ParallelRequestDelegate.java
 
b/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ParallelRequestDelegate.java
index 32d9803032..fbec912adb 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ParallelRequestDelegate.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/itbase/runtime/ParallelRequestDelegate.java
@@ -48,7 +48,7 @@ public class ParallelRequestDelegate<T> extends 
RequestDelegate<T> {
       try {
         results.add(resultFutures.get(i).get(taskTimeoutSeconds, 
TimeUnit.SECONDS));
       } catch (Exception e) {
-        for (int j = i + 1; j < getEndpoints().size(); j++) {
+        for (int j = i; j < getEndpoints().size(); j++) {
           resultFutures.get(j).cancel(true);
         }
         throw new SQLException(
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithoutValueFilterWithDeletion2IT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithoutValueFilterWithDeletion2IT.java
index fbf7cb5bd3..f7c1f24bc0 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithoutValueFilterWithDeletion2IT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithoutValueFilterWithDeletion2IT.java
@@ -20,12 +20,14 @@ package org.apache.iotdb.db.it.aligned;
 
 import org.apache.iotdb.it.env.ConfigFactory;
 import org.apache.iotdb.it.env.EnvFactory;
+import org.apache.iotdb.it.env.IoTDBTestRunner;
 import org.apache.iotdb.itbase.category.ClusterIT;
 import org.apache.iotdb.itbase.category.LocalStandaloneIT;
 
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
 
 import java.sql.Connection;
 import java.sql.Statement;
@@ -33,6 +35,7 @@ import java.sql.Statement;
 import static org.junit.Assert.fail;
 
 /** Let One chunk has more than one page. */
+@RunWith(IoTDBTestRunner.class)
 @Category({LocalStandaloneIT.class, ClusterIT.class})
 public class IoTDBAggregationWithoutValueFilterWithDeletion2IT
     extends IoTDBAggregationWithoutValueFilterWithDeletionIT {
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithoutValueFilterWithDeletionIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithoutValueFilterWithDeletionIT.java
index b5cf296d07..2f3a09994d 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithoutValueFilterWithDeletionIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithoutValueFilterWithDeletionIT.java
@@ -20,6 +20,7 @@ package org.apache.iotdb.db.it.aligned;
 
 import org.apache.iotdb.it.env.ConfigFactory;
 import org.apache.iotdb.it.env.EnvFactory;
+import org.apache.iotdb.it.env.IoTDBTestRunner;
 import org.apache.iotdb.itbase.category.ClusterIT;
 import org.apache.iotdb.itbase.category.LocalStandaloneIT;
 
@@ -27,6 +28,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
 
 import java.sql.Connection;
 import java.sql.ResultSet;
@@ -40,6 +42,7 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+@RunWith(IoTDBTestRunner.class)
 @Category({LocalStandaloneIT.class, ClusterIT.class})
 public class IoTDBAggregationWithoutValueFilterWithDeletionIT {
 
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java
index eed762de4a..fa18a810e8 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java
@@ -20,16 +20,19 @@ package org.apache.iotdb.db.it.aligned;
 
 import org.apache.iotdb.it.env.ConfigFactory;
 import org.apache.iotdb.it.env.EnvFactory;
+import org.apache.iotdb.it.env.IoTDBTestRunner;
 import org.apache.iotdb.itbase.category.ClusterIT;
 import org.apache.iotdb.itbase.category.LocalStandaloneIT;
 
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
 
 import java.sql.Connection;
 import java.sql.Statement;
 
+@RunWith(IoTDBTestRunner.class)
 @Category({LocalStandaloneIT.class, ClusterIT.class})
 public class IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT
     extends IoTDBGroupByQueryWithoutValueFilterWithDeletionIT {
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java
index 8083718e78..f894d07810 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java
@@ -20,6 +20,7 @@ package org.apache.iotdb.db.it.aligned;
 
 import org.apache.iotdb.it.env.ConfigFactory;
 import org.apache.iotdb.it.env.EnvFactory;
+import org.apache.iotdb.it.env.IoTDBTestRunner;
 import org.apache.iotdb.itbase.category.ClusterIT;
 import org.apache.iotdb.itbase.category.LocalStandaloneIT;
 
@@ -28,6 +29,7 @@ import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
 
 import java.sql.Connection;
 import java.sql.ResultSet;
@@ -42,6 +44,7 @@ import static 
org.apache.iotdb.db.constant.TestConstant.maxValue;
 import static org.apache.iotdb.db.constant.TestConstant.minTime;
 import static org.apache.iotdb.db.constant.TestConstant.minValue;
 
+@RunWith(IoTDBTestRunner.class)
 @Category({LocalStandaloneIT.class, ClusterIT.class})
 public class IoTDBGroupByQueryWithoutValueFilterWithDeletionIT {
 
diff --git a/server/src/assembly/resources/conf/iotdb-env.bat 
b/server/src/assembly/resources/conf/iotdb-env.bat
index df6b0d6a95..f748090f1b 100644
--- a/server/src/assembly/resources/conf/iotdb-env.bat
+++ b/server/src/assembly/resources/conf/iotdb-env.bat
@@ -53,9 +53,9 @@ for /f  %%b in ('wmic ComputerSystem get TotalPhysicalMemory 
^| findstr "[0-9]"'
        set system_memory=%%b
 )
 
-echo wsh.echo FormatNumber(cdbl(%system_memory%)/(1024*1024), 0) > 
%temp%\tmp.vbs
-for /f "tokens=*" %%a in ('cscript //nologo %temp%\tmp.vbs') do set 
system_memory_in_mb=%%a
-del %temp%\tmp.vbs
+echo wsh.echo FormatNumber(cdbl(%system_memory%)/(1024*1024), 0) > 
%IOTDB_HOME%\sbin\tmp.vbs
+for /f "tokens=*" %%a in ('cscript //nologo %IOTDB_HOME%\sbin\tmp.vbs') do set 
system_memory_in_mb=%%a
+del %IOTDB_HOME%\sbin\tmp.vbs
 set system_memory_in_mb=%system_memory_in_mb:,=%
 
 set /a half_=%system_memory_in_mb%/2
@@ -111,7 +111,7 @@ set temp_buffer_pool_size=1024
 @REM which equals DIRECT_MEMORY_SIZE / threads_number / temp_buffer_pool_size
 set 
MAX_CACHED_BUFFER_SIZE=%max_heap_size_in_mb%*1024*1024/%threads_number%/%temp_buffer_pool_size%
 
-set IOTDB_HEAP_OPTS=-Xmx%MAX_HEAP_SIZE% -Xms%HEAP_NEWSIZE% -Xlog:gc:"..\gc.log"
+set IOTDB_HEAP_OPTS=-Xmx%MAX_HEAP_SIZE% -Xms%HEAP_NEWSIZE% 
-Xlog:gc:"%IOTDB_HOME%\gc.log"
 set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% 
-XX:MaxDirectMemorySize=%MAX_DIRECT_MEMORY_SIZE%
 set IOTDB_HEAP_OPTS=%IOTDB_HEAP_OPTS% 
-Djdk.nio.maxCachedBufferSize=%MAX_CACHED_BUFFER_SIZE%
 
diff --git a/server/src/assembly/resources/conf/logback.xml 
b/server/src/assembly/resources/conf/logback.xml
index 9dc477e186..286e99cc38 100644
--- a/server/src/assembly/resources/conf/logback.xml
+++ b/server/src/assembly/resources/conf/logback.xml
@@ -125,7 +125,7 @@
             <charset>utf-8</charset>
         </encoder>
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-            <level>DEBUG</level>
+            <level>${CONSOLE_LOG_LEVEL:-DEBUG}</level>
         </filter>
     </appender>
     <!-- a log appender that collect all log records whose level is greater 
than debug-->
@@ -265,16 +265,6 @@
             <level>INFO</level>
         </filter>
     </appender>
-    <appender class="ch.qos.logback.core.FileAppender" name="ITForCluster">
-        <file>${IT_LOG_PATH:-/dev/null}</file>
-        <encoder>
-            <pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
-            <charset>utf-8</charset>
-        </encoder>
-        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-            <level>${IT_LOG_LEVEL:-OFF}</level>
-        </filter>
-    </appender>
     <root level="info">
         <appender-ref ref="FILETRACE"/>
         <appender-ref ref="FILEDEBUG"/>
@@ -283,7 +273,6 @@
         <appender-ref ref="FILEINFO"/>
         <appender-ref ref="FILEALL"/>
         <appender-ref ref="stdout"/>
-        <appender-ref ref="ITForCluster"/>
     </root>
     <logger level="OFF" name="io.moquette.broker.metrics.MQTTMessageLogger"/>
     <logger level="info" name="org.apache.iotdb.db.service"/>

Reply via email to