[
https://issues.apache.org/jira/browse/IOTDB-1042?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17245141#comment-17245141
]
Xiangdong Huang commented on IOTDB-1042:
----------------------------------------
Hi,
I checked and debugged the source codes.
It seems there is no bug here.
But the field name `crash` is not very apropos.
> according to the design docs
Which design doc?
Some test for checking whether it works.
{code:java}
@Test
public void testEmptyFile() throws Exception {
File file = fsFactory.getFile(FILE_NAME);
RestorableTsFileIOWriter rWriter = new RestorableTsFileIOWriter(file);
assertTrue(rWriter.canWrite());
TsFileWriter writer = new TsFileWriter(rWriter);
writer.registerTimeseries(new Path("d1", "s1"),
new MeasurementSchema("s1", TSDataType.INT32, TSEncoding.RLE));
writer.write(new TSRecord(1L, "d1").addTuple(new IntDataPoint("s1", 6)));
writer.close();
ReadOnlyTsFile readOnlyTsFile = new ReadOnlyTsFile(new
TsFileSequenceReader(file.getPath()));
List<Path> pathList = new ArrayList<>();
pathList.add(new Path("d1", "s1"));
QueryExpression queryExpression = QueryExpression.create(pathList, null);
QueryDataSet dataSet = readOnlyTsFile.query(queryExpression);
RowRecord record = dataSet.next();
assertEquals(1, record.getTimestamp());
assertEquals(6, record.getFields().get(0).getIntV());
assertFalse(dataSet.hasNext());
readOnlyTsFile.close();
assertTrue(file.delete());
}
{code}
> Coding Implementation doesn't correspond to the design
> ------------------------------------------------------
>
> Key: IOTDB-1042
> URL: https://issues.apache.org/jira/browse/IOTDB-1042
> Project: Apache IoTDB
> Issue Type: Bug
> Components: Core/TsFile
> Affects Versions: master branch, 0.10.1
> Reporter: weizihan
> Priority: Major
> Attachments: image-2020-12-07-16-54-24-032.png
>
>
> An empty file'll have a field "crashed" that is assigned "true" in
> org.apache.iotdb.tsfile.write.writer.RestorableTsFileIOWriter#RestorableTsFileIOWriter.
> However, according to the design docs, an empty file will have a field
> "crashed" that is assigned "false".
> !image-2020-12-07-16-54-24-032.png!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)