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

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


The following commit(s) were added to refs/heads/refactor_bufferwrite by this 
push:
     new d7ff1c2  make stop tsfileProcess more safe
d7ff1c2 is described below

commit d7ff1c292e8a57e03c66666d7859a793ee716694
Author: xiangdong huang <[email protected]>
AuthorDate: Sun Apr 7 10:22:11 2019 +0800

    make stop tsfileProcess more safe
---
 .../org/apache/iotdb/db/engine/tsfiledata/TsFileProcessor.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git 
a/iotdb/src/main/java/org/apache/iotdb/db/engine/tsfiledata/TsFileProcessor.java
 
b/iotdb/src/main/java/org/apache/iotdb/db/engine/tsfiledata/TsFileProcessor.java
index c5cbffc..2c15fa7 100644
--- 
a/iotdb/src/main/java/org/apache/iotdb/db/engine/tsfiledata/TsFileProcessor.java
+++ 
b/iotdb/src/main/java/org/apache/iotdb/db/engine/tsfiledata/TsFileProcessor.java
@@ -33,6 +33,8 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.locks.ReentrantLock;
 import org.apache.iotdb.db.conf.IoTDBConfig;
@@ -699,6 +701,14 @@ public class TsFileProcessor extends Processor {
    * remove all data of this processor. Used For UT
    */
   public void removeMe() throws BufferWriteProcessorException, IOException {
+    try {
+      flushFuture.get(10000, TimeUnit.MILLISECONDS);
+    } catch (ExecutionException | TimeoutException e) {
+      LOGGER.error("can not end running flush task in 10 seconds: {}", 
e.getMessage());
+    } catch (InterruptedException e) {
+      LOGGER.error("current running flush task is interrupted.", e);
+      Thread.currentThread().interrupt();
+    }
     close();
     for (String folder : Directories.getInstance().getAllTsFileFolders()) {
       File dataFolder = new File(folder, processorName);

Reply via email to