You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2022/11/14 10:32:14 UTC
[iotdb] branch master updated: [IOTDB-4849] Fix the problem that internal_address is not consistent with target_confignode when first starts Seed-ConfigNode. (#7975)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin 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 2c9c03aa66 [IOTDB-4849] Fix the problem that internal_address is not consistent with target_confignode when first starts Seed-ConfigNode. (#7975)
2c9c03aa66 is described below
commit 2c9c03aa66308c807608d078b52c3a32e8e6b204
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Mon Nov 14 18:32:07 2022 +0800
[IOTDB-4849] Fix the problem that internal_address is not consistent with target_confignode when first starts Seed-ConfigNode. (#7975)
---
.../org/apache/iotdb/confignode/manager/ConfigManager.java | 12 +++++++++---
.../apache/iotdb/confignode/manager/node/NodeManager.java | 10 ++++++++++
.../java/org/apache/iotdb/confignode/service/ConfigNode.java | 5 +++++
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
index 2baaf0a600..542e65b261 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
@@ -240,9 +240,15 @@ public class ConfigManager implements IManager {
}
public void close() throws IOException {
- consensusManager.close();
- partitionManager.getRegionMaintainer().shutdown();
- procedureManager.shiftExecutor(false);
+ if (consensusManager != null) {
+ consensusManager.close();
+ }
+ if (partitionManager != null) {
+ partitionManager.getRegionMaintainer().shutdown();
+ }
+ if (procedureManager != null) {
+ procedureManager.shiftExecutor(false);
+ }
}
@Override
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 3db90ba4fc..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
@@ -356,6 +356,16 @@ public class NodeManager {
}
public TConfigNodeRegisterResp registerConfigNode(TConfigNodeRegisterReq req) {
+ if (configManager.getConsensusManager() == null) {
+ 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.");
+ return new TConfigNodeRegisterResp()
+ .setStatus(errorStatus)
+ .setConfigNodeId(ERROR_STATUS_NODE_ID);
+ }
+
// Check global configuration
TSStatus status = configManager.getConsensusManager().confirmLeader();
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 {