Caideyipi commented on code in PR #18388:
URL: https://github.com/apache/iotdb/pull/18388#discussion_r3708832491


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/splitter/TsFileSplitter.java:
##########
@@ -96,7 +97,8 @@ public TsFileSplitter(File tsFile, TsFileDataConsumer 
consumer) {
   @SuppressWarnings({"squid:S3776", "squid:S6541"})
   public void splitTsFileByDataPartition()
       throws IOException, LoadFileException, IllegalStateException {
-    try (TsFileSequenceReader reader = new 
TsFileSequenceReader(tsFile.getAbsolutePath())) {
+    try (TsFileSequenceReader reader =
+        new TsFileSequenceReader(new BufferedTsFileInput(tsFile.toPath()))) {

Review Comment:
   This overload skips TsFileSequenceReader.loadFileVersion(). The 
TsFileSequenceReader(TsFileInput) constructor only loads the metadata size, so 
a v3 file keeps the default v4 DeserializeConfig. TsFileSplitter.checkMagic() 
explicitly accepts v3, but getAllTimeseriesMetadata(true) then fails while 
parsing its metadata.
   
   I reproduced this with 
iotdb-core/datanode/src/test/resources/v3tsfile/compaction-test-tsfile: the 
original string constructor reads 2 devices, whereas this constructor throws 
IllegalArgumentException: Invalid input: 114 from 
MetadataIndexNodeType.deserialize(). The four-argument buffered constructor 
works:
   
       new TsFileSequenceReader(
           new BufferedTsFileInput(tsFile.toPath()), true, false, null)
   
   Please preserve the version initialization (for example by using that 
overload) and add a v3 splitter regression test.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to