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

ericpai pushed a commit to branch improve/iotdb-5387
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit d58487c04df1d189a52227f3b5043a674e87afed
Author: ericpai <[email protected]>
AuthorDate: Mon Jan 9 14:51:48 2023 +0800

    [IOTDB-5387] Refine IT: Make JVM parameters mutable easily
---
 .../apache/iotdb/it/env/cluster/AbstractEnv.java   |  15 ++-
 .../iotdb/it/env/cluster/AbstractNodeWrapper.java  |  36 ++++---
 .../iotdb/it/env/cluster/ConfigNodeWrapper.java    |  19 +++-
 .../iotdb/it/env/cluster/DataNodeWrapper.java      |   9 ++
 .../org/apache/iotdb/it/env/cluster/EnvUtils.java  |  25 +++--
 .../iotdb/it/env/cluster/MppClusterConfig.java     |  15 +++
 .../apache/iotdb/it/env/cluster/MppJVMConfig.java  | 116 +++++++++++++++++++++
 .../iotdb/it/env/remote/RemoteClusterConfig.java   |  12 +++
 ...moteClusterConfig.java => RemoteJVMConfig.java} |  34 ++----
 .../org/apache/iotdb/itbase/env/ClusterConfig.java |  30 ++++--
 .../org/apache/iotdb/itbase/env/JVMConfig.java     |  29 ++++++
 .../it/cluster/IoTDBClusterNodeErrorStartUpIT.java |   6 +-
 .../it/cluster/IoTDBClusterRestartIT.java          |   3 +-
 13 files changed, 276 insertions(+), 73 deletions(-)

diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/AbstractEnv.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/AbstractEnv.java
index d01538b172..3f1c32d58c 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/AbstractEnv.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/AbstractEnv.java
@@ -109,7 +109,8 @@ public abstract class AbstractEnv implements BaseEnv {
     seedConfigNodeWrapper.createDir();
     seedConfigNodeWrapper.changeConfig(
         (MppConfigNodeConfig) clusterConfig.getConfigNodeConfig(),
-        (MppCommonConfig) clusterConfig.getConfigNodeCommonConfig());
+        (MppCommonConfig) clusterConfig.getConfigNodeCommonConfig(),
+        (MppJVMConfig) clusterConfig.getConfigNodeJVMConfig());
     seedConfigNodeWrapper.start();
     String targetConfigNode = seedConfigNodeWrapper.getIpAndPortString();
     this.configNodeWrapperList.add(seedConfigNodeWrapper);
@@ -138,7 +139,8 @@ public abstract class AbstractEnv implements BaseEnv {
       configNodeWrapper.createDir();
       configNodeWrapper.changeConfig(
           (MppConfigNodeConfig) clusterConfig.getConfigNodeConfig(),
-          (MppCommonConfig) clusterConfig.getConfigNodeCommonConfig());
+          (MppCommonConfig) clusterConfig.getConfigNodeCommonConfig(),
+          (MppJVMConfig) clusterConfig.getConfigNodeJVMConfig());
       configNodesDelegate.addRequest(
           () -> {
             configNodeWrapper.start();
@@ -164,7 +166,8 @@ public abstract class AbstractEnv implements BaseEnv {
       dataNodeWrapper.createDir();
       dataNodeWrapper.changeConfig(
           (MppDataNodeConfig) clusterConfig.getDataNodeConfig(),
-          (MppCommonConfig) clusterConfig.getDataNodeCommonConfig());
+          (MppCommonConfig) clusterConfig.getDataNodeCommonConfig(),
+          (MppJVMConfig) clusterConfig.getDataNodeJVMConfig());
       dataNodesDelegate.addRequest(
           () -> {
             dataNodeWrapper.start();
@@ -565,7 +568,8 @@ public abstract class AbstractEnv implements BaseEnv {
     newConfigNodeWrapper.createDir();
     newConfigNodeWrapper.changeConfig(
         (MppConfigNodeConfig) clusterConfig.getConfigNodeConfig(),
-        (MppCommonConfig) clusterConfig.getConfigNodeCommonConfig());
+        (MppCommonConfig) clusterConfig.getConfigNodeCommonConfig(),
+        (MppJVMConfig) clusterConfig.getConfigNodeJVMConfig());
     return newConfigNodeWrapper;
   }
 
@@ -581,7 +585,8 @@ public abstract class AbstractEnv implements BaseEnv {
     newDataNodeWrapper.createDir();
     newDataNodeWrapper.changeConfig(
         (MppDataNodeConfig) clusterConfig.getDataNodeConfig(),
-        (MppCommonConfig) clusterConfig.getDataNodeCommonConfig());
+        (MppCommonConfig) clusterConfig.getDataNodeCommonConfig(),
+        (MppJVMConfig) clusterConfig.getDataNodeJVMConfig());
     return newDataNodeWrapper;
   }
 
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/AbstractNodeWrapper.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/AbstractNodeWrapper.java
index d11dc21fbf..6d3ed5ac7c 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/AbstractNodeWrapper.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/AbstractNodeWrapper.java
@@ -27,6 +27,7 @@ import org.apache.commons.io.file.PathUtils;
 import org.apache.commons.lang3.SystemUtils;
 import org.slf4j.Logger;
 
+import javax.annotation.Nullable;
 import javax.management.MBeanServerConnection;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
@@ -93,10 +94,11 @@ public abstract class AbstractNodeWrapper implements 
BaseNodeWrapper {
   protected final String testMethodName;
   protected final int[] portList;
   protected final int jmxPort;
+  protected final MppJVMConfig jvmConfig;
   private final String TAB = "  ";
   private Process instance;
-  private String node_address;
-  private int node_port;
+  private final String nodeAddress;
+  private int nodePort;
 
   /**
    * Mutable properties are always hardcoded default values to make the 
cluster be set up
@@ -118,8 +120,8 @@ public abstract class AbstractNodeWrapper implements 
BaseNodeWrapper {
     this.testClassName = testClassName;
     this.testMethodName = testMethodName;
     this.portList = portList;
-    this.node_address = "127.0.0.1";
-    this.node_port = portList[0];
+    this.nodeAddress = "127.0.0.1";
+    this.nodePort = portList[0];
     jmxPort = this.portList[portList.length - 1];
     // these properties can't be mutated.
     immutableCommonProperties.setProperty("udf_lib_dir", 
MppBaseConfig.NULL_VALUE);
@@ -128,6 +130,7 @@ public abstract class AbstractNodeWrapper implements 
BaseNodeWrapper {
     immutableCommonProperties.setProperty("mqtt_port", 
MppBaseConfig.NULL_VALUE);
     immutableCommonProperties.setProperty("rest_service_port", 
MppBaseConfig.NULL_VALUE);
     immutableCommonProperties.setProperty("influxdb_rpc_port", 
MppBaseConfig.NULL_VALUE);
+    this.jvmConfig = initVMConfig();
   }
 
   @Override
@@ -141,11 +144,11 @@ public abstract class AbstractNodeWrapper implements 
BaseNodeWrapper {
         // ignored
       }
       // Here we need to copy without follow symbolic links, so we can't use 
FileUtils directly.
-      try (Stream<Path> s = Files.walk(Paths.get(this.templateNodePath))) {
+      try (Stream<Path> s = Files.walk(Paths.get(templateNodePath))) {
         s.forEach(
             source -> {
               Path destination =
-                  Paths.get(destPath, 
source.toString().substring(this.templateNodePath.length()));
+                  Paths.get(destPath, 
source.toString().substring(templateNodePath.length()));
               try {
                 Files.copy(
                     source,
@@ -201,8 +204,11 @@ public abstract class AbstractNodeWrapper implements 
BaseNodeWrapper {
    *
    * @param nodeConfig the values mutated through {@link EnvFactory}
    * @param commonConfig the values mutated through {@link EnvFactory}.
+   * @param jvmConfig the JVM configurations need to be changed. If it's null, 
then nothing will be
+   *     happened.
    */
-  public final void changeConfig(MppBaseConfig nodeConfig, MppCommonConfig 
commonConfig) {
+  public final void changeConfig(
+      MppBaseConfig nodeConfig, MppCommonConfig commonConfig, @Nullable 
MppJVMConfig jvmConfig) {
     try {
       // 1. Read directly from assembled property files
       // In a config-node, the files should be iotdb-confignode.properties and
@@ -233,6 +239,7 @@ public abstract class AbstractNodeWrapper implements 
BaseNodeWrapper {
     } catch (IOException ex) {
       fail("Change the config of node failed. " + ex);
     }
+    this.jvmConfig.override(jvmConfig);
   }
 
   @Override
@@ -257,9 +264,9 @@ public abstract class AbstractNodeWrapper implements 
BaseNodeWrapper {
               "-Dcom.sun.management.jmxremote.ssl=false",
               "-Dcom.sun.management.jmxremote.authenticate=false",
               "-Djava.rmi.server.hostname=" + getIp(),
-              "-Xms200m",
-              "-Xmx200m",
-              "-XX:MaxDirectMemorySize=200m",
+              "-Xms" + jvmConfig.getInitHeapSize() + "m",
+              "-Xmx" + jvmConfig.getMaxHeapSize() + "m",
+              "-XX:MaxDirectMemorySize=" + jvmConfig.getMaxDirectMemorySize() 
+ "m",
               "-Djdk.nio.maxCachedBufferSize=262144",
               "-cp",
               templateNodeLibPath));
@@ -302,16 +309,16 @@ public abstract class AbstractNodeWrapper implements 
BaseNodeWrapper {
 
   @Override
   public final String getIp() {
-    return this.node_address;
+    return this.nodeAddress;
   }
 
   @Override
   public final int getPort() {
-    return this.node_port;
+    return this.nodePort;
   }
 
   public void setPort(int port) {
-    this.node_port = port;
+    this.nodePort = port;
   }
 
   @Override
@@ -424,6 +431,7 @@ public abstract class AbstractNodeWrapper implements 
BaseNodeWrapper {
     return testClassName + "_" + testMethodName;
   }
 
+  /* Abstract methods, which must be implemented in ConfigNode and Datanode. */
   protected abstract void renameFile();
 
   protected abstract String getTargetNodeConfigPath();
@@ -439,4 +447,6 @@ public abstract class AbstractNodeWrapper implements 
BaseNodeWrapper {
   protected abstract void addStartCmdParams(List<String> params);
 
   public abstract String getSystemPropertiesPath();
+
+  protected abstract MppJVMConfig initVMConfig();
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ConfigNodeWrapper.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ConfigNodeWrapper.java
index 35daae84aa..3d8cd5ca43 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ConfigNodeWrapper.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ConfigNodeWrapper.java
@@ -27,7 +27,6 @@ import java.util.List;
 public class ConfigNodeWrapper extends AbstractNodeWrapper {
 
   private int consensusPort;
-  private final String targetConfigNodes;
   private final boolean isSeed;
   private final String defaultNodePropertiesFile =
       EnvUtils.getFilePathFromSysVar("DefaultConfigNodeProperties");
@@ -36,17 +35,18 @@ public class ConfigNodeWrapper extends AbstractNodeWrapper {
 
   public ConfigNodeWrapper(
       boolean isSeed,
-      String targetConfigNodes,
+      String targetCNs,
       String testClassName,
       String testMethodName,
       int[] portList) {
     super(testClassName, testMethodName, portList);
     this.consensusPort = portList[1];
     this.isSeed = isSeed;
+    String targetConfigNodes;
     if (isSeed) {
-      this.targetConfigNodes = getIpAndPortString();
+      targetConfigNodes = getIpAndPortString();
     } else {
-      this.targetConfigNodes = targetConfigNodes;
+      targetConfigNodes = targetCNs;
     }
 
     // initialize mutable properties
@@ -70,7 +70,7 @@ public class ConfigNodeWrapper extends AbstractNodeWrapper {
     immutableNodeProperties.setProperty(
         IoTDBConstant.CN_CONSENSUS_PORT, String.valueOf(this.consensusPort));
     immutableNodeProperties.setProperty(
-        IoTDBConstant.CN_TARGET_CONFIG_NODE_LIST, this.targetConfigNodes);
+        IoTDBConstant.CN_TARGET_CONFIG_NODE_LIST, targetConfigNodes);
     immutableNodeProperties.setProperty("cn_system_dir", 
MppBaseConfig.NULL_VALUE);
     immutableNodeProperties.setProperty("cn_consensus_dir", 
MppBaseConfig.NULL_VALUE);
     immutableNodeProperties.setProperty(
@@ -104,6 +104,15 @@ public class ConfigNodeWrapper extends AbstractNodeWrapper 
{
     return workDirFilePath("data/confignode/system", 
"confignode-system.properties");
   }
 
+  @Override
+  protected MppJVMConfig initVMConfig() {
+    return MppJVMConfig.builder()
+        .setInitHeapSize(EnvUtils.getIntFromSysVar("ConfigNodeInitHeapSize", 
256))
+        .setMaxHeapSize(EnvUtils.getIntFromSysVar("ConfigNodeMaxHeapSize", 
256))
+        
.setMaxDirectMemorySize(EnvUtils.getIntFromSysVar("ConfigNodeMaxDirectMemorySize",
 256))
+        .build();
+  }
+
   @Override
   public final String getId() {
     if (isSeed) {
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/DataNodeWrapper.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/DataNodeWrapper.java
index 635789d704..f3900fdf7b 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/DataNodeWrapper.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/DataNodeWrapper.java
@@ -118,6 +118,15 @@ public class DataNodeWrapper extends AbstractNodeWrapper {
     return workDirFilePath("data/datanode/system/schema", "system.properties");
   }
 
+  @Override
+  protected MppJVMConfig initVMConfig() {
+    return MppJVMConfig.builder()
+        .setInitHeapSize(EnvUtils.getIntFromSysVar("DataNodeInitHeapSize", 
256))
+        .setMaxHeapSize(EnvUtils.getIntFromSysVar("DataNodeMaxHeapSize", 256))
+        
.setMaxDirectMemorySize(EnvUtils.getIntFromSysVar("DataNodeMaxDirectMemorySize",
 256))
+        .build();
+  }
+
   @Override
   public final String getId() {
     return "DataNode" + getPort();
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/EnvUtils.java 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/EnvUtils.java
index 334da03dad..14a9cf44c8 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/EnvUtils.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/EnvUtils.java
@@ -100,19 +100,9 @@ public class EnvUtils {
   }
 
   public static Pair<Integer, Integer> getNodeNum() {
-    int configNodeNum = 0;
-    int dataNodeNum = 0;
-    try {
-      configNodeNum = 
Integer.parseInt(System.getProperty(sysVarDefaultConfigNodeNum, "1"));
-    } catch (NumberFormatException e) {
-      throw new RuntimeException("Invalid config node number: " + 
configNodeNum);
-    }
-    try {
-      dataNodeNum = 
Integer.parseInt(System.getProperty(sysVarDefaultDataNodeNum, "3"));
-    } catch (NumberFormatException e) {
-      throw new RuntimeException("Invalid data node number: " + dataNodeNum);
-    }
-    return new Pair<>(configNodeNum, dataNodeNum);
+    return new Pair<>(
+        getIntFromSysVar(sysVarDefaultConfigNodeNum, 1),
+        getIntFromSysVar(sysVarDefaultDataNodeNum, 3));
   }
 
   public static String getFilePathFromSysVar(String key) {
@@ -122,4 +112,13 @@ public class EnvUtils {
     }
     return System.getProperty("user.dir") + File.separator + value;
   }
+
+  public static int getIntFromSysVar(String key, int defaultValue) {
+    String value = System.getProperty(key, String.valueOf(defaultValue));
+    try {
+      return Integer.parseInt(value);
+    } catch (NumberFormatException e) {
+      throw new IllegalArgumentException("Invalid property value: " + value + 
" of key " + key);
+    }
+  }
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppClusterConfig.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppClusterConfig.java
index 9575e49a67..0fb9d5073b 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppClusterConfig.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppClusterConfig.java
@@ -22,6 +22,7 @@ import org.apache.iotdb.itbase.env.ClusterConfig;
 import org.apache.iotdb.itbase.env.CommonConfig;
 import org.apache.iotdb.itbase.env.ConfigNodeConfig;
 import org.apache.iotdb.itbase.env.DataNodeConfig;
+import org.apache.iotdb.itbase.env.JVMConfig;
 
 /** MppClusterConfig stores a whole cluster config items. */
 public class MppClusterConfig implements ClusterConfig {
@@ -31,6 +32,8 @@ public class MppClusterConfig implements ClusterConfig {
   private final MppCommonConfig configNodeCommonConfig;
   private final MppCommonConfig dataNodeCommonConfig;
   private final MppSharedCommonConfig sharedCommonConfig;
+  private final MppJVMConfig configNodeJVMConfig;
+  private final MppJVMConfig dataNodeJVMConfig;
 
   public MppClusterConfig() {
     this.configNodeConfig = new MppConfigNodeConfig();
@@ -39,6 +42,8 @@ public class MppClusterConfig implements ClusterConfig {
     this.dataNodeCommonConfig = new MppCommonConfig();
     this.sharedCommonConfig =
         new MppSharedCommonConfig(configNodeCommonConfig, 
dataNodeCommonConfig);
+    this.configNodeJVMConfig = new MppJVMConfig();
+    this.dataNodeJVMConfig = new MppJVMConfig();
   }
 
   @Override
@@ -65,4 +70,14 @@ public class MppClusterConfig implements ClusterConfig {
   public CommonConfig getCommonConfig() {
     return sharedCommonConfig;
   }
+
+  @Override
+  public JVMConfig getConfigNodeJVMConfig() {
+    return configNodeJVMConfig;
+  }
+
+  @Override
+  public JVMConfig getDataNodeJVMConfig() {
+    return dataNodeJVMConfig;
+  }
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppJVMConfig.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppJVMConfig.java
new file mode 100644
index 0000000000..2cb758fcd4
--- /dev/null
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppJVMConfig.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.it.env.cluster;
+
+import org.apache.iotdb.itbase.env.JVMConfig;
+
+import javax.annotation.Nullable;
+
+public class MppJVMConfig implements JVMConfig {
+
+  private int initHeapSize;
+  private int maxHeapSize;
+  private int maxDirectMemorySize;
+
+  @Override
+  public JVMConfig setInitHeapSize(int initSize) {
+    if (initSize > 0) {
+      this.initHeapSize = initSize;
+    }
+    return this;
+  }
+
+  @Override
+  public JVMConfig setMaxHeapSize(int maxSize) {
+    if (maxSize > 0) {
+      this.maxHeapSize = maxSize;
+    }
+    return this;
+  }
+
+  public JVMConfig setMaxDirectMemorySize(int maxSize) {
+    if (maxSize > 0) {
+      this.maxDirectMemorySize = maxSize;
+    }
+    return this;
+  }
+
+  public int getInitHeapSize() {
+    return initHeapSize;
+  }
+
+  public int getMaxHeapSize() {
+    return maxHeapSize;
+  }
+
+  public int getMaxDirectMemorySize() {
+    return maxDirectMemorySize;
+  }
+
+  private void validate() {
+    if (initHeapSize > maxHeapSize) {
+      throw new IllegalArgumentException(
+          "the initHeapSize "
+              + initHeapSize
+              + " must be not larger than the maxHeapSize "
+              + maxHeapSize);
+    }
+  }
+
+  public void override(@Nullable MppJVMConfig config) {
+    if (config == null) {
+      return;
+    }
+    this.setInitHeapSize(config.getInitHeapSize());
+    this.setMaxHeapSize(config.getMaxHeapSize());
+    this.setMaxDirectMemorySize(config.getMaxDirectMemorySize());
+  }
+
+  public static Builder builder() {
+    return new Builder();
+  }
+
+  public static class Builder {
+    private final MppJVMConfig config;
+
+    public Builder() {
+      this.config = new MppJVMConfig();
+    }
+
+    public Builder setInitHeapSize(int size) {
+      this.config.setInitHeapSize(size);
+      return this;
+    }
+
+    public Builder setMaxHeapSize(int size) {
+      this.config.setMaxHeapSize(size);
+      return this;
+    }
+
+    public Builder setMaxDirectMemorySize(int size) {
+      this.config.setMaxDirectMemorySize(size);
+      return this;
+    }
+
+    public MppJVMConfig build() {
+      config.validate();
+      return config;
+    }
+  }
+}
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteClusterConfig.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteClusterConfig.java
index 9b97c42505..e61c92bfdc 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteClusterConfig.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteClusterConfig.java
@@ -22,12 +22,14 @@ import org.apache.iotdb.itbase.env.ClusterConfig;
 import org.apache.iotdb.itbase.env.CommonConfig;
 import org.apache.iotdb.itbase.env.ConfigNodeConfig;
 import org.apache.iotdb.itbase.env.DataNodeConfig;
+import org.apache.iotdb.itbase.env.JVMConfig;
 
 public class RemoteClusterConfig implements ClusterConfig {
 
   private final CommonConfig commonConfig = new RemoteCommonConfig();
   private final ConfigNodeConfig configNodeConfig = new 
RemoteConfigNodeConfig();
   private final DataNodeConfig dataNodeConfig = new RemoteDataNodeConfig();
+  private final RemoteJVMConfig jvmConfig = new RemoteJVMConfig();
 
   @Override
   public DataNodeConfig getDataNodeConfig() {
@@ -53,4 +55,14 @@ public class RemoteClusterConfig implements ClusterConfig {
   public CommonConfig getCommonConfig() {
     return commonConfig;
   }
+
+  @Override
+  public JVMConfig getConfigNodeJVMConfig() {
+    return jvmConfig;
+  }
+
+  @Override
+  public JVMConfig getDataNodeJVMConfig() {
+    return jvmConfig;
+  }
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteClusterConfig.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteJVMConfig.java
similarity index 50%
copy from 
integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteClusterConfig.java
copy to 
integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteJVMConfig.java
index 9b97c42505..4eae8c4d88 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteClusterConfig.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteJVMConfig.java
@@ -18,39 +18,21 @@
  */
 package org.apache.iotdb.it.env.remote;
 
-import org.apache.iotdb.itbase.env.ClusterConfig;
-import org.apache.iotdb.itbase.env.CommonConfig;
-import org.apache.iotdb.itbase.env.ConfigNodeConfig;
-import org.apache.iotdb.itbase.env.DataNodeConfig;
-
-public class RemoteClusterConfig implements ClusterConfig {
-
-  private final CommonConfig commonConfig = new RemoteCommonConfig();
-  private final ConfigNodeConfig configNodeConfig = new 
RemoteConfigNodeConfig();
-  private final DataNodeConfig dataNodeConfig = new RemoteDataNodeConfig();
-
-  @Override
-  public DataNodeConfig getDataNodeConfig() {
-    return dataNodeConfig;
-  }
-
-  @Override
-  public CommonConfig getDataNodeCommonConfig() {
-    return commonConfig;
-  }
+import org.apache.iotdb.itbase.env.JVMConfig;
 
+public class RemoteJVMConfig implements JVMConfig {
   @Override
-  public ConfigNodeConfig getConfigNodeConfig() {
-    return configNodeConfig;
+  public JVMConfig setInitHeapSize(int initSize) {
+    return this;
   }
 
   @Override
-  public CommonConfig getConfigNodeCommonConfig() {
-    return commonConfig;
+  public JVMConfig setMaxHeapSize(int maxSize) {
+    return this;
   }
 
   @Override
-  public CommonConfig getCommonConfig() {
-    return commonConfig;
+  public JVMConfig setMaxDirectMemorySize(int maxSize) {
+    return this;
   }
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/itbase/env/ClusterConfig.java 
b/integration-test/src/main/java/org/apache/iotdb/itbase/env/ClusterConfig.java
index 9c82248e2e..f899e62b02 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/itbase/env/ClusterConfig.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/itbase/env/ClusterConfig.java
@@ -21,40 +21,54 @@ package org.apache.iotdb.itbase.env;
 public interface ClusterConfig {
 
   /**
-   * Get the iotdb-datanode.properties of DataNodes.
+   * Get the iotdb-datanode.properties setter of DataNodes.
    *
    * @return the {@link DataNodeConfig} instance.
    */
   DataNodeConfig getDataNodeConfig();
 
   /**
-   * Get the iotdb-common.properties of DataNodes. Updating the instance will 
affect ConfigNodes
-   * only.
+   * Get the iotdb-common.properties setter of DataNodes. Updating the 
instance will affect
+   * ConfigNodes only.
    *
    * @return the {@link CommonConfig} instance.
    */
   CommonConfig getDataNodeCommonConfig();
 
   /**
-   * Get the iotdb-confignode.properties of ConfigNodes.
+   * Get the iotdb-confignode.properties setter of ConfigNodes.
    *
    * @return the {@link ConfigNodeConfig} instance.
    */
   ConfigNodeConfig getConfigNodeConfig();
 
   /**
-   * Get the iotdb-common.properties of ConfigNodes. Updating the instance 
will affect ConfigNodes
-   * only.
+   * Get the iotdb-common.properties setter of ConfigNodes. Updating the 
instance will affect
+   * ConfigNodes only.
    *
    * @return the {@link CommonConfig} instance.
    */
   CommonConfig getConfigNodeCommonConfig();
 
   /**
-   * Get the iotdb-common.properties for both the ConfigNodes and DataNodes. 
Updating the instance
-   * will affect ConfigNodes as well as DataNodes.
+   * Get the iotdb-common.properties setter for both the ConfigNodes and 
DataNodes. Updating the
+   * instance will affect ConfigNodes as well as DataNodes.
    *
    * @return the {@link CommonConfig} instance.
    */
   CommonConfig getCommonConfig();
+
+  /**
+   * Get the JVM Configuration Setter of ConfigNodes.
+   *
+   * @return the {@link JVMConfig} instance.
+   */
+  JVMConfig getConfigNodeJVMConfig();
+
+  /**
+   * Get the JVM Configuration Setter of DataNodes.
+   *
+   * @return the {@link JVMConfig} instance.
+   */
+  JVMConfig getDataNodeJVMConfig();
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/itbase/env/JVMConfig.java 
b/integration-test/src/main/java/org/apache/iotdb/itbase/env/JVMConfig.java
new file mode 100644
index 0000000000..7dac0a4ef0
--- /dev/null
+++ b/integration-test/src/main/java/org/apache/iotdb/itbase/env/JVMConfig.java
@@ -0,0 +1,29 @@
+package org.apache.iotdb.itbase.env;
+
+/** this interface is used to store the JVM parameters of test nodes. */
+public interface JVMConfig {
+
+  /**
+   * Set the init heap size in MB.
+   *
+   * @param initSize the initial heap size in MB(passed by -Xms).
+   * @return the instance of the config itself.
+   */
+  JVMConfig setInitHeapSize(int initSize);
+
+  /**
+   * Set the max heap size in MB.
+   *
+   * @param maxSize the max heap size in MB(passed by -Xmx).
+   * @return the instance of the config itself.
+   */
+  JVMConfig setMaxHeapSize(int maxSize);
+
+  /**
+   * Set the max memory size allocated out of heap in MB.
+   *
+   * @param maxSize the max heap size in MB(passed by -XX:MaxDirectMemorySize).
+   * @return the instance of the config itself.
+   */
+  JVMConfig setMaxDirectMemorySize(int maxSize);
+}
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterNodeErrorStartUpIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterNodeErrorStartUpIT.java
index cc6f3e67d6..b42e0c1071 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterNodeErrorStartUpIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterNodeErrorStartUpIT.java
@@ -135,7 +135,8 @@ public class IoTDBClusterNodeErrorStartUpIT {
         EnvFactory.getEnv().getConfigNodeWrapper(1).getConsensusPort());
     conflictConfigNodeWrapper.changeConfig(
         (MppBaseConfig) EnvFactory.getEnv().getConfig().getConfigNodeConfig(),
-        (MppCommonConfig) 
EnvFactory.getEnv().getConfig().getConfigNodeCommonConfig());
+        (MppCommonConfig) 
EnvFactory.getEnv().getConfig().getConfigNodeCommonConfig(),
+        null);
 
     // The registration request should be rejected since there exists conflict 
port
     try (SyncConfigNodeIServiceClient client =
@@ -165,7 +166,8 @@ public class IoTDBClusterNodeErrorStartUpIT {
         EnvFactory.getEnv().getDataNodeWrapper(0).getInternalPort());
     conflictDataNodeWrapper.changeConfig(
         (MppBaseConfig) EnvFactory.getEnv().getConfig().getDataNodeConfig(),
-        (MppCommonConfig) 
EnvFactory.getEnv().getConfig().getDataNodeCommonConfig());
+        (MppCommonConfig) 
EnvFactory.getEnv().getConfig().getDataNodeCommonConfig(),
+        null);
 
     // The registration request should be rejected since there exists conflict 
port
     try (SyncConfigNodeIServiceClient client =
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterRestartIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterRestartIT.java
index 9aceec0341..5b11d19142 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterRestartIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterRestartIT.java
@@ -152,7 +152,8 @@ public class IoTDBClusterRestartIT {
           .get(i)
           .changeConfig(
               (MppBaseConfig) 
EnvFactory.getEnv().getConfig().getDataNodeConfig(),
-              (MppCommonConfig) 
EnvFactory.getEnv().getConfig().getDataNodeCommonConfig());
+              (MppCommonConfig) 
EnvFactory.getEnv().getConfig().getDataNodeCommonConfig(),
+              null);
       EnvFactory.getEnv().startDataNode(i);
     }
 

Reply via email to