[IOTDB-2723] Fix sequence inner space compaction lose data#5248
Merged
JackieTien97 merged 1 commit intoapache:masterfrom Mar 15, 2022
Merged
[IOTDB-2723] Fix sequence inner space compaction lose data#5248JackieTien97 merged 1 commit intoapache:masterfrom
JackieTien97 merged 1 commit intoapache:masterfrom
Conversation
|
Coverage decreased (-0.001%) to 65.705% when pulling 765c612 on THUMarkLau:IOTDB-2723 into c3d34b6 on apache:master. |
JackieTien97
approved these changes
Mar 15, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When executing inner space compaction for sequence files, the chunks of a series are read into memory one by one, and the program uses three ways to determine how to process a chunk:
Of course, these are rough descriptions. When the program reads a chunk that satisfies the condition of deserialization, if there is already a cached chunk in memory, the program will deserialize the cached chunk into chunk writer first, after which the freshly read chunk will be deserialized. Before the program deserializes the cached chunk, it will call the
flipfunction of the cached chunk to make sure the chunk reader can read it correctly. However, in some cases, the cached chunk is the first cached chunk, which means it is a chunk directly read from TsFile usingreadMemChunkfunction inTsFileSequenceReader, and hasn't merged with any chunk yet. The chunk read byreadMemChunkhas already calledflipfunction, while the chunk generated bymergeChunkhasn't. The program only needs to call theflipfunction for the later. So if the program call theflipfunction for the former, theflipfunction is called twice actually, which accounts for the error of variablepositionandlimitin the data buffer of the chunk. Consequently, the chunk reader cannot read the data in the cached chunk correctly and the data is lost.This bug actually has nothing to do with deletion