[Hotfix][ams] Fix ResourceMapper.selectResourcesByGroup result mapping#4194
Merged
zhoujinsong merged 1 commit intoApr 21, 2026
Merged
Conversation
The @Result property names did not match the fields on Resource: - group -> groupName - container -> containerName - totalMemory -> memoryMb The start_time column and its @Result mapping were removed because Resource has no startTime field; MyBatis would silently drop it anyway. This method is currently only declared/implemented via DefaultOptimizerManager.listResourcesByGroup with no caller on master, so no behavioral change is observable. Fixing it now unblocks any future caller (e.g. auto-restart feature) from getting back empty-field Resource objects.
zhoujinsong
approved these changes
Apr 21, 2026
Contributor
zhoujinsong
left a comment
There was a problem hiding this comment.
The fix is correct and minimal.
All three @Result property names now match the actual fields on Resource (groupName, containerName, memoryMb), and the stale start_time mapping is correctly removed since Resource has no startTime field.
One minor note for future reference: the start_time column still exists in the DB schema (populated by DEFAULT CURRENT_TIMESTAMP) but has no corresponding field in Resource — this is intentional and the exclusion from result mapping is correct. Worth keeping in mind if the schema is ever revisited.
LGTM.
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.
What changes were proposed in this pull request?
Fix the
@Resultannotations onResourceMapper.selectResourcesByGroupso that the property names actually match the fields onResource:propertypropertygroup_namegroupgroupNamecontainer_namecontainercontainerNametotal_memorytotalMemorymemoryMbAlso drop the
start_timecolumn from theSELECTlist and remove its@Resultentry.Resourcehas nostartTimefield, so the mapping was silently discarded — keeping the column in the projection added no value.Why are the changes needed?
These mapping names have never matched the target class. Currently
DefaultOptimizerManager.listResourcesByGroupis the only path that calls this mapper, and it has no caller onmaster, so the bug was latent. Any future caller (e.g. the auto-restart optimizer feature under development) that starts using this method would get backResourceinstances withnull/0values ingroupName,containerName, andmemoryMb. Fixing it as a standalone change keeps the diff minimal and makes it safe to cherry-pick.Does this PR introduce any user-facing change?
No.
How was this patch tested?
selectResourcesByGroup/listResourcesByGroupexists on master besides the declaration itself, so the change cannot regress existing behavior.mvn spotless:applypasses.