jixuan1989 commented on a change in pull request #389: [IOTDB-165][TsFile] 
Delete a current version and add a number version and an exception.
URL: https://github.com/apache/incubator-iotdb/pull/389#discussion_r326118742
 
 

 ##########
 File path: 
tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
 ##########
 @@ -195,8 +196,8 @@ public String readTailMagic() throws IOException {
    * whether the file is a complete TsFile: only if the head magic and tail 
magic string exists.
    */
   public boolean isComplete() throws IOException {
-    return tsFileInput.size() >= TSFileConfig.MAGIC_STRING.length() * 2 && 
readTailMagic()
-        .equals(readHeadMagic());
+    return tsFileInput.size() >= TSFileConfig.MAGIC_STRING.length() * 2 + 
TSFileConfig.VERSION_NUMBER.length() &&
+        (readTailMagic() + 
TSFileConfig.VERSION_NUMBER).equals(readHeadMagic());
 
 Review comment:
   In my opinion, I think we can use two methods: `readHeadMagic()` which 
return "TsFile" and `readVersionNumber()`. We do not need to do operations like 
"String + String" (e.g., `readTailMagic() + TSFileConfig.VERSION_NUMBER`), 
which waste memory..

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to