You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2021/11/01 03:59:56 UTC

[iotdb] branch PrintErrorFilePath created (now 275c29f)

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

jackietien pushed a change to branch PrintErrorFilePath
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 275c29f  print the file path while meeting error in case of reading chunk

This branch includes the following new commits:

     new 275c29f  print the file path while meeting error in case of reading chunk

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[iotdb] 01/01: print the file path while meeting error in case of reading chunk

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch PrintErrorFilePath
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 275c29f0213bd30408faad44c477cd4b746c2bd7
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Mon Nov 1 11:59:20 2021 +0800

    print the file path while meeting error in case of reading chunk
---
 .../org/apache/iotdb/db/utils/FileLoaderUtils.java | 42 +++++++++++++---------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/utils/FileLoaderUtils.java b/server/src/main/java/org/apache/iotdb/db/utils/FileLoaderUtils.java
index 0a55b54..b12b3de 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/FileLoaderUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/FileLoaderUtils.java
@@ -18,6 +18,10 @@
  */
 package org.apache.iotdb.db.utils;
 
+import java.io.IOException;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
 import org.apache.iotdb.db.engine.cache.TimeSeriesMetadataCache;
 import org.apache.iotdb.db.engine.modification.Modification;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
@@ -39,14 +43,14 @@ import org.apache.iotdb.tsfile.read.filter.basic.Filter;
 import org.apache.iotdb.tsfile.read.reader.IChunkReader;
 import org.apache.iotdb.tsfile.read.reader.IPageReader;
 import org.apache.iotdb.tsfile.read.reader.chunk.ChunkReader;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class FileLoaderUtils {
 
+  private static final Logger logger = LoggerFactory.getLogger(FileLoaderUtils.class);
+
+
   private FileLoaderUtils() {}
 
   public static void checkTsFileResource(TsFileResource tsFileResource) throws IOException {
@@ -157,18 +161,24 @@ public class FileLoaderUtils {
     if (chunkMetaData == null) {
       throw new IOException("Can't init null chunkMeta");
     }
-    IChunkReader chunkReader;
-    IChunkLoader chunkLoader = chunkMetaData.getChunkLoader();
-    if (chunkLoader instanceof MemChunkLoader) {
-      MemChunkLoader memChunkLoader = (MemChunkLoader) chunkLoader;
-      chunkReader = new MemChunkReader(memChunkLoader.getChunk(), timeFilter);
-    } else {
-      Chunk chunk = chunkLoader.loadChunk(chunkMetaData);
-      chunk.setFromOldFile(chunkMetaData.isFromOldTsFile());
-      chunkReader = new ChunkReader(chunk, timeFilter);
-      chunkReader.hasNextSatisfiedPage();
+    try {
+      IChunkReader chunkReader;
+      IChunkLoader chunkLoader = chunkMetaData.getChunkLoader();
+      if (chunkLoader instanceof MemChunkLoader) {
+        MemChunkLoader memChunkLoader = (MemChunkLoader) chunkLoader;
+        chunkReader = new MemChunkReader(memChunkLoader.getChunk(), timeFilter);
+      } else {
+        Chunk chunk = chunkLoader.loadChunk(chunkMetaData);
+        chunk.setFromOldFile(chunkMetaData.isFromOldTsFile());
+        chunkReader = new ChunkReader(chunk, timeFilter);
+        chunkReader.hasNextSatisfiedPage();
+      }
+      return chunkReader.loadPageReaderList();
+    } catch (IOException e) {
+      logger.error("Something wrong happened while reading chunk from " + chunkMetaData.getFilePath());
+      throw e;
     }
-    return chunkReader.loadPageReaderList();
+
   }
 
   public static List<ChunkMetadata> getChunkMetadataList(Path path, String filePath)