Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

public class FileVersionTooOldException extends IOException {

public FileVersionTooOldException(byte currentVersion, byte minimumVersion) {
public FileVersionTooOldException(byte currentVersion, byte minimumVersion, byte maximumVersion) {
super(
String.format(
"The current version %d is too old, please at least upgrade to %d",
currentVersion, minimumVersion));
"The current version %d is not supported. Currently supported versions are %d to %d.",
currentVersion, minimumVersion, maximumVersion));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,9 @@ private void configDeserializer() {
}

private void checkFileVersion() throws FileVersionTooOldException {
if (TSFileConfig.VERSION_NUMBER - fileVersion > 1) {
throw new FileVersionTooOldException(fileVersion, (byte) (TSFileConfig.VERSION_NUMBER - 1));
if (fileVersion < TSFileConfig.VERSION_NUMBER_V3 || fileVersion > TSFileConfig.VERSION_NUMBER) {
throw new FileVersionTooOldException(
fileVersion, TSFileConfig.VERSION_NUMBER_V3, TSFileConfig.VERSION_NUMBER);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import org.apache.tsfile.common.conf.TSFileConfig;
import org.apache.tsfile.constant.TestConstant;
import org.apache.tsfile.read.TsFileSequenceReader;
import org.apache.tsfile.write.writer.LocalTsFileOutput;
import org.apache.tsfile.write.writer.TsFileIOWriter;

Expand Down Expand Up @@ -67,6 +68,9 @@ public void after() {
@Test
public void isTsFileCompleteTest() throws IOException {
Assert.assertTrue(TsFileUtils.isTsFileComplete(new File(COMPLETE_FILE_PATH)));
Assert.assertFalse(TsFileUtils.isTsFileComplete(new File(INCOMPLETE_FILE_PATH)));
try (TsFileSequenceReader reader = new TsFileSequenceReader(INCOMPLETE_FILE_PATH)) {
Assert.fail();
} catch (Exception ignored) {
}
}
}
Loading