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

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


The following commit(s) were added to 
refs/heads/new_series_reader_tsfileprocessor_test by this push:
     new a1d636b  add log for debug
a1d636b is described below

commit a1d636b0300c2bd094fc57d89c94466755ba1d06
Author: xiangdong huang <[email protected]>
AuthorDate: Sat Feb 22 07:56:49 2020 +0800

    add log for debug
---
 .../engine/storagegroup/TsFileProcessorTest.java   | 38 ++++++++++------------
 .../apache/iotdb/db/utils/EnvironmentUtils.java    |  1 +
 2 files changed, 19 insertions(+), 20 deletions(-)

diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
index 66ffacd..9343aeb 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
@@ -86,8 +86,7 @@ public class TsFileProcessorTest {
   public void testWriteAndFlush() throws IOException, QueryProcessException {
     logger.error("testWriteAndFlush begin..");
     processor = new TsFileProcessor(storageGroup, 
SystemFileFactory.INSTANCE.getFile(filePath),
-        SchemaUtils.constructSchema(deviceId), 
SysTimeVersionController.INSTANCE, x -> {
-    },
+        SchemaUtils.constructSchema(deviceId), 
SysTimeVersionController.INSTANCE, this::closeTsFileProcessor,
         (tsFileProcessor) -> true, true);
 
     Pair<List<ReadOnlyMemChunk>, List<ChunkMetaData>> pair = processor
@@ -135,8 +134,7 @@ public class TsFileProcessorTest {
   public void testWriteAndRestoreMetadata() throws IOException, 
QueryProcessException {
     logger.error("testWriteAndRestoreMetadata begin..");
     processor = new TsFileProcessor(storageGroup, 
SystemFileFactory.INSTANCE.getFile(filePath),
-        SchemaUtils.constructSchema(deviceId), 
SysTimeVersionController.INSTANCE, x -> {
-    },
+        SchemaUtils.constructSchema(deviceId), 
SysTimeVersionController.INSTANCE, this::closeTsFileProcessor,
         (tsFileProcessor) -> true, true);
 
     Pair<List<ReadOnlyMemChunk>, List<ChunkMetaData>> pair = processor
@@ -206,8 +204,7 @@ public class TsFileProcessorTest {
   public void testMultiFlush() throws IOException, QueryProcessException {
     logger.error("testWriteAndRestoreMetadata begin..");
     processor = new TsFileProcessor(storageGroup, 
SystemFileFactory.INSTANCE.getFile(filePath),
-        SchemaUtils.constructSchema(deviceId), 
SysTimeVersionController.INSTANCE, x -> {
-    },
+        SchemaUtils.constructSchema(deviceId), 
SysTimeVersionController.INSTANCE, this::closeTsFileProcessor,
         (tsFileProcessor) -> true, true);
 
     Pair<List<ReadOnlyMemChunk>, List<ChunkMetaData>> pair = processor
@@ -243,20 +240,7 @@ public class TsFileProcessorTest {
     logger.error("testWriteAndRestoreMetadata begin..");
     processor = new TsFileProcessor(storageGroup, 
SystemFileFactory.INSTANCE.getFile(filePath),
         SchemaUtils.constructSchema(deviceId), 
SysTimeVersionController.INSTANCE,
-        unsealedTsFileProcessor -> {
-          TsFileResource resource = 
unsealedTsFileProcessor.getTsFileResource();
-          synchronized (resource) {
-            for (Entry<String, Long> startTime : 
resource.getStartTimeMap().entrySet()) {
-              String deviceId = startTime.getKey();
-              resource.getEndTimeMap().put(deviceId, 
resource.getStartTimeMap().get(deviceId));
-            }
-            try {
-              resource.close();
-            } catch (IOException e) {
-              throw new TsFileProcessorException(e);
-            }
-          }
-        }, (tsFileProcessor) -> true, true);
+        this::closeTsFileProcessor, (tsFileProcessor) -> true, true);
 
     Pair<List<ReadOnlyMemChunk>, List<ChunkMetaData>> pair = processor
         .query(deviceId, measurementId, dataType, encoding, props, context);
@@ -293,4 +277,18 @@ public class TsFileProcessorTest {
     assertTrue(processor.getTsFileResource().isClosed());
 
   }
+  private void closeTsFileProcessor(TsFileProcessor unsealedTsFileProcessor) 
throws TsFileProcessorException {
+    TsFileResource resource = unsealedTsFileProcessor.getTsFileResource();
+    synchronized (resource) {
+      for (Entry<String, Long> startTime : 
resource.getStartTimeMap().entrySet()) {
+        String deviceId = startTime.getKey();
+        resource.getEndTimeMap().put(deviceId, 
resource.getStartTimeMap().get(deviceId));
+      }
+      try {
+        resource.close();
+      } catch (IOException e) {
+        throw new TsFileProcessorException(e);
+      }
+    }
+  }
 }
\ No newline at end of file
diff --git 
a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java 
b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
index 871506f..c8b316f 100644
--- a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
+++ b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
@@ -78,6 +78,7 @@ public class EnvironmentUtils {
   private static IoTDB daemon;
 
   public static void cleanEnv() throws IOException, StorageEngineException {
+    logger.warn("EnvironmentUtil cleanEnv...");
     if (daemon != null) {
       daemon.stop();
       daemon = null;

Reply via email to