From 6a58275356f14dec753bf3b4e98bc2537ca4a420 Mon Sep 17 00:00:00 2001 From: Tianan Li Date: Fri, 8 Nov 2019 18:09:19 +0800 Subject: [PATCH] fix eof of sequence reader (#538) --- .../fileSystem/fileOutputFactory/HDFSOutputFactory.java | 1 + .../apache/iotdb/tsfile/read/TsFileSequenceReader.java | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileOutputFactory/HDFSOutputFactory.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileOutputFactory/HDFSOutputFactory.java index 8680cccbc6..829a782b53 100644 --- a/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileOutputFactory/HDFSOutputFactory.java +++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileOutputFactory/HDFSOutputFactory.java @@ -41,6 +41,7 @@ public class HDFSOutputFactory implements FileOutputFactory { } } + @Override public TsFileOutput getTsFileOutput(String filePath, boolean append) { try { return (TsFileOutput) constructor.newInstance(filePath, !append); 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 b406b0a3a6..81930e2761 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 @@ -662,15 +662,16 @@ public class TsFileSequenceReader implements AutoCloseable { // the disk file is corrupted, using this file may be dangerous MetaMarker.handleUnexpectedMarker(marker); goon = false; - logger.error("Unrecognized marker detected, this file may be corrupted"); + logger.error(String + .format("Unrecognized marker detected, this file {%s} may be corrupted", file)); } } // now we read the tail of the data section, so we are sure that the last ChunkGroupFooter is // complete. truncatedPosition = this.position() - 1; - } catch (IOException e2) { - logger.info("TsFile self-check cannot proceed at position {} after {} chunk groups " - + "recovered, because : {}", this.position(), newMetaData.size(), e2.getMessage()); + } catch (Exception e2) { + logger.info("TsFile {} self-check cannot proceed at position {} after {} chunk groups " + + "recovered, because : {}", file, this.position(), newMetaData.size(), e2.getMessage()); } // Despite the completeness of the data section, we will discard current FileMetadata // so that we can continue to write data into this tsfile. -- GitLab