[AMORO-4103] Release table runtime when the group name is changed to a non-existent resource group#4104
Open
xxubai wants to merge 6 commits intoapache:masterfrom
Open
[AMORO-4103] Release table runtime when the group name is changed to a non-existent resource group#4104xxubai wants to merge 6 commits intoapache:masterfrom
xxubai wants to merge 6 commits intoapache:masterfrom
Conversation
…t resource group. Improve handling of orphaned PLANNING/PENDING tables
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4104 +/- ##
============================================
- Coverage 22.44% 22.44% -0.01%
Complexity 2552 2552
============================================
Files 458 458
Lines 42022 42036 +14
Branches 5915 5917 +2
============================================
Hits 9433 9433
- Misses 31777 31791 +14
Partials 812 812
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
j1wonpark
reviewed
Mar 4, 2026
Contributor
j1wonpark
left a comment
There was a problem hiding this comment.
Thanks for the fix! The loadOptimizingQueues change makes sense to me. I have a question about the handleConfigChanged part.
amoro-ams/src/main/java/org/apache/amoro/server/DefaultOptimizingService.java
Outdated
Show resolved
Hide resolved
j1wonpark
approved these changes
Mar 6, 2026
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.
When a table's optimizer group configuration is changed (e.g., from "old_group" to "default"), if the AMS restarts before the optimizing process is properly closed, the table runtime may remain stuck in
PENDINGstatus forever. This happens in two scenarios:oadOptimizingQueues, tables whose persisted optimizer group no longer exists are left in a groupToTableRuntimes map but never released — the previous code only logged a warning without taking any corrective action.handleConfigChangedis triggered and the table's new optimizer group does not exist, there is no fallback to release the table's optimizing process, causing it to hang indefinitely.Why are the changes needed?
Close #4103.
Brief change log
DefaultOptimizingService.loadOptimizingQueues(): Replaced the original logic that merely logged a warning for unloaded table runtimes in non-existent groups. Now, tables inPLANNINGorPENDINGstatus whose resource group does not exist are actively released back toIDLEviacompleteEmptyProcess().DefaultOptimizingService.ConfigChangeHandler.handleConfigChanged(): After refreshing the table in the new group's queue, added logic to release the table from the queue. If the new group's queue does not exist,completeEmptyProcess()is called directly on the table runtime to prevent it from being stuck.TestOptimizingQueue: Added two new test cases:testReleaseOrphanedPlanningTableOnRestart: Verifies that a table persisted withPLANNINGstatus in a non-existent group is correctly released toIDLEduring AMS restart.testReleaseOrphanedPendingTableOnRestart: Verifies the same behavior for tables persisted withPENDINGstatus.simulateLoadOptimizingQueuesForNonExistentGroup()to simulate theloadOptimizingQueueslogic in tests.TestDefaultOptimizingService: Added two new test cases:testHandleConfigChangedGroupChanged: Verifies that when the optimizer group changes to a different existing group, the table is properly released from both old and new queues without exceptions.testHandleConfigChangedGroupNotExist: Verifies that when the optimizer group changes to a non-existent group,completeEmptyProcess()is called on the table runtime.How was this patch tested?
Add some test cases that check the changes thoroughly including negative and positive cases if possible
Add screenshots for manual tests if appropriate
Run test locally before making a pull request
Documentation