Skip to content

fix: optimize SHOW ACCOUNTS and harden 4.2 CI - #32105

Merged
XuPeng-SH merged 11 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/31388-42-show-accounts
Nov 5, 2026
Merged

XuPeng-SH merged 11 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/31388-42-show-accounts

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 3, 2026 •

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:

Related to #31388. Backports and refines #31437 for 4.2-dev.

What this PR does / why we need it:

SHOW ACCOUNTS previously materialized every table's statistics in Go even when it only needed a per-account total. This was expensive for accounts with many tables.

Aggregate current sizes in SQL using the complete live account/database/table identity and a bounded account scan. Preserve per-table truncation, forced single-account refresh, admission policy, TN fallback and snapshot size. The shared embedded-cluster fixture can now use a caller-owned data directory without changing the process-wide temporary directory or bypassing the shared port lease.

Backport the runtime-only CI Dockerfile and cgroup watcher shutdown fix so BVT jobs can reuse the validated build artifact and write coverage on exit. Give Compose services a 120-second shutdown grace period: the previous default could kill TN or LOG while closing and lose coverage counters.

Validation

  • The public MySQL integration exercises both CNs, distinct tenant sizes, forced single-account versus aggregate results, tenant isolation, a real snapshot and table deletion. It passed normally and twice in one process under -race. A separate frontend test covers preservation of nonzero TN snapshot sizes; the live test does not force asynchronous snapshot accounting to become nonzero.
  • With the first shared port lease and its TCP port occupied, the public test passed twice using another lease and removed its owned directories. Injecting a first-close failure verified that cleanup ownership is retained and retried before replacing the process-global temporary file service.
  • The real two-CN Compose BVT passed 19/19. All five MatrixOne services exited normally with the 120-second grace and produced coverage counters. A wire-level fault injection confirmed that zero or grossly inflated returned sizes fail the BVT assertions; separate aggregate-result mutations of zero, +1 MiB and swapped tenant sizes each fail the public comparison.
  • Full pkg/embed race, incremental formatting, vet, molint and golangci-lint passed for the changed embed and public-test packages. Earlier full frontend and disttae normal/race runs, the focused real-engine race tests and the cgroup watcher checks remain applicable to their unchanged code.
  • With a shared 4.2 catalog containing 102,400 mostly empty user tables, interleaved baseline and patched CN queries gave median all-account latency 2,101 ms → 111 ms and four selected smaller accounts 49.3 ms → 40.5 ms; account names, counts, size and snapshot size were compared. A separate mixed-version topology also passed the earlier BVT. These are local measurements, not a guarantee for the reported 673,618-table production deployment.
  • CI on the previous PR head passed. CI for this updated head must be checked separately. An earlier deleted-user authorization assertion failed once and passed on rerun; its intermittent cause remains unconfirmed.

A pre-existing 4.2 result_scan issue misreads saved SHOW ACCOUNTS float fields on both baseline and candidate, so the public test compares MySQL results directly. Out-of-range Go float-to-uint conversions remain implementation-dependent.

@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 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 4f865e785a8e6b814158f7aafedafc5088c9ac51

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 4f865e785a8e6b814158f7aafedafc5088c9ac51

Assessment: approve

The optimization replaces per-table Go materialization with account-sized SQL results while reusing existing refresh and policy owners. Live-identity matching, numeric semantics, tenant isolation and TN/snapshot fallback are preserved without adding caches or workers. No actionable findings remain.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Reviewed all eight changed files, both discussion entries and linked issue context; saved discussion-assessment.json.

  • Preflight and exact-head native build passed. Source and native artifact identities were verified.

  • Full frontend and disttae normal suites passed: 2,001 top-level tests after recovering a module-proxy download failure.

  • Real-engine numeric and stale-identity regression cases passed.

  • Public MySQL integration passed twice in one process, including cleanup and fixture reuse.

  • Commands, source fingerprints, exits and retained logs were reconciled in validation-report.json. Source remained unchanged.

Limitations:

  • Race, static-analysis and two-CN performance results were reused from frozen author reports; they were not rerun locally.

  • The original production-scale workload and its latency/GC guarantees remain unverified. SQL scan/join work still depends on table count.

  • The frozen CI snapshot had no completed product checks; no CI pass is claimed.

@XuPeng-SH
XuPeng-SH requested a review from fengttt as a code owner November 3, 2026 22:37
@XuPeng-SH XuPeng-SH changed the title fix(frontend): speed up SHOW ACCOUNTS on 4.2 fix: optimize SHOW ACCOUNTS and harden 4.2 CI Nov 3, 2026
@XuPeng-SH

XuPeng-SH commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 1f080e4e2b1447b1dc4a8601fd8c63c8befbb219

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 1f080e4e2b1447b1dc4a8601fd8c63c8befbb219

Assessment: approve

No actionable findings. Account aggregation reuses existing SQL, refresh and fallback owners; watcher cancellation and cleanup are coherent, and the prebuilt image preserves the existing runtime layout.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Isolation preflight passed. The system package passed normal and race runs, with 13 top-level tests each.

  • All four watcher tests passed 100 exact-name race repetitions each.

  • Compose configuration confirmed 120-second shutdown grace, exec entrypoints and coverage settings for all five MatrixOne services.

  • Reused supplied review 5758475758 for eight unchanged SHOW ACCOUNTS files after verifying their identity.

  • Retained logs, terminal exits and receipts reconciled in validation-report.json; frozen patch matched Git and source remained unchanged. All discussion keys were assessed.

Limitations:

  • SQL/public SHOW, image deployment, two-CN and performance evidence was reused from supplied reports without fresh local reproduction or their raw logs.

  • External CI workflow bodies and staged artifacts were unavailable; frozen build, UT, SCA and coverage checks were incomplete.

  • Production-scale p99/GC impact remains unverified.

@XuPeng-SH

XuPeng-SH commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 297137f5fb13207e63efd4707acf2e0ef220dc9d

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 297137f5fb13207e63efd4707acf2e0ef220dc9d

Assessment: approve

The aggregation reuses existing MTS execution and refresh paths while preserving TN and snapshot fallback. Watcher shutdown and fixture cleanup have coherent ownership. No actionable defects remain.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Reviewed all 14 changed files, six discussion entries, linked issue context and affected owners/consumers.

  • Verified source identity before reusing supplied unit, real-engine and watcher race evidence; assessed revised fixture validation as author-reported.

  • Static audit passed: patch/head identity, formatting of 10 Go files, complete discussion coverage and 64 BVT regex controls. Receipt: checks/1793763673804351592-3.json; retained output: static-audit.log.

  • Saved review-plan.md, discussion-assessment.json, source-review.md and receipt-reconciliation.json.

Limitations:

  • Frozen UT, SCA, coverage and two BVT lanes remain pending.

  • No fresh local Go/race or image build; supplied execution reports lack raw receipts in this snapshot.

  • Production-scale p99 latency and GC effects remain unverified; SQL work still scales with table count.

This branch was successfully deployed

No deployments
ci — 5bd1d835 Deployed Nov 5, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api-change kind/bug Something isn't working kind/enhancement kind/test-ci size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants