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/01/27 14:44:02 UTC

[GitHub] [iotdb] jixuan1989 commented on a change in pull request #2550: Optimize storage group recovery

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



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
##########
@@ -417,21 +417,13 @@ private StorageGroupProcessor getStorageGroupProcessorByPath(PartialPath deviceP
         .get(storageGroupMNode.getPartialPath());
     if (virtualStorageGroupManager == null) {
       // if finish recover
-      if (isAllSgReady.get()) {
-        waitAllSgReady(devicePath);
-        synchronized (storageGroupMNode) {
-          virtualStorageGroupManager = processorMap.get(storageGroupMNode.getPartialPath());
-          if (virtualStorageGroupManager == null) {
-            virtualStorageGroupManager = new VirtualStorageGroupManager();
-            processorMap.put(storageGroupMNode.getPartialPath(), virtualStorageGroupManager);
-          }
+      waitAllSgReady(devicePath);

Review comment:
       if sg is not ready, tell the user that message ASAP is a good design... 
   In general, blocking user's call is not good

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/virtualSg/VirtualStorageGroupManager.java
##########
@@ -159,12 +159,14 @@ public void run() {
       });
 
       threadList.add(recoverThread);
-      recoverThread.start();
     }
 
+    Thread thread;
     for (int i = 0; i < partitioner.getPartitionCount(); i++) {
       try {
-        threadList.get(i).join();
+        thread = threadList.get(i);
+        thread.start();
+        thread.join();

Review comment:
       why change this from async to sync mode?




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