fix: add missing instance_state mapping to instance_info BaseResultMap - #7015
Open
dmsolr wants to merge 2 commits into
Open
fix: add missing instance_state mapping to instance_info BaseResultMap#7015dmsolr wants to merge 2 commits into
dmsolr wants to merge 2 commits into
Conversation
#6873) BaseResultMap in instance-info-sqlmap.xml mapped id/date_created/date_updated/instance_ip/instance_port/instance_type/instance_info/namespace_id but not instance_state, even though Base_Column_List includes it and insert/updateById write it. Every resultMap-based SELECT (selectAll, findAllByNamespaceId, selectByQuery) returned instanceState = null for rows with a non-null state, which is the upstream root cause of InstanceCheckService null-state autoboxing NPEs. Also removed the duplicated date_created/date_updated entries in Base_Column_List. Added assertions in InstanceInfoMapperTest to verify instanceState round-trips through the resultMap-based queries.
dmsolr
requested review from
Aias00
and
a lite review from Copilot
and removed request for
Aias00
August 31, 2026 08:15
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes missing MyBatis resultMap coverage for instance_state in the instance_info mapper, which previously caused instanceState to deserialize as null for resultMap-based queries and contributed to downstream null-state handling issues.
Changes:
- Added
instance_state -> instanceStatemapping toBaseResultMapininstance-info-sqlmap.xml. - Removed duplicated
date_created/date_updatedentries fromBase_Column_List. - Extended
InstanceInfoMapperTestto assertinstanceStateround-trips correctly for resultMap-based SELECTs (selectAll,findAllByNamespaceId,selectByQuery).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| shenyu-admin/src/main/resources/mappers/instance-info-sqlmap.xml | Adds missing instance_state mapping to BaseResultMap and de-duplicates Base_Column_List to ensure resultMap-based queries populate instanceState. |
| shenyu-admin/src/test/java/org/apache/shenyu/admin/mapper/InstanceInfoMapperTest.java | Adds assertions to verify instanceState is returned correctly through resultMap-based query methods. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
yu199195
reviewed
Aug 31, 2026
| instance_state, | ||
| namespace_id, | ||
| date_created, | ||
| date_updated |
Member
There was a problem hiding this comment.
date_created and date_updated remove?
Member
Author
There was a problem hiding this comment.
Removed the duplicate date_created/date_updated entries from Base_Column_List.
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 is the purpose of the change
Fixes #6873.
BaseResultMapininstance-info-sqlmap.xmlmapped id/date_created/date_updated/instance_ip/instance_port/instance_type/instance_info/namespace_id but notinstance_state, even thoughBase_Column_Listincludesinstance_stateandinsert/updateByIdwrite it. Every resultMap-based SELECT (selectAll,findAllByNamespaceId,selectByQuery) returnedinstanceState = nullfor rows with a non-null state. (selectById/selectOneByQueryuseresultTypeauto-mapping and were unaffected.) This is the upstream root cause of theInstanceCheckServicenull-state autoboxing NPEs referenced in #6706.Base_Column_Listalso listeddate_created/date_updatedtwice — a copy-paste defect.Changes
<result column="instance_state" jdbcType="INTEGER" property="instanceState"/>toBaseResultMap.date_created/date_updatedentries fromBase_Column_List.InstanceInfoMapperTest(selectAll,findAllByNamespaceId,selectByQuery) to assertinstanceStateround-trips correctly through the resultMap-based queries.Does this PR introduce a user-facing change?
No.