You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2019/04/12 12:53:10 UTC

[incubator-iotdb] branch master updated: FileNodeManager: call the `Future#get()` returned from the merge thread (#146)

This is an automated email from the ASF dual-hosted git repository.

hxd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 4456629  FileNodeManager:  call the `Future#get()` returned from the merge thread  (#146)
4456629 is described below

commit 44566294b449350a1a58feb3353e542dea8633c2
Author: Kun Liu <li...@mails.tsinghua.edu.cn>
AuthorDate: Fri Apr 12 20:53:06 2019 +0800

    FileNodeManager:  call the `Future#get()` returned from the merge thread  (#146)
    
    * add feature get for merge result, handle the merge exception
---
 .../apache/iotdb/db/engine/filenode/FileNodeManager.java   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
index 483b059..baf9fa6 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
@@ -27,6 +27,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
@@ -787,6 +788,7 @@ public class FileNodeManager implements IStatistic, IService {
     // loop waiting for merge to end, the longest waiting time is
     // 60s.
     int time = 2;
+    List<Exception> mergeException = new ArrayList<>();
     for (Future<?> task : futureTasks) {
       while (!task.isDone()) {
         try {
@@ -802,6 +804,18 @@ public class FileNodeManager implements IStatistic, IService {
           Thread.currentThread().interrupt();
         }
       }
+      try {
+        task.get();
+      } catch (InterruptedException e) {
+        LOGGER.error("Unexpected interruption {}", e);
+      } catch (ExecutionException e) {
+        mergeException.add(e);
+        LOGGER.error("The exception for merge: {}", e);
+      }
+    }
+    if (!mergeException.isEmpty()) {
+      // just throw the first exception
+      throw new FileNodeManagerException(mergeException.get(0));
     }
     fileNodeManagerStatus = FileNodeManagerStatus.NONE;
     LOGGER.info("End to merge all overflowed filenode");