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/15 12:06:54 UTC
[iotdb] branch beyyes/fix_iotdb4942 created (now b175134aa5)
This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a change to branch beyyes/fix_iotdb4942
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at b175134aa5 only checkDirectory when start DataNode
This branch includes the following new commits:
new b175134aa5 only checkDirectory when start DataNode
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: only checkDirectory when start DataNode
Posted by ca...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a commit to branch beyyes/fix_iotdb4942
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit b175134aa59fb61c7e3f55a1f26d98cb59a02777
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Tue Nov 15 20:06:37 2022 +0800
only checkDirectory when start DataNode
---
.../src/main/java/org/apache/iotdb/db/service/DataNode.java | 9 +++++++--
.../apache/iotdb/db/service/DataNodeServerCommandLine.java | 12 +++++++-----
2 files changed, 14 insertions(+), 7 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 6a76230349..25b74c5971 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
@@ -89,6 +89,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
+import static org.apache.iotdb.db.service.DataNodeServerCommandLine.MODE_START;
+
public class DataNode implements DataNodeMBean {
private static final Logger logger = LoggerFactory.getLogger(DataNode.class);
private static final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
@@ -128,10 +130,13 @@ public class DataNode implements DataNodeMBean {
new DataNodeServerCommandLine().doMain(args);
}
- protected void serverCheckAndInit() throws ConfigurationException, IOException {
+ protected void serverCheckAndInit(String mode) throws ConfigurationException, IOException {
config.setClusterMode(true);
IoTDBStartCheck.getInstance().checkConfig();
- IoTDBStartCheck.getInstance().checkDirectory();
+ if (MODE_START.equals(mode)) {
+ // Only checkDirectory when start DataNode
+ IoTDBStartCheck.getInstance().checkDirectory();
+ }
// TODO: check configuration for data node
for (TEndPoint endPoint : config.getTargetConfigNodeList()) {
diff --git a/server/src/main/java/org/apache/iotdb/db/service/DataNodeServerCommandLine.java b/server/src/main/java/org/apache/iotdb/db/service/DataNodeServerCommandLine.java
index 01b9a56a79..55bba9fb9c 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/DataNodeServerCommandLine.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/DataNodeServerCommandLine.java
@@ -48,10 +48,10 @@ public class DataNodeServerCommandLine extends ServerCommandLine {
private static final Logger LOGGER = LoggerFactory.getLogger(DataNodeServerCommandLine.class);
// join an established cluster
- private static final String MODE_START = "-s";
+ public static final String MODE_START = "-s";
// send a request to remove a node, more arguments: ip-of-removed-node
// metaport-of-removed-node
- private static final String MODE_REMOVE = "-r";
+ public static final String MODE_REMOVE = "-r";
private static final String USAGE =
"Usage: <-s|-r> "
@@ -72,15 +72,17 @@ public class DataNodeServerCommandLine extends ServerCommandLine {
}
DataNode dataNode = DataNode.getInstance();
+
+ String mode = args[0];
+ LOGGER.info("Running mode {}", mode);
+
// Check config of IoTDB, and set some configs in cluster mode
try {
- dataNode.serverCheckAndInit();
+ dataNode.serverCheckAndInit(mode);
} catch (ConfigurationException | IOException e) {
LOGGER.error("Meet error when doing start checking", e);
return -1;
}
- String mode = args[0];
- LOGGER.info("Running mode {}", mode);
// Initialize the current node and its services
if (!dataNode.initLocalEngines()) {