Caideyipi commented on code in PR #17955:
URL: https://github.com/apache/iotdb/pull/17955#discussion_r3425362869


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/pagemgr/PageManager.java:
##########
@@ -305,6 +303,19 @@ private void writeUpdatedChildren(ICachedMNode node, 
SchemaPageContext cxt)
                 entry.getKey()));
       }
 
+      if (!child.isMeasurement() && getNodeAddress(child) < 0) {
+        if (child.isDevice() && child.getAsDeviceMNode().isUseTemplate()) {
+          throw new MetadataException(
+              String.format(
+                  "Adding or updating children of device using template [%s] 
is NOT allowed.",
+                  child.getFullPath()));
+        }

Review Comment:
   Addressed in e35299c138a. I removed the hard-coded template-device exception 
from this updated-child allocation branch and aligned it with 
writeNewChildren(), so there is no non-i18n message here now. The real 
template-child write rejection remains in SchemaFile.writeMNode() with the 
existing i18n message.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/pagemgr/PageManager.java:
##########
@@ -305,6 +303,19 @@ private void writeUpdatedChildren(ICachedMNode node, 
SchemaPageContext cxt)
                 entry.getKey()));
       }
 
+      if (!child.isMeasurement() && getNodeAddress(child) < 0) {
+        if (child.isDevice() && child.getAsDeviceMNode().isUseTemplate()) {

Review Comment:
   Addressed in e35299c138a. I added a regression test for the updated 
non-measurement child with a negative segment address, and changed the 
updated-child path to follow writeNewChildren(): allocate a segment before 
serialization without adding an extra template-device rejection in this branch. 
I also fixed the scheduleFlushAll()/scheduleFlush early-return path so 
flushingRegionSet is cleared from an outer finally even when the store is 
already closed or removed.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to