Skip to content

fix: add missing instance_state mapping to instance_info BaseResultMap - #7015

Open
dmsolr wants to merge 2 commits into
masterfrom
fix/instance-info-resultmap-6873
Open

fix: add missing instance_state mapping to instance_info BaseResultMap#7015
dmsolr wants to merge 2 commits into
masterfrom
fix/instance-info-resultmap-6873

Conversation

@dmsolr

@dmsolr dmsolr commented Aug 31, 2026

Copy link
Copy Markdown
Member

What is the purpose of the change

Fixes #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 instance_state and insert/updateById write it. Every resultMap-based SELECT (selectAll, findAllByNamespaceId, selectByQuery) returned instanceState = null for rows with a non-null state. (selectById/selectOneByQuery use resultType auto-mapping and were unaffected.) This is the upstream root cause of the InstanceCheckService null-state autoboxing NPEs referenced in #6706.

Base_Column_List also listed date_created/date_updated twice — a copy-paste defect.

Changes

  • Added <result column="instance_state" jdbcType="INTEGER" property="instanceState"/> to BaseResultMap.
  • Removed the duplicate date_created/date_updated entries from Base_Column_List.
  • Extended InstanceInfoMapperTest (selectAll, findAllByNamespaceId, selectByQuery) to assert instanceState round-trips correctly through the resultMap-based queries.

Does this PR introduce a user-facing change?

No.

#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
dmsolr requested review from Aias00 and a lite review from Copilot and removed request for Aias00 August 31, 2026 08:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 -> instanceState mapping to BaseResultMap in instance-info-sqlmap.xml.
  • Removed duplicated date_created / date_updated entries from Base_Column_List.
  • Extended InstanceInfoMapperTest to assert instanceState round-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.

instance_state,
namespace_id,
date_created,
date_updated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

date_created and date_updated remove?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the duplicate date_created/date_updated entries from Base_Column_List.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] discovery selectBySelectorNameAndPluginName references non-existent s.name column

3 participants