Repository navigation
[4.2-dev] fix(frontend): scope system catalogue compatibility lookups - #29665
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Checked the Iceberg E2E red job: At 08:49:24 UTC, local dependency setup fails pulling the MinIO image: The independently rebuilt matching Go1.26.4/native local frontend package, |
…#29662) Related to #29668: confirmed system-catalog compatibility lookup performance defect in Main and 4.2-dev. The equivalent 4.2-dev fix is #29665. ## Problem `checkColExists` inspects the schema of the sys-owned `mo_pubs` / `mo_subs` catalogue tables. Its three callers already execute the lookup as sys, but the SQL omits `account_id`, the first component of `mo_columns`' compound primary key. The lookup therefore scans other tenants' column metadata as account count grows. Controlled alternating queries on the same populated catalogue (96 disposable accounts) returned identical answers. On Main the median unscoped lookup was 17.806 ms versus 0.453 ms for the scoped query; on 4.2 it was 14.808 ms versus 0.442 ms. These are lookup measurements, **not** an end-to-end DROP speedup. ## Minimal change - Add `account_id = catalog.System_Account` to this one compatibility lookup. - Preserve tenant publication/subscription data selection, old-schema absence, caller context, cancellation and executor errors. - Update the dependent exact-SQL mocks and strengthen the existing helper test. - Do not cache schema capabilities or change DDL concurrency, retries, transactions, SNAPSHOT/PITR locking, catalogue GC or account deletion semantics. The independent SNAPSHOT convoy described in #29400 is **not** fixed or closed by this patch. ## Local validation Base: `281ca809d688f7ff727e813a48436aff1cfbea36`; Linux/amd64, actual Go 1.27.0, matching native CPU generation independently built and provenance-verified. ```sh .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s \ -run '^Test_checkColExists$' ./pkg/frontend .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=600s ./pkg/frontend .agents/skills/mo-dev/scripts/mo-cgo-test -v -vet=all -count=1 -timeout=120s \ -run '^Test_checkColExists$' ./pkg/frontend .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=300s \ -run '^TestIssue29414PublicationWaitsForPhysicalDatabaseDrop$' ./pkg/tests/issues ``` All four commands reached PASS/exit 0. The complete frontend package took 41.375 s; the authenticated two-CN public SQL consumer took 9.957 s and passed rollback, commit, source replacement and query cancellation. The seven helper cases cover current/legacy publication and subscription schemas, SQL failure, a truly canceled context and invalid executor results. Running the identical cases against the original production SQL fails on the missing account predicate. This is a query-shape regression assertion, not a claim of wrong-result reproduction. Q1-Q3: no new resource owner, waiting edge, goroutine, global state or growth; the caller still owns BackgroundExec and all failures remain visible. Configured golangci-lint v2.14.0, built with Go1.27.0, also completed for the owning frontend package: exit 0, `0 issues`. Independent full-diff review found no remaining blocker. The equivalent small change is separately validated and submitted to 4.2-dev; this PR targets Main only.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed all seven changed files at 78773e17342b6ed383483154d818a12e1a9ce62d against base/merge-base 3252b627d4e331aa9bb65936bd49a7f65d358e0a (4.2-dev). No blocking findings; approve. No subagents used.
The design is appropriately small and uses the existing owner, checkColExists. All three callers inspect the schema of sys-owned mo_pubs/mo_subs. I traced ordinary-tenant catalog creation, publication migration to sys, sys-scoped column upgrades, catalog row generation, and the composite key (account_id, att_database, att_relname, attname). Adding the missing account predicate completes that key lookup. Subsequent publication/subscription business queries retain their existing tenant filters.
QA challenges covered a non-sys caller, optional-column presence/absence for both tables, execution failure, actual context cancellation, malformed executor results, and the empty-result path. Legacy absence still selects the old SQL and matching extractor. Context wrapping preserves cancellation and the caller's account identity. Account-drop and snapshot-restore consumers retain their error propagation and executor ownership. No new cache, state machine, lock, retry, goroutine, persistent format, or cleanup owner is introduced, and no newly redundant branch or abstraction was identified. This focused optimization does not require a separate feature design document.
Implementation, tests, CI, and documentation were assessed separately. The product change is one SQL replacement plus three explanatory lines. Four test files (+70/-21) extend the existing lightweight helper fixture into seven distinct named cases and update dependent exact-SQL mocks without weakening consumer assertions. There are no new services, sleeps, bulk datasets, or production test hooks. Exact query assertions prevent regression of the key predicate; public BVT supplies independent business-result evidence. No repository documentation changed; the PR description's pending-CI wording predates the successful run and is non-blocking.
The CI-only Compose overlay (+19 lines across two files) reuses existing MinIO/mc Dockerfiles with fixed releases, a pinned base image, and SHA256 verification. Startup, logging, and shutdown inherit the same Compose selection. Hosted amd64 builds are appropriate; default development architecture selection remains intact. Test selection, failure propagation, timeouts, and cleanup retain their existing contracts.
Validation reused after checking revision, selection, mode, and terminal result:
- Run 37787490781 checks the reviewed head. Logs confirm Go 1.26.4 Linux/amd64, race stages, frontend selection through the light package scope, and terminal UT success. Coverage, Linux/arm64 SCA, proxy Compose BVT, and pessimistic multi-CN BVT succeeded. The changed helper cases have no short-mode skip.
- Downloaded pessimistic BVT reports confirm actual execution:
pub_sub2.sql354/354,pub_sub4.sql9/9, andprepare_publication_change.sql81/81, all with zero failed/ignored/abnormal cases. Public SQL and expected outputs were inspected for cross-account behavior. - Iceberg run 37787490040 actually built and checksum-verified both dependency images, then passed all four E2E cases with result/diff artifacts. Its tested PR merge commit has the same Git tree as the reviewed head.
- Local
git diff --checkpassed and the detached review worktree is clean. Equivalent heavyweight suites were not rerun locally.
There are no existing inline review comments or review threads on this PR. The author comment concerning MinIO UNAUTHORIZED is closed by the overlay and successful actual E2E evidence; the other comment is a Qodo service-pause notice.
The performance benefit is confined to the schema compatibility lookup. The reported 14.808 ms versus 0.442 ms timings are author measurements, not new reviewer measurements or an end-to-end DROP ACCOUNT speedup. This change does not establish resolution of the separate SNAPSHOT convoy in #29400.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #29668: the same confirmed system-catalog compatibility lookup
performance defect. This PR targets
4.2-dev; #29662 targets Main.No automatic issue closure: this lookup fix does not prove all nightly cleanup
deadlines or global DDL lock contention resolved.
What this PR does / why we need it:
System-catalog compatibility lookup
Equivalent
4.2-devbackport of Main #29662.checkColExistsdescribes thesys-owned
mo_pubs/mo_subsschema, but omits the leadingaccount_idpartof the
mo_columnscompound primary key. Add the existingSystem_Accountconstant to this one compatibility lookup, avoiding other tenants' metadata.
The three callers still select tenant publication/subscription data exactly
as before. Preserve old-schema absence, caller context, cancellation, executor
errors and executor ownership. No capability cache, lifecycle lock change,
new goroutine, retry, transaction change or resource controller.
Controlled alternating queries on the same 4.2 catalogue (96 disposable
accounts) returned identical answers: median 14.808 ms unscoped versus
0.442 ms scoped. This is lookup cost, not an end-to-end DROP speedup.
The independent global SNAPSHOT convoy in #29400 is not fixed by this patch.
CI-only MinIO setup repair
Both attempts of Iceberg run 37595418344 failed before MO startup or Iceberg
SQL execution: MinIO / mc image pulls from Quay returned
UNAUTHORIZED.Anonymous-token registry requests reproduce the denial; the former Docker
Hub repositories also return 404, so switching registries is not a fix.
Select a CI-only Compose override that reuses the existing Compose BVT
Dockerfile.minio/Dockerfile.mc. Those definitions download the samefixed 2023 release binaries from GitHub and verify their pinned SHA256 values.
The same definitions built successfully in this PR's Compose BVT.
This is restricted to the existing hosted amd64 Iceberg CI job. The local
development Compose configuration, including its ARM64 selection, is unchanged.
Iceberg test selection, assertions, failure propagation, timeouts, and cleanup
are unchanged; the job is not disabled and no retry or skip is added.
Validation
Original product-change validation, based on
c3fa851d810306fac9b8dc3381a49d8193f27a19, actual Go 1.26.4, with anindependently rebuilt matching native library:
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=600s ./pkg/frontend .agents/skills/mo-dev/scripts/mo-cgo-test -v -vet=all -count=1 -timeout=120s \ -run '^Test_checkColExists$' ./pkg/frontendComplete frontend PASS (13.821 s) and focused vet/tests PASS. Seven named
cases cover current/legacy publication and subscription schema, SQL failure,
a truly canceled context and malformed executor results; assert sys executor
identity while preserving the caller's tenant identity. Existing account-drop
and snapshot exact-SQL mocks are updated without relaxing their assertions.
Configured golangci-lint v2.6.2 / Go1.26.4, changed owning closure against the
4.2 base: exit 0,
0 issues. The five-file product/test change and its threecallers were reviewed. Full Main validation and the authenticated two-CN
publication integration consumer are documented in #29662; they are not
represented as additional 4.2 integration runs.
At product-change head
60f479bdd5, run 37595419562 passed Ubuntu UT, arm64SCA, UT coverage, Proxy Compose BVT, and pessimistic multi-CN BVT. The BVT
artifact confirms actual publication/subscription cases executed successfully,
not merely a green workflow summary.
CI repair validation at
50a5b05148:make test-iceberg-e2e-localselection: PASS.select the existing checksum-pinned builds without pulling the MinIO images.
git diff --check: PASS.GitHub release assets; this is not counted as a successful build or E2E run.
(pending; the final job result, not the advisory workflow summary, is required).