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:24:11 UTC

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

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



##########
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 --;
+        }
+      }
+      if (successNum <= 0) {
+        break;
+      }
+
+      if (System.currentTimeMillis() - startTime > ClusterDescriptor.getInstance().getConfig().getConnectionTimeoutInMS()) {
+        break;
+      } else {
+        try {
+          Thread.sleep(1);
+        } catch (InterruptedException e) {
+          logger.debug("Failed to wait for creating sgs for plan");

Review comment:
       It would be better if  the log here contains specified log~




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