There's a chance that KvStoreInfoPB.parent_data_compacted get updated while parent's SST files are still being compacted. Consider the following scenario:
1) Parent tablet is split
2) First child tablet is opening and starting post split compaction
3) Second child tablet is opening and is waiting for a free slot to run post split compaction (by default only 1 manual compaction can be run on a tserver, post split compaction is a type of manual compaction)
4) Background compaction is actively running for the second tablet
5) First child's post split compaction is done, its parent_data_compacted is changed to true
6) Second child's post split compaction is starting, but background compaction has taken all the SST files and is still running
7) Second child's post split compaction sees there are no files to take and finished post split compaction with changing parent_data_compacted to true
8) Tablet splitting is triggered for a second child while background compaction with parent's SST files is still running, but second child sees parent_data_compacted is true and starts splitting.
Side effect of the second split with the uncompacted data could result in non-optimal middle key for the second split (split of a second child), in worse case one of second child's children can be empty and parent's files got referenced longer.
Warning: Please confirm that this issue does not contain any sensitive information
[X] I confirm this issue does not contain any sensitive information.
Jira Link: DB-8029
Description
There's a chance that KvStoreInfoPB.parent_data_compacted get updated while parent's SST files are still being compacted. Consider the following scenario: 1) Parent tablet is split 2) First child tablet is opening and starting post split compaction 3) Second child tablet is opening and is waiting for a free slot to run post split compaction (by default only 1 manual compaction can be run on a tserver, post split compaction is a type of manual compaction) 4) Background compaction is actively running for the second tablet 5) First child's post split compaction is done, its
parent_data_compacted
is changed totrue
6) Second child's post split compaction is starting, but background compaction has taken all the SST files and is still running 7) Second child's post split compaction sees there are no files to take and finished post split compaction with changingparent_data_compacted
totrue
8) Tablet splitting is triggered for a second child while background compaction with parent's SST files is still running, but second child seesparent_data_compacted
istrue
and starts splitting.Side effect of the second split with the uncompacted data could result in non-optimal middle key for the second split (split of a second child), in worse case one of second child's children can be empty and parent's files got referenced longer.
Warning: Please confirm that this issue does not contain any sensitive information