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

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


The following commit(s) were added to refs/heads/fix_closed_channel_issue by 
this push:
     new 4d60f48  add file reader remove function invoking in merge process
4d60f48 is described below

commit 4d60f4837c2b92a9a3f433082b173b816a0ab8e3
Author: CGF <[email protected]>
AuthorDate: Sun Mar 24 22:52:13 2019 +0800

    add file reader remove function invoking in merge process
---
 .../iotdb/db/engine/filenode/FileNodeProcessor.java       | 10 +++++++---
 .../iotdb/db/integration/IoTDBFlushQueryMergeTest.java    | 15 ++++-----------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git 
a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
 
b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
index 78b3696..128db68 100644
--- 
a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
+++ 
b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
@@ -1406,15 +1406,19 @@ public class FileNodeProcessor extends Processor 
implements IStatistic {
     }
   }
 
-  private void deleteBufferWriteFiles(List<File> bufferwriteDirList, 
Set<String> bufferFiles) {
+  private void deleteBufferWriteFiles(List<File> bufferwriteDirList, 
Set<String> bufferFiles)
+      throws IOException {
     for (File bufferwriteDir : bufferwriteDirList) {
       File[] files = bufferwriteDir.listFiles();
       if (files == null) {
         continue;
       }
       for (File file : files) {
-        if (!bufferFiles.contains(file.getPath()) && !file.delete()) {
-          LOGGER.warn("Cannot delete BufferWrite file {}", file.getPath());
+        if (!bufferFiles.contains(file.getPath())) {
+          
FileReaderManager.getInstance().closeFileAndRemoveReader(file.getAbsolutePath());
+          if (!file.delete()) {
+            LOGGER.warn("Cannot delete BufferWrite file {}", file.getPath());
+          }
         }
       }
     }
diff --git 
a/iotdb/src/test/java/org/apache/iotdb/db/integration/IoTDBFlushQueryMergeTest.java
 
b/iotdb/src/test/java/org/apache/iotdb/db/integration/IoTDBFlushQueryMergeTest.java
index 90b45dd..39691bc 100644
--- 
a/iotdb/src/test/java/org/apache/iotdb/db/integration/IoTDBFlushQueryMergeTest.java
+++ 
b/iotdb/src/test/java/org/apache/iotdb/db/integration/IoTDBFlushQueryMergeTest.java
@@ -27,23 +27,16 @@ import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
-
 import java.sql.*;
-
-import static org.apache.iotdb.db.integration.Constant.*;
-import static org.apache.iotdb.db.integration.Constant.d1s0;
 import static org.junit.Assert.fail;
 
 public class IoTDBFlushQueryMergeTest {
 
   private static IoTDB daemon;
   private static String[] sqls = new String[]{
-      "SET STORAGE GROUP TO root.vehicle.d0", "SET STORAGE GROUP TO 
root.vehicle.d1",
-
+      "SET STORAGE GROUP TO root.vehicle.d0",
       "CREATE TIMESERIES root.vehicle.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE",
 
-      "CREATE TIMESERIES root.vehicle.d1.s0 WITH DATATYPE=INT32, ENCODING=RLE",
-
       "insert into root.vehicle.d0(timestamp,s0) values(1,101)",
       "insert into root.vehicle.d0(timestamp,s0) values(2,198)",
       "insert into root.vehicle.d0(timestamp,s0) values(100,99)",
@@ -121,9 +114,9 @@ public class IoTDBFlushQueryMergeTest {
       }
       statement.close();
 
-//      statement = connection.createStatement();
-//      statement.execute("merge");
-//      statement.close();
+      statement = connection.createStatement();
+      statement.execute("merge");
+      statement.close();
 
     } catch (Exception e) {
       e.printStackTrace();

Reply via email to