You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by zy...@apache.org on 2022/07/13 08:56:19 UTC
[iotdb] branch master updated: [IOTDB-3811] Add registeredConfigNode into NodeInfo's snapshot #6659
This is an automated email from the ASF dual-hosted git repository.
zyk 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 035779b7b8 [IOTDB-3811] Add registeredConfigNode into NodeInfo's snapshot #6659
035779b7b8 is described below
commit 035779b7b877eaf2ced13a3a1968e0d7959680d8
Author: YongzaoDan <33...@users.noreply.github.com>
AuthorDate: Wed Jul 13 16:56:14 2022 +0800
[IOTDB-3811] Add registeredConfigNode into NodeInfo's snapshot #6659
[IOTDB-3811] Add registeredConfigNode into NodeInfo's snapshot #6659
---
.../iotdb/confignode/persistence/NodeInfo.java | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
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 84309fd720..d1c1c16535 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
@@ -404,6 +404,8 @@ public class NodeInfo implements SnapshotProcessor {
ReadWriteIOUtils.write(nextNodeId.get(), fileOutputStream);
+ serializeRegisteredConfigNode(fileOutputStream, protocol);
+
serializeRegisteredDataNode(fileOutputStream, protocol);
serializeDrainingDataNodes(fileOutputStream, protocol);
@@ -430,6 +432,14 @@ public class NodeInfo implements SnapshotProcessor {
}
}
+ private void serializeRegisteredConfigNode(OutputStream outputStream, TProtocol protocol)
+ throws IOException, TException {
+ ReadWriteIOUtils.write(registeredConfigNodes.size(), outputStream);
+ for (TConfigNodeLocation configNodeLocation : registeredConfigNodes) {
+ configNodeLocation.write(protocol);
+ }
+ }
+
private void serializeRegisteredDataNode(OutputStream outputStream, TProtocol protocol)
throws IOException, TException {
ReadWriteIOUtils.write(registeredDataNodes.size(), outputStream);
@@ -469,6 +479,8 @@ public class NodeInfo implements SnapshotProcessor {
nextNodeId.set(ReadWriteIOUtils.readInt(fileInputStream));
+ deserializeRegisteredConfigNode(fileInputStream, protocol);
+
deserializeRegisteredDataNode(fileInputStream, protocol);
deserializeDrainingDataNodes(fileInputStream, protocol);
@@ -481,6 +493,17 @@ public class NodeInfo implements SnapshotProcessor {
}
}
+ private void deserializeRegisteredConfigNode(InputStream inputStream, TProtocol protocol)
+ throws IOException, TException {
+ int size = ReadWriteIOUtils.readInt(inputStream);
+ while (size > 0) {
+ TConfigNodeLocation configNodeLocation = new TConfigNodeLocation();
+ configNodeLocation.read(protocol);
+ registeredConfigNodes.add(configNodeLocation);
+ size--;
+ }
+ }
+
private void deserializeRegisteredDataNode(InputStream inputStream, TProtocol protocol)
throws IOException, TException {
int size = ReadWriteIOUtils.readInt(inputStream);