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

[iotdb] branch jira3240 created (now 47bcb7862f)

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

tanxinyu pushed a change to branch jira3240
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 47bcb7862f finish

This branch includes the following new commits:

     new 47bcb7862f finish

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: finish

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tanxinyu pushed a commit to branch jira3240
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 47bcb7862fa4432924fafe1d901aa05f274a79a7
Author: LebronAl <TX...@gmail.com>
AuthorDate: Fri May 27 12:12:05 2022 +0800

    finish
---
 .../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..afa3c7efd3 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 join
+    // 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()