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/07/14 11:30:24 UTC

[GitHub] [iotdb] mychaow commented on a change in pull request #3269: [IOTDB-1292] Versioned MTree

mychaow commented on a change in pull request #3269:
URL: https://github.com/apache/iotdb/pull/3269#discussion_r669524011



##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
##########
@@ -1827,4 +1874,68 @@ public PartialPath getStorageGroupPath(PartialPath path) throws StorageGroupNotS
       return super.getStorageGroupPath(path);
     }
   }
+
+  @Override
+  public void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan) throws MetadataException {
+    PartialPath path = plan.getPrefixPath();
+    if (checkSgNodeAndPlanMajorVersion(path)) {
+      super.createAlignedTimeSeries(plan);
+    }
+  }
+
+  @Override
+  public void createTimeseries(CreateTimeSeriesPlan plan) throws MetadataException {
+    PartialPath path = plan.getPath();
+    if (checkSgNodeAndPlanMajorVersion(path)) {
+      super.createTimeseries(plan);
+    }
+  }
+
+  /**
+   * @param path the partial path
+   * @return true if the sg node major version == the path's major version; false if the sg node
+   *     major version > the path's major version; throw MetadataException if the sg node major
+   *     version < the path's major version.
+   * @throws MajorVersionNotEqualException sync meta leader failed and the
+   * @throws StorageGroupNotSetException some error occurred.
+   */
+  private boolean checkSgNodeAndPlanMajorVersion(PartialPath path)
+      throws MetadataException, StorageGroupNotSetException {
+    StorageGroupMNode node = null;
+    try {
+      node = getStorageGroupNodeByPath(path);
+    } catch (StorageGroupNotSetException e) {
+      syncMetaLeader();
+      node = getStorageGroupNodeByPath(path);
+    }
+

Review comment:
       so, why do not check whether node is 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.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org