Skip to content

[to dev/1.3] Fix IndexOutOfBoundsException caused by concurrent sort and delete on TVList - #18390

Merged
JackieTien97 merged 1 commit into
dev/1.3from
fix/synchronize-tvlist-delete-with-sort-dev1.3
Aug 4, 2026
Merged

[to dev/1.3] Fix IndexOutOfBoundsException caused by concurrent sort and delete on TVList#18390
JackieTien97 merged 1 commit into
dev/1.3from
fix/synchronize-tvlist-delete-with-sort-dev1.3

Conversation

@shuwenwei

Copy link
Copy Markdown
Member

Cherry-pick of #18389 to dev/1.3.

Fix IndexOutOfBoundsException: Index 0 out of bounds for length 0 thrown in AlignedTVList.delete() when a DELETE races with a query that sorts the shared working TVList in place.

Make delete() / delete(column) / deleteColumn() of AlignedTVList and TVList.delete() synchronized on the same TVList instance as sort(). (AlignedTVList.deleteTime does not exist on dev/1.3, so that hunk is not applicable.)

… 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

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 44.29%. Comparing base (4ea4636) to head (f3481a3).
⚠️ Report is 20 commits behind head on dev/1.3.

Files with missing lines Patch % Lines
...he/iotdb/db/utils/datastructure/AlignedTVList.java 90.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JackieTien97
JackieTien97 merged commit 49d6dad into dev/1.3 Aug 4, 2026
16 of 17 checks passed
@JackieTien97
JackieTien97 deleted the fix/synchronize-tvlist-delete-with-sort-dev1.3 branch August 4, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants