This is an automated email from the ASF dual-hosted git repository.
hxd pushed a commit to branch iotdb39-autoreadrepair
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/iotdb39-autoreadrepair by this
push:
new 62eb9bd remove comment codes
62eb9bd is described below
commit 62eb9bd05af167a1a61e6f3d8ef41848195aa832
Author: xiangdong huang <[email protected]>
AuthorDate: Sat Mar 16 16:54:12 2019 +0800
remove comment codes
---
.../java/org/apache/iotdb/tsfile/read/TsFileRestorableReader.java | 6 +++---
.../java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java | 8 +-------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileRestorableReader.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileRestorableReader.java
index 1c3a69f..ccbce14 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileRestorableReader.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileRestorableReader.java
@@ -43,7 +43,7 @@ public class TsFileRestorableReader extends
TsFileSequenceReader {
// Exception when reading broken data. Therefore, we set loadMetadata as
true in this case.
super(file, !autoRepair);
if (autoRepair) {
- checkAndRepair(file);
+ checkAndRepair();
loadMetadataSize();
}
}
@@ -51,9 +51,9 @@ public class TsFileRestorableReader extends
TsFileSequenceReader {
/**
* Checks if the file is incomplete, and if so, tries to repair it.
*/
- private void checkAndRepair(String file) throws IOException {
+ private void checkAndRepair() throws IOException {
// Check if file is damaged
- if (!TSFileConfig.MAGIC_STRING.equals(readTailMagic())) {
+ if (!isComplete()) {
// Try to close it
LOGGER.info("File {} has no correct tail magic, try to repair...", file);
NativeRestorableIOWriter rWriter = new NativeRestorableIOWriter(new
File(file), false);
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 debd5fe..c15ba7b 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
@@ -59,7 +59,7 @@ public class TsFileSequenceReader implements AutoCloseable{
private long fileMetadataPos;
private int fileMetadataSize;
private ByteBuffer markerBuffer = ByteBuffer.allocate(Byte.BYTES);
- private String file;
+ protected String file;
/**
* Create a file reader of the given file. The reader will read the tail of
the file to get the
@@ -130,12 +130,6 @@ public class TsFileSequenceReader implements AutoCloseable{
public String readTailMagic() throws IOException {
long totalSize = tsFileInput.size();
- // CHeck if the file is large enough to contain a tail magic
- // If the file only contains a header magic, this could also be assumed to
be the tail magic
-// if (totalSize <= TSFileConfig.MAGIC_STRING.length()) {
-// throw new IOException("This file has no tail magic!");
-// }
-
ByteBuffer magicStringBytes =
ByteBuffer.allocate(TSFileConfig.MAGIC_STRING.length());
tsFileInput.read(magicStringBytes, totalSize -
TSFileConfig.MAGIC_STRING.length());
magicStringBytes.flip();