Skip to content

fix(dms): normalize GaussDB db_type alias for db_services filter and UpdateDBService (#2877)#632

Closed
actiontech-bot wants to merge 1 commit into
mainfrom
feat-2877
Closed

fix(dms): normalize GaussDB db_type alias for db_services filter and UpdateDBService (#2877)#632
actiontech-bot wants to merge 1 commit into
mainfrom
feat-2877

Conversation

@actiontech-bot
Copy link
Copy Markdown
Member

Summary

配合 sqle-ee #2877 GaussDB TopSQL 任务,修复 DMS 侧两个串联 bug:

  • bug-Adb_services?filter_by_db_type=GaussDB 返回空。落库主形态为 "GaussDB / openGauss",前端用 "GaussDB" 过滤无法命中。修复:ListDBServices 处用 pkgConst.NormalizeDBType 归一
  • bug-CUpdateDBServiceunsupportedGetDriverParamsByDBTypeUpdateDBServiceByArgs 用调用方原值匹配。修复:两处都用 NormalizeDBType 做归一比较

新增 internal/dms/pkg/constant.NormalizeDBType 及单测,覆盖 GaussDB / openGauss alias 双向归一与其它 DBType passthrough。

关联 issue: actiontech/sqle-ee#2877

Test plan

  • go vet ./internal/dms/pkg/constant/... ./internal/dms/service/... 通过
  • go test ./internal/dms/pkg/constant/... -run TestNormalizeDBType 通过(8 个 case:alias-GaussDB / alias-openGauss / canonical-GaussDB / canonical-MySQL / PostgreSQL / DM / unknown / empty)
  • CE 分支仅含不带 _ee 后缀文件

…UpdateDBService (#2877)

修复 sqle-ee #2877 Batch 1 复测发现的两个串联 bug:

bug-A: db_services API 的 filter_by_db_type 入参与落库的主形态字面值不一致
  - DMS 落库使用主形态 "GaussDB / openGauss"(DBTypeGaussDB 常量)
  - SQLE plugin / driver_options 接口暴露给前端的字面值是 "GaussDB"
  - 前端按 "GaussDB" 调 db_services?filter_by_db_type=GaussDB → 返回空
  修复:在 internal/dms/service/db_service.go 的 filter_by_db_type 处加
       pkgConst.NormalizeDBType 归一

bug-C: UpdateDBService 校验 db_type 时不接受 alias
  - GetDriverParamsByDBType 用调用方原值匹配 driver_options.DBType,
    GaussDB 与 GaussDB / openGauss 都不能命中
  - UpdateDBServiceByArgs 还有一处 ds.DBType != updateDBService.DBType
    会因字面值不一致直接报 "update db service db type is unsupported"
  修复:在 GetDriverParamsByDBType 与 UpdateDBServiceByArgs 校验处
       都用 NormalizeDBType 做归一比较

新增 internal/dms/pkg/constant.NormalizeDBType + 单测,覆盖 GaussDB / openGauss
alias 双向归一与其它 DBType passthrough,避免字面值漂移再次拖垮上下游契约。

Refs #2877
@BugsGuru BugsGuru closed this May 26, 2026
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.

3 participants