You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/02/20 03:50:07 UTC

[GitHub] [iotdb] jt2594838 commented on a change in pull request #2468: [ISSUE-2484] Fix creating timeseries error by using "create" or "insert" statement

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



##########
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:
       The name `leaf` is no longer proper.




----------------------------------------------------------------
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:
users@infra.apache.org