Skip to content

feat(sql_workbench): sync mongodb datasource metadata to ODC (#2902)#633

Merged
iwanghc merged 2 commits into
mainfrom
dev/issue-2902-mongodb-odc-ce
May 28, 2026
Merged

feat(sql_workbench): sync mongodb datasource metadata to ODC (#2902)#633
iwanghc merged 2 commits into
mainfrom
dev/issue-2902-mongodb-odc-ce

Conversation

@LordofAvernus
Copy link
Copy Markdown
Collaborator

@LordofAvernus LordofAvernus commented May 28, 2026

User description

关联的 issue

link https://github.com/actiontech/dms-ee/pull/869

描述你的变更

确认项(pr提交后操作)

Tip

请在指定复审人之前,确认并完成以下事项,完成后✅


  • 我已完成自测
  • 我已记录完整日志方便进行诊断
  • 我已在关联的issue里补充了实现方案
  • 我已在关联的issue里补充了测试影响面
  • 我已确认了变更的兼容性,如果不兼容则在issue里标记 not_compatible
  • 我已确认了是否要更新文档,如果要更新则在issue里标记 need_update_doc


Description

  • 支持 MongoDB 数据源同步

  • 映射连接参数至 JDBC 参数

  • 优化错误返回包含响应详情

  • 增加 MongoDB 参数构造测试


Diagram Walkthrough

flowchart LR
  const["\"internal/dms/pkg/constant/const.go\""]
  const_test["\"internal/dms/pkg/constant/const_test.go\""]
  client["\"internal/sql_workbench/client/sql_workbench_client.go\""]
  service["\"internal/sql_workbench/service/sql_workbench_service.go\""]
  service_test["\"internal/sql_workbench/service/sql_workbench_service_test.go\""]
  
  const -- "提供 MongoDB 支持" --> service
  const_test -- "验证 MongoDB 类型" --> service_test
  client -- "优化错误处理" --> service
  service -- "增强数据构建逻辑" --> service_test
Loading

File Walkthrough

Relevant files
Enhancement
const.go
添加 MongoDB 类型支持                                                                                   

internal/dms/pkg/constant/const.go

  • 添加 MongoDB 数据源类型解析
  • 更新 DB 类型常量定义
+3/-0     
sql_workbench_service.go
强化数据源构建及参数映射                                                                                         

internal/sql_workbench/service/sql_workbench_service.go

  • 添加 Properties 与 JDBCParams 字段
  • 对 MongoDB 数据源构建进行处理
  • 引入辅助接口转换函数
+94/-21 
Tests
const_test.go
更新测试验证 MongoDB                                                                                     

internal/dms/pkg/constant/const_test.go

  • 调整现有测试格式
  • 验证 MongoDB 数据源处理
+26/-25 
sql_workbench_service_test.go
增加 MongoDB 测试用例                                                                                   

internal/sql_workbench/service/sql_workbench_service_test.go

  • 新增 MongoDB 参数构造测试
  • 更新转换及支持性测试用例
+77/-18 
Bug fix
sql_workbench_client.go
优化 HTTP 错误响应处理                                                                                     

internal/sql_workbench/client/sql_workbench_client.go

  • 修改错误信息输出
  • 返回响应详细信息
+1/-1     

@actiontech-bot
Copy link
Copy Markdown
Member

没有在复审记录中找到这个MR => https://github.com/actiontech/dms-ee/pull/869

1 similar comment
@actiontech-bot
Copy link
Copy Markdown
Member

没有在复审记录中找到这个MR => https://github.com/actiontech/dms-ee/pull/869

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

PR Reviewer Guide 🔍

(Review updated until commit 9daab0f)

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
保证 TLS 配置传递

建议调整 buildMongoDatasourceOptions 中 tlsEnabled 参数的赋值逻辑,以确保即使其他属性为空时,TLS 设置也能被正确传递。可以将
tlsEnabled 的赋值移出条件判断,然后在最后根据 properties 是否为空来决定是否返回 nil,从而避免因遗漏 TLS 配置导致连接参数错误。

internal/sql_workbench/service/sql_workbench_service.go [1012-1014]

-if len(properties) > 0 {
-    properties["tlsEnabled"] = dbService.AdditionalParams.GetParam(mongoTLSEnabledParam).Bool()
+properties["tlsEnabled"] = dbService.AdditionalParams.GetParam(mongoTLSEnabledParam).Bool()
+if len(properties) == 0 {
+    properties = nil
 }
Suggestion importance[1-10]: 2

__

Why: The suggestion proposes moving the TLS assignment out of the conditional, but the improved code is logically inconsistent—after unconditionally adding "tlsEnabled", the subsequent check for an empty map will never be true, which could introduce unintended behavior.

Low

Remove MongoDB from SupportDBType so datasources are retained without
provision accounts. Map connection params to jdbcUrlParameters that ODC
actually reads instead of unused properties, and add TLS-only test.
@actiontech-bot
Copy link
Copy Markdown
Member

没有在复审记录中找到这个MR => https://github.com/actiontech/dms-ee/pull/869

@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 9daab0f

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@LordofAvernus LordofAvernus requested a review from iwanghc May 28, 2026 03:20
@iwanghc iwanghc merged commit f26bb6f into main May 28, 2026
1 check passed
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