weizihan0110 commented on a change in pull request #2468:
URL: https://github.com/apache/iotdb/pull/2468#discussion_r579601730
##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/mnode/MNode.java
##########
@@ -233,4 +235,20 @@ void serializeChildren(MLogWriter logWriter) throws
IOException {
entry.getValue().serializeTo(logWriter);
}
}
+
+ public void replaceChild(String measurement, MNode newChildNode) {
+ MNode oldChildNode = this.getChild(measurement);
+ if (oldChildNode == null) {
+ return;
+ }
+ Map<String, MNode> grandChildren = oldChildNode.getChildren();
+ // newChildNode builds parent-child relationship
+ newChildNode.setChildren(grandChildren);
+ grandChildren.forEach(
+ (grandChildName, grandChildNode) ->
grandChildNode.setParent(newChildNode));
Review comment:
Thanks a lot for your reviews. I've already fixed it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]