You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2022/05/19 11:04:01 UTC
[iotdb] branch rel/0.13 updated: Print file name while meeting error in reading or deserializing (#5958)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch rel/0.13
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.13 by this push:
new ad6fa9d2be Print file name while meeting error in reading or deserializing (#5958)
ad6fa9d2be is described below
commit ad6fa9d2bec9e2803eba76199e5ec2bc8994dd53
Author: Jackie Tien <ja...@gmail.com>
AuthorDate: Thu May 19 19:03:57 2022 +0800
Print file name while meeting error in reading or deserializing (#5958)
---
.../iotdb/tsfile/read/TsFileSequenceReader.java | 52 +++++++++++++++++-----
1 file changed, 41 insertions(+), 11 deletions(-)
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
index 265196ad30..75c01fdbd6 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
@@ -1032,7 +1032,12 @@ public class TsFileSequenceReader implements AutoCloseable {
* @throws IOException io error
*/
public ChunkHeader readChunkHeader(byte chunkType) throws IOException {
- return ChunkHeader.deserializeFrom(tsFileInput.wrapAsInputStream(), chunkType);
+ try {
+ return ChunkHeader.deserializeFrom(tsFileInput.wrapAsInputStream(), chunkType);
+ } catch (Throwable t) {
+ logger.error("Exception happened while reading chunk header of {}", file, t);
+ throw t;
+ }
}
/**
@@ -1042,7 +1047,12 @@ public class TsFileSequenceReader implements AutoCloseable {
* @param chunkHeaderSize the size of chunk's header
*/
private ChunkHeader readChunkHeader(long position, int chunkHeaderSize) throws IOException {
- return ChunkHeader.deserializeFrom(tsFileInput, position, chunkHeaderSize);
+ try {
+ return ChunkHeader.deserializeFrom(tsFileInput, position, chunkHeaderSize);
+ } catch (Throwable t) {
+ logger.error("Exception happened while reading chunk header of {}", file, t);
+ throw t;
+ }
}
/**
@@ -1053,7 +1063,12 @@ public class TsFileSequenceReader implements AutoCloseable {
* @return the pages of this chunk
*/
private ByteBuffer readChunk(long position, int dataSize) throws IOException {
- return readData(position, dataSize);
+ try {
+ return readData(position, dataSize);
+ } catch (Throwable t) {
+ logger.error("Exception happened while reading chunk of {}", file, t);
+ throw t;
+ }
}
/**
@@ -1063,12 +1078,17 @@ public class TsFileSequenceReader implements AutoCloseable {
* @return -chunk
*/
public Chunk readMemChunk(ChunkMetadata metaData) throws IOException {
- int chunkHeadSize = ChunkHeader.getSerializedSize(metaData.getMeasurementUid());
- ChunkHeader header = readChunkHeader(metaData.getOffsetOfChunkHeader(), chunkHeadSize);
- ByteBuffer buffer =
- readChunk(
- metaData.getOffsetOfChunkHeader() + header.getSerializedSize(), header.getDataSize());
- return new Chunk(header, buffer, metaData.getDeleteIntervalList(), metaData.getStatistics());
+ try {
+ int chunkHeadSize = ChunkHeader.getSerializedSize(metaData.getMeasurementUid());
+ ChunkHeader header = readChunkHeader(metaData.getOffsetOfChunkHeader(), chunkHeadSize);
+ ByteBuffer buffer =
+ readChunk(
+ metaData.getOffsetOfChunkHeader() + header.getSerializedSize(), header.getDataSize());
+ return new Chunk(header, buffer, metaData.getDeleteIntervalList(), metaData.getStatistics());
+ } catch (Throwable t) {
+ logger.error("Exception happened while reading chunk of {}", file, t);
+ throw t;
+ }
}
/**
@@ -1094,7 +1114,12 @@ public class TsFileSequenceReader implements AutoCloseable {
* @param type given tsfile data type
*/
public PageHeader readPageHeader(TSDataType type, boolean hasStatistic) throws IOException {
- return PageHeader.deserializeFrom(tsFileInput.wrapAsInputStream(), type, hasStatistic);
+ try {
+ return PageHeader.deserializeFrom(tsFileInput.wrapAsInputStream(), type, hasStatistic);
+ } catch (Throwable t) {
+ logger.error("Exception happened while reading page header of {}", file, t);
+ throw t;
+ }
}
public long position() throws IOException {
@@ -1207,7 +1232,12 @@ public class TsFileSequenceReader implements AutoCloseable {
* @return data that been read.
*/
protected ByteBuffer readData(long start, long end) throws IOException {
- return readData(start, (int) (end - start));
+ try {
+ return readData(start, (int) (end - start));
+ } catch (Throwable t) {
+ logger.error("Exception happened while reading data of {}", file, t);
+ throw t;
+ }
}
/** notice, the target bytebuffer are not flipped. */