Skip to content

feat(sql_workbench): support GaussDB / PostgreSQL whitelist + fix /odc_query proxy fallback#631

Open
actiontech-bot wants to merge 2 commits into
mainfrom
dev-865
Open

feat(sql_workbench): support GaussDB / PostgreSQL whitelist + fix /odc_query proxy fallback#631
actiontech-bot wants to merge 2 commits into
mainfrom
dev-865

Conversation

@actiontech-bot
Copy link
Copy Markdown
Member

Summary

CE 部分,CE/EE 拆分自 actiontech/dms-ee#865(ODC 工作台支持 GaussDB / openGauss 需求)。

  • internal/sql_workbench/service/sql_workbench_service.go
    • SupportDBType 白名单新增 DBTypeGaussDB + DBTypePostgreSQL(覆盖 EARS-1.2 / decision-3 → KF-2)
    • convertDBType 新增 "GaussDB" → "GAUSSDB" 映射(EARS-1.3 / CR-12 case-sensitivity)
    • 单元测试新增 GaussDB / PG family / GaussDBForMySQL 等用例
  • internal/apiserver/service/router.go
    • 修复 static 中间件 Skipper 漏过 /odc_query 前缀,导致 DMS SPA fallback 拦截 ODC umi index.html
    • 新增 HasPrefix(GetRootUri()) 跳过逻辑,恢复 /odc_query/* → ODC :8989 反向代理

Related Issue

Refs: actiontech/dms-ee#865

Test plan

  • go vet ./internal/sql_workbench/service/... ./internal/apiserver/service/... 通过
  • dev 阶段在 EE dev 分支已跑过 SqlWorkbenchService 单测(13 case convertDBType + SupportDBType GaussDB/PG family 一致性)
  • CI checker job 通过
  • 联调 Demo-1 / Demo-2(dev/web_test 阶段已覆盖)

…itelist

- SupportDBType: add DBTypeGaussDB + DBTypePostgreSQL to whitelist
  (EARS-1.2 / decision-3 positive coverage for KF-2)
- convertDBType: add "GaussDB" -> "GAUSSDB" mapping immediately after
  the existing "PostgreSQL" -> "POSTGRESQL" mapping (EARS-1.3 / CR-12
  case-sensitivity normalization)
- unit tests:
  - Test_convertDBType: new "GaussDB" case (13 total); existing
    "PostgreSQL" / "Unknown passthrough" regressed unchanged
  - Test_SupportDBType: flip "PostgreSQL" expected from false to true
    (decision-3 lock); new "GaussDB supported" + "GaussDBForMySQL
    unsupported" cases; existing SQL Server negative regression kept
  - Test_SupportDBType_GaussDB_PG_family_consistency: hard assertion
    PG family (PostgreSQL + GaussDB) whitelist coupling

Related: actiontech/dms-ee#865
The static middleware Skipper at internal/apiserver/service/router.go
only skipped /cloudbeaver, /provision/v, /sqle/v and /swagger paths.
Requests to /odc_query/ (with trailing slash), /odc_query/index.html
and any /odc_query/<spa-path> were intercepted by the DMS HTML5 SPA
fallback and got served as the DMS index.html (873B), instead of the
real ODC umi index.html (~11KB).

This broke the DMS UI 'SQL Workbench' entry whenever the link used
the trailing-slash form (`/odc_query/?dsId=...`). Without the fix
the browser landed on the DMS dashboard rather than the ODC SQL
workbench, even though API and subresource proxy targets at
`/odc_query/*` worked fine.

Add a HasPrefix check against
SqlWorkbenchController.SqlWorkbenchService.GetRootUri() (==/odc_query)
at the top of the Skipper so all `/odc_query` and `/odc_query/...`
requests bypass StaticConfig and reach the existing
ProxyWithConfig rewrite (`/odc_query/*` -> `/$1`) targeting ODC 8989.

Refs: dms-ee#865
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.

2 participants