Repository navigation
[Fix] Preserve query memory registrations during stale fragment cleanup - #18834
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18834 +/- ##
============================================
- Coverage 45.91% 45.90% -0.01%
Complexity 712 712
============================================
Files 5502 5502
Lines 398764 398776 +12
Branches 51963 51968 +5
============================================
- Hits 183090 183070 -20
- Misses 215674 215706 +32 ☔ 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.
Description
A delayed fragment cleanup can retain an old query-memory map while another fragment removes the last registration and a later fragment creates a replacement map. Removing the outer entry by query ID alone then deletes the replacement, causing
MemoryPool.free()to fail when buffered results are consumed.Only remove the outer entry when it still references the map being cleaned up. The identity check stays inside the existing registration lock, while memory-usage checks remain outside it.
Add a deterministic concurrent regression test that pauses an empty fragment's cleanup at the registration lock, replaces the query map, and verifies that the new reservation survives and can be freed. Additional tests cover missing fragments, other active fragments, deferred and repeated cleanup, and forced memory-leak reporting.
Validation
expected:<1> but was:<0>because the replacement registration is removed.MemoryPoolTest(27 tests) andSharedTsBlockQueueTest(2 tests).mvn clean test -Dtest=MemoryPoolTest,SharedTsBlockQueueTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=falsemvn test-compile -DskipTests -P with-zh-localeIoTDBTableViewQueryITpassed all four aligned/flush combinations in a clean worktree:mvn clean verify -DskipUTs -Dit.test=IoTDBTableViewQueryIT -DfailIfNoTests=false -Dfailsafe.failIfNoSpecifiedTests=false -DDataNodeMaxHeapSize=1024 -DintegrationTest.forkCount=1 -pl integration-test -am -P with-integration-tests -P TableSimpleITgit diff --checkpassed.Checklist
Key changed classes
MemoryPoolMemoryPoolTest