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

[iotdb] branch master updated: [IOTDB-3240] [ErrorMSG]java.lang.IllegalStateException: Client has an error!Caused by: java.net.ConnectException: Connection refused (#6043)

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

haonan 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 15fa098316 [IOTDB-3240] [ErrorMSG]java.lang.IllegalStateException: Client has an error!Caused by: java.net.ConnectException: Connection refused (#6043)
15fa098316 is described below

commit 15fa098316f49b6048a82f92810ca2a68b0f7465
Author: Potato <TX...@gmail.com>
AuthorDate: Fri May 27 15:03:06 2022 +0800

    [IOTDB-3240] [ErrorMSG]java.lang.IllegalStateException: Client has an error!Caused by: java.net.ConnectException: Connection refused (#6043)
---
 .../java/org/apache/iotdb/db/service/DataNode.java | 32 ++++++++++++----------
 1 file changed, 17 insertions(+), 15 deletions(-)

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 1fd483360d..b523b8749e 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
@@ -119,6 +119,7 @@ public class DataNode implements DataNodeMBean {
   protected void doAddNode(String[] args) {
     try {
       // TODO : contact with config node to join into the cluster
+      prepareJoinCluster();
       joinCluster();
       active();
     } catch (StartupException e) {
@@ -137,6 +138,22 @@ public class DataNode implements DataNodeMBean {
     return true;
   }
 
+  public void prepareJoinCluster() throws StartupException {
+    // check iotdb server first
+    StartupChecks checks = new StartupChecks().withDefaultTest();
+    checks.verify();
+
+    // Register services
+    JMXService.registerMBean(getInstance(), mbeanName);
+    // set the mpp mode to true
+    IoTDBDescriptor.getInstance().getConfig().setMppMode(true);
+    IoTDBDescriptor.getInstance().getConfig().setClusterMode(true);
+
+    // start InternalService first so that it can respond to configNode's heartbeat before joining
+    // cluster
+    registerManager.register(InternalService.getInstance());
+  }
+
   public void joinCluster() throws StartupException {
     int retry = DEFAULT_JOIN_RETRY;
 
@@ -215,18 +232,6 @@ public class DataNode implements DataNodeMBean {
   }
 
   public void active() throws StartupException {
-    // set the mpp mode to true
-    IoTDBDescriptor.getInstance().getConfig().setMppMode(true);
-    IoTDBDescriptor.getInstance().getConfig().setClusterMode(true);
-    // start iotdb server first
-    StartupChecks checks = new StartupChecks().withDefaultTest();
-    try {
-      checks.verify();
-    } catch (StartupException e) {
-      // TODO: what are some checks
-      logger.error("IoTDB DataNode: failed to start because some checks failed. ", e);
-      return;
-    }
     try {
       setUp();
     } catch (StartupException | QueryProcessException e) {
@@ -244,8 +249,6 @@ public class DataNode implements DataNodeMBean {
       throw new StartupException(e);
     }
 
-    /** Register services */
-    JMXService.registerMBean(getInstance(), mbeanName);
     // TODO: move rpc service initialization from iotdb instance here
     // init influxDB MManager
     if (IoTDBDescriptor.getInstance().getConfig().isEnableInfluxDBRpcService()) {
@@ -272,7 +275,6 @@ public class DataNode implements DataNodeMBean {
     // in mpp mode we need to start some other services
     registerManager.register(StorageEngineV2.getInstance());
     registerManager.register(DataBlockService.getInstance());
-    registerManager.register(InternalService.getInstance());
     registerManager.register(DriverScheduler.getInstance());
     IoTDBDescriptor.getInstance()
         .getConfig()