Fix delayed operator memory release after fragment termination - #18387
Open
Caideyipi wants to merge 1 commit into
Open
Fix delayed operator memory release after fragment termination#18387Caideyipi wants to merge 1 commit into
Caideyipi wants to merge 1 commit into
Conversation
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
Problem
Fragment-instance state listeners run on a shared bounded notification executor. The operator-memory estimate reserved by
LocalExecutionPlannerwas returned from one of those asynchronous listeners.A fragment can report a fast execution failure, such as a SELECT INTO type mismatch, while notification threads are still closing drivers for earlier fragments. Consecutive failures can therefore accumulate completed fragments' admission reservations and eventually fail with a false memory-insufficient error.
Design
FragmentInstanceStateMachine.addFinalStateChangeListenerfor short, non-blocking bookkeeping that must finish in the thread performing the terminal transition. It invokes each pre-registered listener exactly once and invokes late registrations immediately.DataNodeQueryContextcleanup to the same path.This fixes all fast fragment termination paths (finished, failed, canceled, and aborted), rather than special-casing SELECT INTO or increasing test memory.
Tests
mvn spotless:check -pl iotdb-core/datanodeFragmentInstanceStateMachineTestFragmentInstanceContextTestLocalExecutionPlannerOperatorsMemoryTestThe three unit-test classes pass 20 tests. The new regression test deliberately uses a notification executor that never runs and verifies that terminal bookkeeping and operator-memory release still complete synchronously.
This PR has:
Key changed/added classes
FragmentInstanceStateMachineFragmentInstanceContextLocalExecutionPlanner