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/21 03:38:09 UTC

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

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



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -242,23 +242,33 @@ 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) {

Review comment:
       how to guarantee childByAlias != null




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