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 2020/11/25 08:35:45 UTC

[GitHub] [iotdb] jt2594838 commented on a change in pull request #2113: when auto create schema, we need to wait for sg ready

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



##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
##########
@@ -416,6 +424,35 @@ public void createSchema(PhysicalPlan plan) throws MetadataException {
     }
   }
 
+  private void verifyCreatedSgSuccess(List<PartialPath> deviceIds) throws MetadataException {
+    long startTime = System.currentTimeMillis();
+    while (true) {
+      int successNum = deviceIds.size();
+      for (PartialPath deviceId : deviceIds) {
+        PartialPath storageGroupName = MetaUtils
+          .getStorageGroupPathByLevel(deviceId, IoTDBDescriptor.getInstance()
+            .getConfig().getDefaultStorageGroupLevel());
+        if (IoTDB.metaManager.isStorageGroup(storageGroupName)) {
+          successNum --;
+        }
+      }

Review comment:
       All deviceIds are verified in every loop, which is unnecessary.
   It would be better to copy deviceIds into another list and remove them once verified, or use a boolean array to indicate whether the deviceId has been verified.




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