weizihan0110 commented on a change in pull request #2468:
URL: https://github.com/apache/iotdb/pull/2468#discussion_r579595015



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -242,16 +242,25 @@ MeasurementMNode createTimeseries(
     // synchronize check and add, we need addChild and add Alias become atomic 
operation
     // only write on mtree will be synchronized
     synchronized (this) {
-      if (cur.hasChild(leafName)) {
+      MNode child = cur.getChild(leafName);
+      if (child instanceof MeasurementMNode || child instanceof 
StorageGroupMNode) {
         throw new PathAlreadyExistException(path.getFullPath());
       }
-      if (alias != null && cur.hasChild(alias)) {
-        throw new AliasAlreadyExistException(path.getFullPath(), alias);
+
+      if (alias != null) {
+        MNode childByAlias = cur.getChild(alias);
+        if (childByAlias instanceof MeasurementMNode) {
+          throw new AliasAlreadyExistException(path.getFullPath(), alias);
+        }
       }
+
       MeasurementMNode leaf =
           new MeasurementMNode(cur, leafName, alias, dataType, encoding, 
compressor, props);

Review comment:
       Thanks for your opinion.




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


Reply via email to