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/24 07:20:39 UTC

[incubator-iotdb] branch refactor_bufferwrite_new updated: extract getDataFolder as an interface so that otherProcessor can inherit it

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

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


The following commit(s) were added to refs/heads/refactor_bufferwrite_new by this push:
     new 9337c82  extract getDataFolder as an interface so that otherProcessor can inherit it
9337c82 is described below

commit 9337c824129fd16c3a278318de7291764c3079e6
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Wed Apr 24 15:20:25 2019 +0800

    extract getDataFolder as an interface so that otherProcessor can inherit it
---
 .../apache/iotdb/db/engine/tsfiledata/TsFileProcessor.java   | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

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 c600fc3..194462f 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
@@ -164,7 +164,7 @@ public class TsFileProcessor extends Processor {
     File unclosedFile = null;
     String unclosedFileName = null;
     int unclosedFileCount = 0;
-    for (String folderPath : Directories.getInstance().getAllTsFileFolders()) {
+    for (String folderPath : getAllDataFolders()) {
       File dataFolder = new File(folderPath, processorName);
       if (dataFolder.exists()) {
         // we do not add the unclosed tsfile into tsFileResources.
@@ -229,7 +229,7 @@ public class TsFileProcessor extends Processor {
 
 
   private File generateNewTsFilePath() throws BufferWriteProcessorException {
-    String dataDir = Directories.getInstance().getNextFolderForTsfile();
+    String dataDir = getNextDataFolder();
     File dataFolder = new File(dataDir, processorName);
     if (!dataFolder.exists()) {
       if (!dataFolder.mkdirs()) {
@@ -779,6 +779,14 @@ public class TsFileProcessor extends Processor {
     return false;
   }
 
+  protected List<String> getAllDataFolders() {
+    return Directories.getInstance().getAllTsFileFolders();
+  }
+
+  protected String getNextDataFolder() {
+    return Directories.getInstance().getNextFolderForTsfile();
+  }
+
   @Override
   public boolean equals(Object o) {
     if (this == o) {