You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ca...@apache.org on 2022/12/27 09:52:01 UTC

[iotdb] 01/01: change STARTUP_RETRY_INTERVAL_IN_MS from 30s to 3s

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

caogaofei pushed a commit to branch beyyes/v1
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit e41b92618eceeeb1bf9eda38ef478795461a3474
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Tue Dec 27 17:51:42 2022 +0800

    change STARTUP_RETRY_INTERVAL_IN_MS from 30s to 3s
---
 .../org/apache/iotdb/confignode/conf/SystemPropertiesUtils.java  | 9 ++++++---
 .../java/org/apache/iotdb/confignode/service/ConfigNode.java     | 2 +-
 .../src/main/java/org/apache/iotdb/db/conf/IoTDBStartCheck.java  | 3 ++-
 server/src/main/java/org/apache/iotdb/db/service/DataNode.java   | 4 +++-
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/conf/SystemPropertiesUtils.java b/confignode/src/main/java/org/apache/iotdb/confignode/conf/SystemPropertiesUtils.java
index c7decd16e6..c1030533ef 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/conf/SystemPropertiesUtils.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/conf/SystemPropertiesUtils.java
@@ -35,6 +35,9 @@ import java.util.List;
 import java.util.Objects;
 import java.util.Properties;
 
+import static org.apache.iotdb.db.conf.IoTDBStartCheck.CLUSTER_NAME;
+import static org.apache.iotdb.db.conf.IoTDBStartCheck.DEFAULT_CLUSTER_NAME;
+
 public class SystemPropertiesUtils {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(SystemPropertiesUtils.class);
@@ -258,12 +261,12 @@ public class SystemPropertiesUtils {
    */
   public static String loadClusterNameWhenRestarted() throws IOException {
     Properties systemProperties = getSystemProperties();
-    String clusterName = systemProperties.getProperty("cluster_name", null);
+    String clusterName = systemProperties.getProperty(CLUSTER_NAME, null);
     if (clusterName == null) {
       LOGGER.warn(
           "Lack cluster_name field in data/confignode/system/confignode-system.properties, set it as defaultCluster");
-      systemProperties.setProperty("cluster_name", "defaultCluster");
-      return systemProperties.getProperty("cluster_name", null);
+      systemProperties.setProperty(CLUSTER_NAME, DEFAULT_CLUSTER_NAME);
+      return systemProperties.getProperty(CLUSTER_NAME, null);
     }
     return clusterName;
   }
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java b/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
index d923c1290f..156ae2fb5c 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
@@ -62,7 +62,7 @@ public class ConfigNode implements ConfigNodeMBean {
 
   private static final int STARTUP_RETRY_NUM = 10;
   private static final int SCHEDULE_WAITING_RETRY_NUM = 20;
-  private static final long STARTUP_RETRY_INTERVAL_IN_MS = TimeUnit.SECONDS.toMillis(30);
+  private static final long STARTUP_RETRY_INTERVAL_IN_MS = TimeUnit.SECONDS.toMillis(3);
 
   private static final int SEED_CONFIG_NODE_ID = 0;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBStartCheck.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBStartCheck.java
index 995aea3d0d..3715f4fa81 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBStartCheck.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBStartCheck.java
@@ -114,7 +114,8 @@ public class IoTDBStartCheck {
   private static final String timeEncoderValue =
       String.valueOf(TSFileDescriptor.getInstance().getConfig().getTimeEncoder());
 
-  private static final String CLUSTER_NAME = "CLUSTER_NAME";
+  public static final String CLUSTER_NAME = "cluster_name";
+  public static final String DEFAULT_CLUSTER_NAME = "defaultCluster";
   private static final String DATA_NODE_ID = "data_node_id";
 
   private static final String SCHEMA_REGION_CONSENSUS_PROTOCOL = "schema_region_consensus_protocol";
diff --git a/server/src/main/java/org/apache/iotdb/db/service/DataNode.java b/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
index a9cf7ba340..dfba686552 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
@@ -95,6 +95,8 @@ import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
+import static org.apache.iotdb.db.conf.IoTDBStartCheck.DEFAULT_CLUSTER_NAME;
+
 public class DataNode implements DataNodeMBean {
   private static final Logger logger = LoggerFactory.getLogger(DataNode.class);
   private static final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
@@ -394,7 +396,7 @@ public class DataNode implements DataNodeMBean {
     int retry = DEFAULT_RETRY;
     TDataNodeRestartReq req = new TDataNodeRestartReq();
     req.setClusterName(
-        config.getClusterName() == null ? "defaultCluster" : config.getClusterName());
+        config.getClusterName() == null ? DEFAULT_CLUSTER_NAME : config.getClusterName());
     req.setDataNodeConfiguration(generateDataNodeConfiguration());
     TDataNodeRestartResp dataNodeRestartResp = null;
     while (retry > 0) {