fix(load): use buffered input when splitting TsFiles - #18388
Conversation
| throws IOException, LoadFileException, IllegalStateException { | ||
| try (TsFileSequenceReader reader = new TsFileSequenceReader(tsFile.getAbsolutePath())) { | ||
| try (TsFileSequenceReader reader = | ||
| new TsFileSequenceReader(new BufferedTsFileInput(tsFile.toPath()))) { |
There was a problem hiding this 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.
Description
As the title said
This PR has:
for an unfamiliar reader.
for code coverage.
Key changed/added classes (or packages if there are too many classes) in this PR