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 14:11:26 UTC
[iotdb] branch master updated: [IOTDB-4942] Only checkDirectory when start DataNode (#7999)
This is an automated email from the ASF dual-hosted git repository.
caogaofei 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 7f01748284 [IOTDB-4942] Only checkDirectory when start DataNode (#7999)
7f01748284 is described below
commit 7f01748284d3486a600f9069a4426b272a086037
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Tue Nov 15 22:11:19 2022 +0800
[IOTDB-4942] Only checkDirectory when start DataNode (#7999)
---
.../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()) {