[IOTDB-165][TsFile] Delete a current version and add a number version and an exception.#389
[IOTDB-165][TsFile] Delete a current version and add a number version and an exception.#389Genius-pig wants to merge 0 commit intoapache:masterfrom
Conversation
|
It failed in windows platform, there was some error information, but I don't know why. [ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.014 s <<< FAILURE! - in org.apache.iotdb.tsfile.read.TsFileSequenceReaderTest
[ERROR] testReadTsFileSequently(org.apache.iotdb.tsfile.read.TsFileSequenceReaderTest) Time elapsed: 0.014 s <<< ERROR!
java.io.FileNotFoundException: target\testTsFile.tsfile (Access is denied)
at org.apache.iotdb.tsfile.read.TsFileSequenceReaderTest.before(TsFileSequenceReaderTest.java:54)
[ERROR] testReadTsFileSequently(org.apache.iotdb.tsfile.read.TsFileSequenceReaderTest) Time elapsed: 0.014 s <<< ERROR!
java.lang.NullPointerException
at org.apache.iotdb.tsfile.read.TsFileSequenceReaderTest.after(TsFileSequenceReaderTest.java:61) |
04aef07 to
805fa9b
Compare
tsfile/src/main/java/org/apache/iotdb/tsfile/common/conf/TSFileConfig.java
Outdated
Show resolved
Hide resolved
9a7a3a9 to
e623906
Compare
jixuan1989
left a comment
There was a problem hiding this comment.
One question that want to discuss: do we need the version number at the tail of the file?
c3d148f to
e060369
Compare
|
@jixuan1989 I think don't need it, because when reading the head magic, you have already known the compatibility. The tail magic is used for an end sign. BTW, it's just my opinions. |
| } | ||
| } | ||
|
|
||
| fileMetaData.currentVersion = ReadWriteIOUtils.readInt(inputStream); |
There was a problem hiding this comment.
Remind to maintain the format-changelist.md
| 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()); |
There was a problem hiding this 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..
| @@ -213,15 +214,26 @@ public String readHeadMagic() throws IOException { | |||
| * to the end of the magic head string. | |||
| */ | |||
| public String readHeadMagic(boolean movePosition) throws IOException { | |||
There was a problem hiding this comment.
throws NotCompatibleException, IOException
| /** | ||
| * this function checks compatibility of TsFile. | ||
| */ | ||
| public void checkHeadMagic(String headMagic) throws IOException { |
There was a problem hiding this comment.
throws NotCompatibleException
| * this function checks compatibility of TsFile. | ||
| */ | ||
| public void checkHeadMagic(String headMagic) throws IOException { | ||
| if(!headMagic.equals(TSFileConfig.MAGIC_STRING + TSFileConfig.VERSION_NUMBER)) { |
There was a problem hiding this comment.
same question, do not need to generate a new String by using +.
| expressionOptimizer.optimize(expression, selectedSeries).toString()); | ||
|
|
||
| } catch (QueryFilterOptimizationException e) { | ||
| e.printStackTrace(); |
There was a problem hiding this comment.
Can you replace this e.print with logger.error()?
There was a problem hiding this comment.
Use a Assert.fail() is better?
jixuan1989
left a comment
There was a problem hiding this comment.
Remind:
- do not use string + string unless you have to do that.
- record all the changes if the file format is changed.
According to this issue, I implement 1, 2, delete a current version which I think is useless, and I will add an exception for TsFile reader in a few days. But discussion of the compatibility between iotdb and TsFile is still continuing.