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/11/14 06:59:45 UTC

[iotdb] 02/02: fix the problem that internal_address is not consistent with target_confignode when first starts

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

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

commit b81dc9633c8903378f62f8c3020e75d05abbd5df
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Mon Nov 14 14:59:23 2022 +0800

    fix the problem that internal_address is not consistent with target_confignode when first starts
---
 .../java/org/apache/iotdb/confignode/manager/node/NodeManager.java   | 2 +-
 .../main/java/org/apache/iotdb/confignode/service/ConfigNode.java    | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/NodeManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/NodeManager.java
index 90b24f4dda..4ab6d57051 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/NodeManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/NodeManager.java
@@ -357,7 +357,7 @@ public class NodeManager {
 
   public TConfigNodeRegisterResp registerConfigNode(TConfigNodeRegisterReq req) {
     if (configManager.getConsensusManager() == null) {
-      TSStatus errorStatus = new TSStatus(TSStatusCode.ERROR_GLOBAL_CONFIG.getStatusCode());
+      TSStatus errorStatus = new TSStatus(TSStatusCode.CONSENSUS_NOT_INITIALIZED.getStatusCode());
       errorStatus.setMessage(
           "ConsensusManager of target-ConfigNode is not initialized, "
               + "please make sure the target-ConfigNode has been started successfully.");
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 06c72f812e..363c092d77 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
@@ -266,6 +266,11 @@ public class ConfigNode implements ConfigNodeMBean {
       } else if (status.getCode() == TSStatusCode.ERROR_GLOBAL_CONFIG.getStatusCode()) {
         LOGGER.error(status.getMessage());
         throw new StartupException("Configuration are not consistent!");
+      } else if (status.getCode() == TSStatusCode.CONSENSUS_NOT_INITIALIZED.getStatusCode()) {
+        LOGGER.error(status.getMessage());
+        throw new StartupException(
+            "The target ConfigNode is not started successfully, "
+                + "please check the cn_target_config_node_list config!");
       }
 
       try {