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/08/08 07:23:37 UTC
[iotdb] branch master updated: [IOTDB-4051] fix nodeid duplicated problem (#6909)
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 39db994138 [IOTDB-4051] fix nodeid duplicated problem (#6909)
39db994138 is described below
commit 39db994138c878b9e4f055d4c62e56f9ceb86693
Author: wangchao316 <66...@users.noreply.github.com>
AuthorDate: Mon Aug 8 15:23:32 2022 +0800
[IOTDB-4051] fix nodeid duplicated problem (#6909)
---
.../main/java/org/apache/iotdb/confignode/persistence/NodeInfo.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/NodeInfo.java b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/NodeInfo.java
index 108ee8b6b2..1efbc648fb 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/NodeInfo.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/NodeInfo.java
@@ -87,7 +87,7 @@ public class NodeInfo implements SnapshotProcessor {
// Registered DataNodes
private final ReentrantReadWriteLock dataNodeInfoReadWriteLock;
- private final AtomicInteger nextNodeId = new AtomicInteger(0);
+ private final AtomicInteger nextNodeId = new AtomicInteger(-1);
private final ConcurrentNavigableMap<Integer, TDataNodeConfiguration> registeredDataNodes =
new ConcurrentSkipListMap<>();
@@ -396,7 +396,7 @@ public class NodeInfo implements SnapshotProcessor {
}
public int generateNextNodeId() {
- return nextNodeId.getAndIncrement();
+ return nextNodeId.incrementAndGet();
}
@Override
@@ -559,7 +559,7 @@ public class NodeInfo implements SnapshotProcessor {
}
public void clear() {
- nextNodeId.set(0);
+ nextNodeId.set(-1);
registeredDataNodes.clear();
drainingDataNodes.clear();
registeredConfigNodes.clear();