You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2020/12/31 03:26:52 UTC
[iotdb] branch master updated: Add check local nodes in
partitiontable's all nodes or not when restart the cluster
This is an automated email from the ASF dual-hosted git repository.
jiangtian 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 886b99d Add check local nodes in partitiontable's all nodes or not when restart the cluster
new 8966bf1 Merge pull request #2391 from neuyilan/apache_master_1230_fix_restart_bug
886b99d is described below
commit 886b99d7f64066045ea0eba13c8ac17391fcc6f9
Author: HouliangQi <ne...@163.com>
AuthorDate: Wed Dec 30 20:48:44 2020 +0800
Add check local nodes in partitiontable's all nodes or not when restart the cluster
---
.../java/org/apache/iotdb/cluster/ClusterMain.java | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
index 149d1aa..39994bb 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
@@ -148,7 +148,21 @@ public class ClusterMain {
}
seedNodes.add(node);
}
- // assert this node is in NodeList
+
+ // assert this node is in all nodes when restart
+ if (!metaServer.getMember().getAllNodes().isEmpty()) {
+ if (!metaServer.getMember().getAllNodes().contains(metaServer.getMember().getThisNode())) {
+ String message = String.format(
+ "All nodes in partitionTables must contains local node in start-server mode. "
+ + "LocalNode: %s, AllNodes: %s",
+ metaServer.getMember().getThisNode(), metaServer.getMember().getAllNodes());
+ throw new StartupException(metaServer.getMember().getName(), message);
+ } else {
+ return;
+ }
+ }
+
+ // assert this node is in seed nodes list
Node localNode = new Node();
localNode.setIp(config.getClusterRpcIp()).setMetaPort(config.getInternalMetaPort())
.setDataPort(config.getInternalDataPort()).setClientPort(config.getClusterRpcPort());
@@ -273,7 +287,6 @@ public class ClusterMain {
/**
* Developers may perform pre-start customizations here for debugging or experiments.
- *
*/
@SuppressWarnings("java:S125") // leaving examples
private static void preStartCustomize() {
@@ -300,7 +313,8 @@ public class ClusterMain {
if (sgSerialNum > 0) {
return maxSlotNum / k * sgSerialNum;
} else {
- return defaultStrategy.calculateSlotByPartitionNum(storageGroupName, partitionId, maxSlotNum);
+ return defaultStrategy
+ .calculateSlotByPartitionNum(storageGroupName, partitionId, maxSlotNum);
}
}