Skip to content

fix: enable MongoDB external tables by default - #27157

Merged
mergify[bot] merged 6 commits into
matrixorigin:4.2-devfrom
iamlinjunhong:d-27108
Aug 20, 2026
Merged

mergify[bot] merged 6 commits into
matrixorigin:4.2-devfrom
iamlinjunhong:d-27108

Conversation

@iamlinjunhong

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #27108

What this PR does / why we need it:

fix: enable MongoDB external tables by default

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking finding:

  • [P1] Preserve programmatic MongoDB opt-out across repeated defaulting (pkg/config/configuration.go:318). DefaultMongoDBParameters() leaves enableConfigured == false, so an embedded caller that starts from newServiceConfig() and sets cfg.CN.Frontend.MongoDB.Enable = false through the public adjustment path has that opt-out overwritten to true when CN construction calls Frontend.SetDefaultValues() again (pkg/cnservice/server.go:125). I reproduced this on exact head ab375b0ed2e16c82450f07a45338d7ca70cc24be with the real lifecycle sequence: construct embedded config → set Enable=false → CN.SetDefaultValue(); the final assertion that it remains false fails. The TOML test only covers the private enableConfigured path and cannot catch this public API regression. Please backport the one-time/default-initialized state and the programmatic opt-out regression test from the final main implementation (and retain case-insensitive TOML presence handling), so later defaulting is idempotent.

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

新 head 的 Iceberg E2E 已完成并通过:run 32331887071、job 96313979577、attempt 1,Run local Nessie/MinIO/MO Iceberg E2E 与完整 job 均 success(8m23s)。原 run 32014540351 的 module metadata 错误已闭环。

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

@XuPeng-SH 本次维护 lane 已在 exact head dd429fe66d2da3298aafea6d6a3ef55745e5296d 重新核验 blocking review(原 review commit ab375b0ed2e16c82450f07a45338d7ca70cc24be):

  • 当前实现由 NewMongoDBParameters() 一次性建立 Enable=true / enableDefaulted=true;public Adjust 写入的 Enable=false 经 getCNServiceConfig → CN.SetDefaultValue → Frontend.SetDefaultValues 后仍保持 false。大小写不敏感的 TOML presence 与冲突 key 拒绝逻辑仍保留。
  • 本次 fresh 验证:mo-cgo-test 精确覆盖 pkg/config 5 个默认/显式关闭测试、pkg/embed 的真实生命周期测试,以及 cmd/mo-service、pkg/frontend、pkg/sql/mongodb、pkg/sql/plan 的直接行为测试,全部 exit 0;受控 CGo readonly build/vet 也 exit 0。
  • Iceberg 独立 module 的 go mod tidy -diff、readonly list/build/vet、-tags iceberggo full test 与 shell syntax 均 exit 0。
  • 当前 head 的 UT coverage job、MongoDB E2E 和 Iceberg E2E 已通过;exact-head checks 当前无失败,另有 4 个 job 仍在运行。

因此本轮无需新增代码改动;请基于当前 head 复审。

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

@XuPeng-SH exact head dd429fe66d2da3298aafea6d6a3ef55745e5296d 的最终维护核验已完成,烦请基于当前 head 复审:

  • 原 blocking review 已由与 up/main 最终实现同构的一次性默认状态闭环:NewMongoDBParameters() 建立 Enable=true / enableDefaulted=true,public Adjust(Enable=false) 经 getCNServiceConfig → CN.SetDefaultValue → Frontend.SetDefaultValues 后仍保持 false;大小写不敏感 TOML presence 与冲突 key 拒绝仍在。
  • 本次 fresh mo-dev 验证:6 个目标 package 的 readonly go list 非空;focused mo-cgo-test 覆盖 config 5 个默认/显式关闭测试、embedded public lifecycle、mo-service/frontend/SQL MongoDB/planner 消费路径,命令 exit 0。Iceberg adapter 的 go mod tidy -diff 与 go test -tags iceberggo -count=1 ./...、shell syntax 也 exit 0。
  • run 32331886226 attempt 1 的 PESSIMISTIC BVT(job 96315002178)稳定签名是 system_variables.sql 的 drop account acc_idx 无返回,Coverage(job 96321280507)仅因 prerequisites_ready=false 派生失败;同一 exact head 的 attempt 2 已正式 success:PESSIMISTIC job 96329055488 success,Coverage job 96336138290 success,整个 run conclusion success。
  • 当前 exact-head check rollup 无失败,PR MERGEABLE、无 inline thread;因此无需新增代码或 push。

@aunjgr aunjgr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head dd429fe. One-time MongoDB default initialization makes repeated defaulting idempotent and preserves the public embedded programmatic opt-out. TOML explicit false and case-variant handling are covered, runtime enablement defaults consistently across production constructors, and endpoint access remains fail-closed without allowlists. The independent Iceberg module metadata and tidy gate are consistent. No blocking findings.

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

@XuPeng-SH fresh maintenance verification on exact head dd429fe66d2da3298aafea6d6a3ef55745e5296d confirms the blocking finding from old review commit ab375b0ed2e16c82450f07a45338d7ca70cc24be is resolved: NewMongoDBParameters() establishes the one-time Enable=true / enableDefaulted=true state, and public Adjust(Enable=false) remains false through getCNServiceConfig → CN.SetDefaultValue → Frontend.SetDefaultValues. The implementation matches the current up/main state machine, while case-insensitive TOML presence and conflicting-key rejection remain covered. Fresh mo-dev validation passed: focused regressions across pkg/config, pkg/embed, cmd/mo-service, pkg/frontend, pkg/sql/mongodb, and pkg/sql/plan; full CGo-controlled suites for all six packages; make build; controlled vet; and Iceberg adapter go mod tidy -diff, readonly list/build/vet, and full -tags iceberggo test. All commands exited 0. The exact-head rollup now has 27 completed checks, no failures or in-progress checks; PR is MERGEABLE and has no inline threads. No code change or push was needed in this lane. Please re-review the current head.

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

@XuPeng-SH 对旧 review commit ab375b0ed2e16c82450f07a45338d7ca70cc24be 的 blocking finding 已在当前 exact head dd429fe66d2da3298aafea6d6a3ef55745e5296d 完整闭环,烦请重新审阅:

  • NewMongoDBParameters() 预先建立 Enable=true / enableDefaulted=true,因此 public Adjust(Enable=false) 经 getCNServiceConfig → CN.SetDefaultValue → Frontend.SetDefaultValues 后仍保持 false;TestMongoDBProgrammaticOptOutSurvivesCNDefaulting 覆盖了该真实 lifecycle。大小写不敏感 TOML presence 与冲突 key 拒绝测试仍在。
  • 本轮 fresh mo-dev 验证:六个 owning package 的精确回归与 full CGo-controlled suites 均 exit 0;受控 build/vet 以及 Iceberg adapter 的 tidy -diff、readonly list/build/vet/full test、shell syntax 均 exit 0。
  • GitHub exact-head rollup 为 27 个 completed checks,0 failure、0 in-progress;PR 当前 MERGEABLE、无 inline thread。up/main 最新实现仍采用相同的一次性默认状态机。

因此无需新增代码或 push;本次仅针对仍挂起的旧 review 提供当前 head 证据。

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

@XuPeng-SH 对 review 4949798213 的 blocking finding 已在当前 exact head dd429fe66d2da3298aafea6d6a3ef55745e5296d 解决:

  • NewMongoDBParameters() 初始化 Enable=true 和 enableDefaulted=true(pkg/config/configuration.go:294-295);SetDefaultValues() 仅在两者均未建立时写默认值,因此 public Adjust(Enable=false) 不会在后续 CN defaulting 被重写。
  • TestMongoDBProgrammaticOptOutSurvivesCNDefaulting(pkg/embed/config_test.go:207)覆盖了所述 newServiceConfig → Adjust → getCNServiceConfig → CN.SetDefaultValue → Frontend.SetDefaultValues 实际生命周期;另有 repeated-defaulting 回归测试。
  • 当前 exact-head 27 个检查均已完成且无失败;UT Coverage、MongoDB E2E 与 Iceberg E2E 都为 success。

因此该 finding 不再适用于当前 head,烦请基于此版本重新审阅。

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

@XuPeng-SH 针对 review 4949798213 再次核验当前 exact head dd429fe66d2da3298aafea6d6a3ef55745e5296d:

  • NewMongoDBParameters() 已建立一次性 Enable=true / enableDefaulted=true 状态,之后 public Adjust(Enable=false) 经 getCNServiceConfig → CN.SetDefaultValue → Frontend.SetDefaultValues 不会再被覆盖。
  • TestMongoDBProgrammaticOptOutSurvivesCNDefaulting 覆盖该真实 embedded 生命周期;本维护 lane 刚以 mo-dev CGo 受控命令重跑,exit 0。配置层的显式 false、重复 defaulting、大小写 key 与冲突 key 回归也均 exit 0。
  • 当前 head 无 inline review thread,PR 仍 MERGEABLE,且 exact-head check rollup 没有失败。

因此原 finding 仅适用于其引用的旧提交;请基于当前 head 重新审阅。

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

@XuPeng-SH Fresh verification on exact head dd429fe: the blocking finding applies to ab375b0, not the current implementation. NewMongoDBParameters establishes Enable=true and enableDefaulted=true, so public Adjust(Enable=false) remains false through getCNServiceConfig, CN.SetDefaultValue, and Frontend.SetDefaultValues.

Using the repository controlled CGo test wrapper, the real embedded lifecycle regression and five configuration regressions (default, explicit disable, repeated defaulting, case-insensitive key, conflicting key) all passed with exit 0. The current PR is MERGEABLE with no inline threads and no failed checks. No additional code change is needed; please re-review the current head.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head dd429fe. The previous programmatic opt-out blocker is closed: MongoDB enablement is initialized before TOML/programmatic mutation, repeated defaulting is idempotent, and the real mo-service/embed lifecycle preserves an explicit false. Case-insensitive TOML variants and conflicting keys are covered. Default SQL enablement remains fail-closed at the network endpoint policy. Focused config, service, embed, frontend, MongoDB runtime, planner, and Iceberg module checks pass.

@iamlinjunhong

Copy link
Copy Markdown
Contributor Author

@XuPeng-SH fresh maintenance verification on exact head dd429fe66d2da3298aafea6d6a3ef55745e5296d: the blocking finding applies to old review commit ab375b0ed2e16c82450f07a45338d7ca70cc24be, not the current implementation.

  • NewMongoDBParameters() establishes Enable=true / enableDefaulted=true; a public Adjust(Enable=false) remains false through getCNServiceConfig → CN.SetDefaultValue → Frontend.SetDefaultValues.
  • Fresh controlled CGo regressions passed: five pkg/config defaulting/explicit-disable/case-variant tests, plus pkg/embed TestMongoDBProgrammaticOptOutSurvivesCNDefaulting covering the actual embedded lifecycle.
  • I fetched current up/main (94528dcb63d55921b936cda611ea61eb1862ea79) and verified it uses the same one-time defaulting state machine. Current exact-head checks are all successful and there are no inline review threads.

No further code change is warranted; please re-review the current head.

@mergify mergify Bot added the queued label Aug 20, 2026
@mergify

mergify Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-20 10:03 UTC · Rule: release-4.2 · triggered by rule Automatic queue on approval for release-4.2
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-08-20 11:11 UTC · at ca04b50974670bc4fcf0a4bf6f4ced5d853a8a2e · squash

This pull request spent 1 hour 7 minutes 58 seconds in the queue, including 1 hour 7 minutes 14 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)

@mergify
mergify Bot merged commit 7790853 into matrixorigin:4.2-dev Aug 20, 2026
27 of 28 checks passed
@mergify mergify Bot removed the queued label Aug 20, 2026
@iamlinjunhong
iamlinjunhong deleted the d-27108 branch August 23, 2026 17:13

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants