tsfile icon indicating copy to clipboard operation
tsfile copied to clipboard

How to append content to an existing tsFile?

Open Block2 opened this issue 6 years ago • 5 comments

I have a question, After I first wrote the content to tsFile, and executed the tsFile. Close () operation, how can I append other content to this tsFile file next time? And it make sure that the content I have inserted previous twice is available. please !

Block2 avatar Apr 10 '18 02:04 Block2

@xingtanzjr can you answer the question?

jixuan1989 avatar Apr 10 '18 08:04 jixuan1989

  1. The design of Tsfile is: once been finished, never modify it. So, once you close a tsfile, you cannot append anything any more.

  2. The sentence And it make sure that the content I have inserted previous twice is available confuses me, what do you mean?

Besides, tsfile API has no ability to help you to sort data in the time order, or filter duplicate timestamps. Users must make sure that they writing data by the time order. Otherwise the query result is undefined. If your application may generate data out-of-time-order, you can use IoTDB with SQL, then you do not need to consider the out-of-order problem. You can download IoTDB from http://tsfile.org

jixuan1989 avatar Apr 10 '18 09:04 jixuan1989

It means that the previous two inserted data can be queried. Now, The query action occurs after the tsfile.close () action. It means I can't append data into this tsFile any more while a query action occurs. Is the query action only available for a finished file?

Block2 avatar Apr 10 '18 09:04 Block2

Thanks for your answer, it is practical for my problem.

Block2 avatar Apr 10 '18 09:04 Block2

It means that the previous two inserted data can be queried. Now, The query action occurs after the tsfile.close () action. It means I can't append data into this tsFile any more while a query action occurs. Is the query action only available for a finished file?

Yes. If you want to query without closing the TsFile, you have to use IoTDB (which supports read data from an opened TsFile)

jixuan1989 avatar Apr 12 '18 13:04 jixuan1989