feat(dms): support PolarDB For MySQL DBType in DMS (#826)#621
Merged
Conversation
…826)
为 PolarDB-MySQL 数据源接入 Provision 链路的 dms 端常量/解析支持:
- internal/dms/pkg/constant/const.go: DBType 常量段尾部追加
DBTypePolarDBForMySQL = "PolarDB For MySQL";ParseDBType switch
追加 "PolarDB For MySQL" → DBTypePolarDBForMySQL 分支(保留
原有大小写敏感比对约定,不引入 toLower)。
- internal/dms/pkg/constant/const_test.go: ParseDBType 测试表追加
happy case ("PolarDB For MySQL") 与错误路径 "PolarDB" 单独时
应返回 error。
字符串与 provision、dms-ee、SQLE 端 sqle-polardb-for-mysql-plugin
保持完全一致,确保 aggregateOptions(plugin.go:369-399)去重为一条。
设计:design §3.3 表第 2 行;§5 一致性校验。
Issue: actiontech/dms-ee#826
…kbench whitelist (#826) - internal/dms/biz/cloudbeaver.go:GenerateCloudbeaverConnectionParams switch 合入 constant.DBTypePolarDBForMySQL 到 MySQL / TDSQL 分支,复用 fillMySQLParams (driverId=mysql:mysql8 + properties.allowPublicKeyRetrieval=TRUE)。 fillMySQLParams 函数体未改动;其他 case / default 未改动。 - internal/sql_workbench/service/sql_workbench_service.go:convertDBType switch 末尾追加 `case "PolarDB For MySQL": return "MYSQL"`(design §7.2 字面量约定)。 - internal/sql_workbench/service/sql_workbench_service.go:SupportDBType 追加 `|| dbType == pkgConst.DBTypePolarDBForMySQL`(design §5 表第 7 行常量约束)。 兼容性:本变更对 design §10.1 R-2 / R-6 风险走 A 完全规避路径—— 所有新增分支均在 switch 末尾或 case 列表合并位追加,老 case 字面量、 返回值、default 行为未改动;CloudBeaver fillMySQLParams 函数体未改动; ODC convertDBType 字面量未替换为常量比对(保留 design §7.2 要求)。 详见 docs/dev/compat_risks.md compat-RISK-1 / compat-RISK-3。 注意:dms 侧 convertDBType 与 SupportDBType 含 GoldenDB 分支(历史代码), dms-ee 侧无;本期不对齐两侧已有差异,仅追加 PolarDB 同名分支。 Plan 子任务覆盖:3.3 / 3.5 / 3.6。
…GenerateCloudbeaverConnectionParams (#826) - internal/sql_workbench/service/sql_workbench_service_test.go:Test_convertDBType 追加 3 项 map case 覆盖 design §11.2 表 1:PolarDB For MySQL → MYSQL(happy)/ TDSQL For InnoDB → MYSQL(happy 回归)/ Unknown 透传(错误路径回归)。 - internal/sql_workbench/service/sql_workbench_service_test.go:Test_SupportDBType 追加 3 项 map case 覆盖 design §11.2 表 2:PolarDB → true(happy)/ MySQL → true(happy 回归)/ HANA → false(边界)。 - 新建 internal/dms/biz/cloudbeaver_test.go:Test_GenerateCloudbeaverConnectionParams_PolarDB 追加 3 项 map case 覆盖 design §11.2 表 4:PolarDB driverId=mysql:mysql8 / PolarDB allowPublicKeyRetrieval=TRUE / MySQL 回归 driverId 不变。 使用同包 noopLogger(op_permission_verify_test.go L113-116)构造最小 CloudbeaverUsecase 实例,无外部资源依赖。 执行结果:go test -vet=off -count=1 -run … 全部 PASS(3 + 6 项新增 case 全过)。 本提交属于 design §10.1 R-2 / R-6 兼容性风险(A 完全规避决策)的覆盖证据, 详见 docs/dev/compat_risks.md compat-RISK-1 / compat-RISK-3。 Plan 子任务覆盖:5.7 / 5.10。
BugsGuru
approved these changes
May 20, 2026
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨No code suggestions found for the PR. |
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.
User description
Fixes actiontech/dms-ee#826
概要
为 PolarDB-MySQL 数据源接入 Provision 账号权限管控链路的 dms(CE)端改动。
变更内容
internal/dms/pkg/constant/const.go:DBType 常量段尾部追加DBTypePolarDBForMySQL = "PolarDB For MySQL";ParseDBTypeswitch 追加分支。internal/dms/biz/cloudbeaver.go:CloudBeaver 数据源参数构造 /SupportDBType走 MySQL 协议路径。internal/sql_workbench/service/sql_workbench_service.go:convertDBType末尾追加"PolarDB For MySQL" → "MYSQL";SupportDBType增加dbType == pkgConst.DBTypePolarDBForMySQL判断。internal/dms/pkg/constant/const_test.go/internal/dms/biz/cloudbeaver_test.go/internal/sql_workbench/service/sql_workbench_service_test.go各自追加 PolarDB map case。兼容性
走 A 类完全规避:所有新增分支均在 switch 末尾或 case 列表合并位追加,老 case 字面量、返回值、default 行为未改动;CloudBeaver fillMySQLParams 函数体未改动;ODC convertDBType 字面量未替换为常量比对。详见 docs/dev/compat_risks.md compat-RISK-1 / compat-RISK-3。
测试结果
go test -vet=off -count=1 ./internal/dms/biz/ ./internal/dms/pkg/constant/ ./internal/sql_workbench/service/PASS关联 EE PR
EE 专有
_ee.go部分见 actiontech/dms-ee#843。Description
增加 PolarDB For MySQL 数据源支持
Cloudbeaver 参数生成复用 MySQL 逻辑
扩充 ParseDBType 与 SQLWorkbench 支持分支
添加单元测试验证新功能行为
Diagram Walkthrough
File Walkthrough
cloudbeaver.go
Cloudbeaver 新增 PolarDB 数据源支持internal/dms/biz/cloudbeaver.go
DBTypePolarDBForMySQL分支sql_workbench_service.go
SQLWorkbench 支持 PolarDB 更新internal/sql_workbench/service/sql_workbench_service.go
cloudbeaver_test.go
新增 Cloudbeaver PolarDB 测试internal/dms/biz/cloudbeaver_test.go
const_test.go
增加 ParseDBType PolarDB 测试internal/dms/pkg/constant/const_test.go
sql_workbench_service_test.go
SQLWorkbench 测试更新验证 PolarDBinternal/sql_workbench/service/sql_workbench_service_test.go