fix(dms): normalize GaussDB db_type alias for db_services filter and UpdateDBService (#2877)#632
Closed
actiontech-bot wants to merge 1 commit into
Closed
fix(dms): normalize GaussDB db_type alias for db_services filter and UpdateDBService (#2877)#632actiontech-bot wants to merge 1 commit into
actiontech-bot wants to merge 1 commit into
Conversation
…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
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.
Summary
配合 sqle-ee #2877 GaussDB TopSQL 任务,修复 DMS 侧两个串联 bug:
db_services?filter_by_db_type=GaussDB返回空。落库主形态为"GaussDB / openGauss",前端用"GaussDB"过滤无法命中。修复:ListDBServices处用pkgConst.NormalizeDBType归一UpdateDBService报unsupported。GetDriverParamsByDBType和UpdateDBServiceByArgs用调用方原值匹配。修复:两处都用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)_ee后缀文件