[to dev/1.3] Fix IndexOutOfBoundsException caused by concurrent sort and delete on TVList - #18390
Merged
JackieTien97 merged 1 commit intoAug 4, 2026
Conversation
… TVList
A query may sort the shared working TVList in place while a DELETE is
running on the same list. sort() is synchronized, but the delete methods
(AlignedTVList.delete/deleteTime/delete(column)/deleteColumn and
TVList.delete) were not, so the delete thread could observe the
half-rebuilt indices during sort and throw IndexOutOfBoundsException
("Index 0 out of bounds for length 0") or silently delete wrong rows.
Synchronize the delete methods with sort() on the same TVList instance,
consistent with putAlignedValue/clone/cloneForFlushSort which are already
synchronized. The runtime delete path always holds
TsFileProcessor.flushQueryLock.writeLock() before touching the TVList, so
the lock order (flushQueryLock -> tvlist monitor) stays consistent with
the query path and no deadlock is introduced.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev/1.3 #18390 +/- ##
=============================================
+ Coverage 43.90% 44.29% +0.38%
Complexity 198 198
=============================================
Files 3633 3634 +1
Lines 244681 245511 +830
Branches 29893 30045 +152
=============================================
+ Hits 107431 108741 +1310
+ Misses 137250 136770 -480 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Cherry-pick of #18389 to dev/1.3.
Fix
IndexOutOfBoundsException: Index 0 out of bounds for length 0thrown inAlignedTVList.delete()when a DELETE races with a query that sorts the shared working TVList in place.Make
delete()/delete(column)/deleteColumn()ofAlignedTVListandTVList.delete()synchronized on the same TVList instance assort(). (AlignedTVList.deleteTimedoes not exist on dev/1.3, so that hunk is not applicable.)