Repository navigation
fix(bootstrap): remove view scan and enforce complete tenant initialization - #31662
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? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 38b6052adb324cc7082efe2a78974d2d2649b200
Assessment: request_changes
The released-version upgrade path remains intact, but removing maintenance leaves fresh accounts created through the capability fallback without TABLES repair.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
- P2
pkg/bootstrap/service_upgrade_tenant.go:426: CREATE ACCOUNT encounters transient failures in both capability probes, falls back to protocol 109, then passes the independent COLUMNS protocol check.
Impact: The account can commit at version 4.0.7 with legacy TABLES, leaving incorrect UPDATE_TIME, CHECK_TIME and TABLE_COLLATION after recovery. The tenant upgrade skips current accounts, and remaining maintenance does not repair TABLES. Retain a convergence path for fallback-created accounts or prevent successful initialization from leaving legacy TABLES; add a failure/recovery regression.
Evidence: authenticate.go:11327-11359 permits this fallback; sysview.go:93-99 selects legacy TABLES; authenticate.go:10982 stores the final account version. service_upgrade_tenant.go:188 skips completed tenants, and service.go:497 repairs only account 0. The existing frontend RPC-failure fallback test and healthy control both passed; see tenant-fallback-test.jsonl and checks/1793251105264186386-4.json. This path requires no unsupported intermediate-version upgrade.
Validation:
-
Four full package suites passed: bootstrap, bootstrap/versions, bootstrap/versions/v4_0_7 and util/sysview. Receipt: checks/1793250884646710595-4.json; log: package-tests.jsonl.
-
Embedded TestViewDescriptionSubscription passed, including replacement rollback/replay. Receipt: checks/1793251036117465005-4.json; log: subscription-test.jsonl.
-
Frontend capability-fallback test passed all seven cases. Receipt: checks/1793251105264186386-4.json; log: tenant-fallback-test.jsonl.
-
Preflight, native-input provenance, formatting, source cleanliness, discussion coverage and receipt/log audit passed. See validation-audit.json and checks/1793251280544954852-4.json.
Limitations:
-
Fallback execution was checked through mocked frontend helpers; durable version publication and missing repair were established by source tracing.
-
No cross-binary upgrade or injected end-to-end CREATE ACCOUNT recovery test was run.
38b6052 to
3460297
Compare
|
补充本次设计决策(当前提交
验证已覆盖 RPC 错误、旧能力、缺失/非法响应、取消;真实 SQL 测试验证创建失败后无账号行残留、恢复后同名重试成功,以及版本与 COLUMNS/TABLES/VIEWS 结果一致。相关包测试、SQL 回归和增量静态检查通过。尚未运行跨二进制 4.2.6 升级或混合二进制集群测试。 |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 86c37fca8e652eeee7bf1630bd09e305fbbad4c9
Assessment: approve
The prior fallback defect is resolved: capability failures now roll back account creation instead of committing incomplete views with a current catalog marker. Supported older catalogs retain the 4.0.7 repair path. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
Validation:
-
Reviewed the complete 14-file delta, affected owners and consumers, all five discussion entries and linked-issue context.
-
Local static checks passed: frozen source/patch identity, clean checkout, formatting, retired-symbol removal and discussion coverage. Receipt: checks/1793274749380452277-2.json; log: scope-check-final.log.
-
Reused supplied current-head successful UT, SCA, build and BVT status. Saved review-plan.md, discussion-assessment.json and validation-audit.json.
Limitations:
-
No Go or SQL tests were rerun locally; raw per-test CI and author logs were not supplied.
-
Cross-binary upgrades were not executed; upgrade CI was skipped. Upgrade entries and persisted formats are unchanged.
🚫 Left the queue50 min in the queue, with no time running CI. So far
Reason Pull request #31662 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
Hint You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Merge conditions: 2 of 3 metThis pull request
The batch, tested in place
Tick the box to put this pull request back in the merge queue (same as
Times in UTC · dashboard · how the merge queue works |
Main advanced with matrixorigin#31662 (641c34d), which removed the periodic information_schema.COLUMNS/TABLES repair walker (file, struct fields, maintenance call, and dedicated tests) and made the 4.0.7 versioned entry plus CREATE ACCOUNT initialization own convergence. That removal conflicts with this PR's earlier walker-ablation additions, which only existed to keep the crossing's effects attributable in the upgrade scenario tests. Conflict resolution and fallout: * pkg/bootstrap/service.go: drop this PR's informationSchemaColumnsTablesMaintenanceDisabled field together with the walker fields upstream removed (take upstream's struct). * pkg/bootstrap/service_upgrade_tenant.go: drop the disable gate around the walker call upstream deleted. * pkg/bootstrap/types.go: remove the now-orphaned WithInformationSchemaColumnsTablesMaintenanceDisabled option. * pkg/embed/upgrade_columns_4_0_18_test.go and upgrade_columns_cdc_4_0_18_test.go: drop the ablation option from all 13 cluster-wiring call sites and rewrite the two explanatory comments. With the walker gone upstream, nothing recreates a staged predecessor definition outside the versioned entries, so the completion assertions attribute decoration to the v4.0.18 entry by construction — the ablation proof premise now holds unconditionally. This PR's v4.0.18 one-shot COLUMNS reconciliation entry is unaffected and is exactly the supported convergence path under the new main. Verification on the merged tree: go vet green on pkg/bootstrap/..., pkg/embed, pkg/frontend; golangci-lint (repo .golangci.yml) reports 0 issues on ./pkg/bootstrap/... and ./pkg/embed; pkg/bootstrap TestCrossing* and TestV407* pass; embed TestColumnsUpgradeAutomaticScenarioCompletion passes (12.3s) as the merged-premise end-to-end smoke.
matrixorigin#31662 (merged into this branch) introduced TestCreateAccountCatalogInitialization with the then-final catalog version 4.0.7 hard-coded. This PR registers the v4_0_18 upgrade handle, so GetFinalVersion() is now 4.0.18 and a newly created account's mo_account.create_version is 4.0.18 (authenticate.go binds the INSERT to baseService.GetFinalVersion()). The literal expectation made the UT Coverage job fail on the PR head (run 40880503711, job 123471690727: --- FAIL: TestCreateAccountCatalogInitialization (3.35s)). Update the expectation to the new final version, matching the dynamic sibling assertion in collations_metadata_test.go.
…T, and full generated-column expressions Consolidates the catalog metadata corrections for matrixorigin#30936, matrixorigin#30935 and upgrade ladder (matrixorigin#31497). Defect corrections (unchanged in substance from the reviewed rounds): - information_schema.COLUMNS binds the label-aware metadata helpers: ENUM/SET character/octet lengths follow the declared labels (multibyte included) and leave numeric metadata SQL NULL for ENUM/SET, keeping ordinary types byte-stable. - STATISTICS.SUB_PART and SHOW INDEX Sub_part return the numeric prefix length from mo_indexes.algo_params (mo_index_sub_part) and actual SQL NULL for non-prefix indexes. - information_schema.COLUMNS.GENERATION_EXPRESSION returns the full expression; the varchar(500) view cast is removed. - Fresh publication (bootstrap init, CREATE ACCOUNT, subscriptions) serves the corrected identities unconditionally; historical snapshot readers keep recognizing their recorded definitions. Delivery vehicle, per approved design revision 12 (docs/design/20261026-declared-catalog-metadata-publication-and-repair.md, sha256 47ebfe15a45940221c3d2d5ad6955e11a5c89a1a909fa9d4e382e1ac9db0a599): - pkg/bootstrap/versions/v4_0_8 is the successor hop of the frozen 4.0.7 stage: two idempotent legs on the upstream shared builder (COLUMNS gate 109; prefix-aware STATISTICS gate 41), protocol floor 118, offset len(tenantUpgEntries), a plain per-entry HandleTenantUpgrade (no paging), no cluster entries; registered after v4_0_7.Handler. The revision-9 v4_0_18 carrier is deleted. - The four 4.0.7-literal admission guards in checkUpgrade are re-keyed onto the consolidated-line comparison and the registered frozen handle's identity (D11-1/D11-2): legacy CDC admission at route creation, recheck and recovery; the ready frozen-source validation; the interrupted offset-only route rejection - upstream's message texts, error types and pre-mutation ordering are unchanged. - The on-demand tenant walks continue past the paged 4.0.7 stage to the final version before caching completion (D12-1/D12-2): MaybeUpgradeTenant resumes the register walk in one bounded service-owned transaction after the stage commits, UpgradeOneTenant no longer terminates at the frozen branch for accounts already at 4.0.7, and both walks keep mo_account.create_version as the sole progress marker: a failure leaves the cache unset and resumes from the committed stamp. - Oracles: the admission suite (CDC admission/rejection at the successor registration including the recovery path and direct succession, frozen-source and offset-only rejections at both the pre-mutation check and recovery validation), and the continuation suite at the real v4_0_7 plus v4_0_8 registration (late-login convergence with second-login idempotence, manual chaining, manual upgrade from an already-stamped 4.0.7 account, successor failure/ retry without premature caching, and the no-successor-SQL-before- stage-completion ordering), plus the re-derived route/hop tests on the consolidated ladder. Rebase onto current main 1c80f16 (2026-10-30 round; the head was 30 commits behind and the merge state DIRTY): - pkg/frontend/authenticate_test.go: upstream matrixorigin#31662 removed the CREATE ACCOUNT protocol ladder and its dedicated suite around our publication oracle; the retargeted TestCreateTablesInformationSchemaPublishesDeclaredMetadataUnconditionally now proves on the complete-current-set creation contract that the corrected declared-label COLUMNS identity and the prefix-aware STATISTICS identity publish and that no predecessor identity is ever authored. Consistent with upstream, account creation installs the complete current set or aborts. - pkg/embed/catalog_view_identity_test.go: a caller-owned 4.0.6 tenant walk now ends at the registered 4.0.8 successor, so the final-version assertions move off the frozen 4.0.7 (the UT Test / UT Coverage / Coverage / CI Required failures of run 40792282505 failed exactly this assertion at the previous head). - Upstream matrixorigin#31662's recurring columns/tables maintenance-scan removal and matrixorigin#31420's literal-prefix SHOW TABLES filter merge alongside this change without edits on this side beyond the conflict resolution above.
…stered final MatrixOne ALL CI run 40932194894 (UT Coverage on Ubuntu/x86) failed upstream matrixorigin#31662's TestCreateAccountCatalogInitialization at the rebased head: the test asserts mo_account.create_version equals the literal "4.0.7", the final version when upstream authored it. This PR registers the v4_0_8 successor hop, so InitGeneralTenant now stamps fresh accounts with the registered final 4.0.8 instead. Derive the expectation from the same registry the creation path reads (the CN service's bootstrap registry, whose GetFinalVersion InitGeneralTenant writes into mo_account), mirroring the collations metadata oracle in the same package, so the assertion survives every future upgrade hop instead of retiring a literal each time. The exact failing command reproduced at the pre-fix head (exit 1, expected "4.0.7", actual "4.0.8") and passes at this fix together with TestCollationsMetadataUpgrade on the same shared fixture.
…#31739) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #30940 ## What this PR does / why we need it: ### Problem `DECIMAL` column declarations silently dropped the parsed `UNSIGNED` and `ZEROFILL` attributes: - `DECIMAL(10,2) UNSIGNED` accepted and stored negative values under every `sql_mode`, where MySQL rejects them with `ERROR 1264 (22003) Out of range value`. - `DECIMAL(10,2) ZEROFILL` produced no zero-padded output, and `SHOW CREATE TABLE` / `information_schema.columns.COLUMN_TYPE` lost both modifiers. - `CAST(x AS DECIMAL(p,s) UNSIGNED|ZEROFILL)` was accepted, which MySQL rejects outright with `ERROR 1064`. ### Root cause Three coupled defects: 1. The plan-layer DECIMAL conversion (`getTypeFromAstWithoutCharset`) selected decimal64/128/256 by precision and scale only, discarding the parsed attributes, so the attribute never reached the persisted type, assignment admission, or any presentation surface. 2. With no attribute on the type domain, every assignment path (INSERT/UPDATE/LOAD/REPLACE/VALUES) had no unsigned rule to enforce, SHOW CREATE / information_schema / result metadata had nothing to render, and the CAST target grammar accepted spellings MySQL forbids. 3. The bootstrap upgrade framework had no versioned entry able to reconcile persisted `information_schema.COLUMNS` view text on existing clusters, and no admission gate for legacy CDC tasks during that crossing. ### Changes - **Attribute carrier**: `plan.Type.numeric_attributes` (proto field 14) carries UNSIGNED/ZEROFILL from DDL through persistence, catalog cache, table functions, arrowbridge/external readers, checkpoint tooling and sysview. - **Unsigned enforcement**: every assignment admission path enforces the unsigned domain — strict mode rejects negatives with `ERROR 1264 (22003)` atomically (no partial writes), non-strict saturates to the lower bound with a 1264 warning, `IGNORE` accepts; `ZEROFILL` implies `UNSIGNED`. Executor cast saturates to the unsigned domain with scale widening before negation. - **Presentation**: SHOW CREATE and COLUMN_TYPE render the modifiers (`decimal(10,2)`, `decimal(10,2) unsigned`, `decimal(10,2) unsigned zerofill`); zero-padding is applied on all six decimal serialization/export sites (text rows ×2, binary rows ×2 including prepared, CSV and JSONLINE export) plus result-column display metadata. - **CAST grammar**: `CAST(... AS DECIMAL(p,s) UNSIGNED|ZEROFILL)` is rejected with `ERROR 1064 (42000)`, matching MySQL. - **Upgrade crossing**: new version 4.0.18 (offset 1) one-shot `information_schema.COLUMNS` reconciliation entry with legacy-CDC admission gating, retained-target recheck, frozen-offset preservation (`MinUpgradeVersion 4.0.7`, `RequiredProtocolVersion 126`), so upgraded clusters decorate their persisted view text exactly once. ### Validation - Primary regression, assigned base vs fixed: identical 8-section SQL script plus server-side-prepared binary-row probe run against isolated services built from (a) the unaltered base `3cf38889bc` (every defect reproduced: negatives stored, modifiers dropped, no padding, CAST accepted) and (b) this change (strict `ERROR 1264 (22003)` with zero rows stored, non-strict clip to `0.00` + Warning 1264, modifiers retained in SHOW CREATE/COLUMN_TYPE for masks 0/1/3, zero-padded text and binary wire, both CAST spellings `ERROR 1064`, signed/NULL controls unchanged). - Focused BVT `test/distributed/cases/dtype/decimal_unsigned_zerofill.test` (144 statements: strict/non-strict/IGNORE, modifier masks, wide widths, defaults, UPDATE, NULL, CAST rejection, persistence, snapshot compatibility): `TOTAL 144 SUCCESS 144 SUCCESS RATE 100%`; `mo-tester` result regeneration byte-identical. - Upgrade legs: `go test ./pkg/embed/ -run 'TestColumnsUpgrade'` — 7/7 PASS, including an ablation leg proving the 4.0.18 entry is solely responsible for decoration (background COLUMNS maintenance suppressed, undecorated predecessor verified) and a post-replacement-crash leg proving view-content and tenant-progress roll back together with idempotent restart replay; plus `go test ./pkg/bootstrap/...`, `go test ./pkg/hakeeper/`, and the v4_0_18 commit-fence unit subcase, all green. ### Residual risks - The background `information_schema.COLUMNS/TABLES` maintenance walker (kept enabled in production) also converges view text over time; the upgrade entry owns the deterministic crossing and the ablation leg proves its sole responsibility, but real-cluster non-upgrade convergence remains upstream-owned behavior. - Evidence scope: focused BVT and affected-package suites are green; the full distributed dtype suite is left to CI. Signed-DECIMAL controls in the focused file and sweeps show no behavior change for unmodified columns. ### CI fix update (2026-10-29, commit 74a4105) CI run 40845538549 at the previous head failed Matrixone UT Coverage (4 tests) and multi-CN e2e BVT (3 rows); all were caused by this PR and are fixed in `74a4105d94`: - **Bootstrap upgrade chaining** (`pkg/bootstrap/service_upgrade_tenant.go`, `pkg/bootstrap/custom_upgrade.go`): `MaybeUpgradeTenant`/`UpgradeOneTenant` planning stopped at the frozen consolidated v4.0.7 terminal entry, so tenants on older versions never received the forward v4.0.18 upgrade and tenants already at 4.0.7 skipped it. Both paths now re-plan and run the v4.0.7 crossing on demand until no pending v4.0.7 upgrade remains, and the frozen terminal entry is skipped so the forward version still executes. Fixes `TestCollationsMetadataUpgrade`, `TestV407LoginRepairsTenantCreatedAfterUpgradeSnapshot`, `TestCallerOwnedTenantUpgradeRollsBackAndRetries`, `TestCatalogVersionOrderingUsesSemanticVersionAndOffset`. - **Stale test expectations** (`pkg/embed/catalog_view_identity_test.go`, `pkg/embed/catalog_upgrade_paging_test.go`): assert the semantic final version instead of hardcoded `4.0.7`; injected version samples retargeted to 4.1.9/4.1.10/4.1.11 to preserve the semantic-vs-lexicographic ordering check. - **BVT expected results** (`test/distributed/cases/dml/show/show.test`, `zz_accesscontrol/account_restricted.sql`): spliced the unsigned-decimal-decorated `information_schema.COLUMNS` SHOW CREATE DDL (Create View descriptor 18848 chars, +209) into the three expectations; fixes show.test row 295 and account_restricted.sql rows 55/113. Local verification: pkg/bootstrap package suite green; both embed tests pass with `-v`; focused `decimal_unsigned_zerofill` BVT 144/144 pass via mo-tester against a locally built instance; the three spliced SHOW CREATE rows are byte-exact (18848 chars) against the live upgraded instance. ### CI fix update #2 (2026-10-29, commit 0a05d68) CI run 40862553192 at head 74a4105 failed `SCA Test on Linux/arm64` (job 123409348216): `make static-check-selected` reported 9 static-analysis findings, all in files owned by this PR. Fixed in `0a05d68642`: - `pkg/container/arrowbridge/staging_text_test.go`: gofmt(simplify) — collapse `decimal128.Num{}` to `{}` in the composite literal. - `pkg/sql/plan/function/func_cast_unsigned_decimal.go`: ineffassign — drop the dead `outcome` initializer (both classifier branches always assign). - `pkg/sql/plan/function/func_cast_unsigned_decimal_test.go`: two ineffassign findings — discard results reassigned before use, rescope the second JSON admission result. - `pkg/vm/engine/disttae/cache/catalog_column_update_numeric_attributes_test.go`: prealloc — build the 5-column fixture slice in a single literal with full capacity. - `pkg/bootstrap/service_upgrade_crossing_test.go`: unused `inTxn` field and `executionLog` accessor removed. - `pkg/embed/upgrade_columns_4_0_18_test.go`: unused `readColumnsRoute` / `waitColumnsVersionReady` helpers and the orphaned `testify/assert` import removed. No behavior change. Local verification: `golangci-lint run -c .golangci.yml` on the five affected packages reports 0 issues (the exact CI gate); the targeted suites all pass — arrowbridge staging-text suite, `pkg/sql/plan/function` TestUnsignedDecimalAdmission* + TestCastDecimalExtremeExponentRendering, `disttae/cache` TestColumnOnlyUpdateNeverDropsNumericAttributes, and `pkg/bootstrap` TestCrossing*. The same run's `UT Coverage on Ubuntu/x86` failure (job 123409393777) and its downstream `Coverage` merge block are the known `TestCrossTargetUpgradeRecovery` embedded-cluster admission flake tracked in #31044 (comment below); the PR code does not execute in that fixture-acquire failure. ### Base update (2026-10-29, merge commit 983cad4) Main advanced with #31662 (`641c34d259`), which removed the periodic `information_schema.COLUMNS/TABLES` repair walker and made the versioned 4.0.7 entry plus `CREATE ACCOUNT` initialization own convergence. That removal conflicted with this PR's walker-ablation additions (which only existed so upgrade scenario tests could attribute decoration to the v4.0.18 entry). Merge `983cad4dc3` resolves it: the disable option, gate, and struct field are dropped together with the ablation argument at all 13 cluster-wiring call sites; with the walker gone, the scenario tests' attribution premise holds unconditionally. This PR's v4.0.18 one-shot COLUMNS reconciliation entry is unchanged and is exactly the supported convergence path on the new main. Verification on the merged tree: `go vet` green on `pkg/bootstrap/...`, `pkg/embed`, `pkg/frontend`; `golangci-lint` (repo config) reports 0 issues on `./pkg/bootstrap/...` and `./pkg/embed`; `pkg/bootstrap` TestCrossing* and TestV407* pass; `TestColumnsUpgradeAutomaticScenarioCompletion` passes as the merged-premise end-to-end smoke. The residual-risks note above mentioning the background walker "also converges view text over time" is superseded: on current main the walker no longer exists and the versioned entries own convergence. ### CI fix update #3 (2026-10-29, commit a15f2bf) CI run 40880503711 at head 983cad4 (after the #31662 merge) failed `UT Coverage on Ubuntu/x86` (job 123471690727): `TestCreateAccountCatalogInitialization` in `pkg/tests/sqlintegration` failed in 3.35s. That test was introduced by #31662 with a hard-coded `create_version` expectation of `4.0.7`; this PR registers the v4_0_18 upgrade handle, so on the PR head `GetFinalVersion()` is `4.0.18` and `CREATE ACCOUNT` stamps `mo_account.create_version = '4.0.18'` (bound to `baseService.GetFinalVersion()` in `authenticate.go`). The stale literal is updated to `4.0.18` in `a15f2bff2b`; the sibling scenario in `collations_metadata_test.go` already compares against the dynamic `upgrader.GetFinalVersion()` and passed in the same job. No production-code change. ### CI fix update #4 (2026-10-30, commit 66bae00) CI run 40902981503 at head a15f2bf failed `Matrixone Coverage execution / Coverage` (job 123577267924): this PR's own diff coverage measured 536/717 = 74.76%, below the 75% PR-coverage gate. The failure is PR-caused (the gate only counts blocks this PR adds or modifies), so the root cause is fixed with genuine test additions rather than any gate change; nothing outside test files is touched: - `pkg/sql/plan/function/func_cast_unsigned_decimal_test.go`: admission-matrix coverage for the uncovered blocks in `func_cast_unsigned_decimal.go` — signed fixed-width sources rejecting negative rows (1264/22003) and pass-through for non-negative float/int/uint/bool/bit rows; date/datetime/timestamp/enum decodes; select-list row skipping across fixed, JSON, binary and varlena inputs; binary decimal128/256 payload decoding and empty-payload errors; the MySQL-prefix charset fast path; string outcome branches (pass through, clip-to-zero with WARN_DATA_TRUNCATED + 1264 warnings under ignore policy, and the fit-abstain path); varlena NULL rows; and the nil-process out-of-range warning fallback. - `pkg/container/arrowbridge/staging_text_test.go`: staged-text rendering for the remaining Arrow scalar kinds (int8/16/32, uint8/16/32/64, float16/32, decimal256), the rendered upper-bound table for int/float/bool kinds plus its unsupported-source rejection, context cancellation observed in both the whole-batch conversion and the per-column staged loop, and row-budget rejection for unsupported staged sources. - `pkg/common/moerr/error_out_of_range_column_test.go` (new): `NewOutOfRangeValueForColumnNoCtx` keeps the 1264/22003 wire contract naming the column and 1-based row. - `pkg/container/types/attributed_decimal_oid_test.go` (new): `T.IsAttributedDecimalOid` accepts exactly the decimal family. Local verification, reproducing the CI gate exactly: artifact profiles from the failed run (UT + BVT pessimistic + BVT compose) merged by block key with the profiles of these tests (same Go 1.27.1 toolchain), then the CI `parse_coverage.py` rerun over this PR's diff: total 717 modified blocks, covered 602, PR coverage 83.96% → pass (margin +9 points over the gate). All named suites pass locally (arrowbridge staging-text file, `pkg/sql/plan/function` TestUnsignedDecimalAdmission* + TestAppendUnsignedDecimalOutOfRangeWarning*, moerr, types). No production-code change; no CI/workflow change. ### Base update (2026-10-30, merge commit 8cc3ce9) GitHub reported the PR CONFLICTING after main advanced with #31628 (FK rebind to surviving keys, `969998e697`), #31738, #31746, #31766, #31767, #31768, #31777. The only content conflict was `pkg/sql/plan/build_ddl_test.go`: both sides appended independent test functions after `TestSessionDatabaseNullability`. The resolution keeps both — this PR's `TestBuildCTASUnsignedDecimal{Attribute,SetOperation}Provenance` and main's FK-rebind tests — with no changes to either test body. All other shared files auto-merged on disjoint hunks, verified by comparing both sides' diff regions against the merge base `641c34d259`: `pkg/common/moerr/error{,_no_ctx}.go` (this PR's `ErrOutOfRangeValueForColumn` 20211 vs main's `ErrDataBranchConflict` 22501, different code groups), `pkg/sql/plan/build_ddl.go` (this PR's CTAS default/attribute region vs main's FK-rebind region), plus `base_binder.go`, `build_alter_table.go`, `query_builder.go`, and `pkg/vm/engine/disttae/txn_table.go`. Local verification on the merged tree (Go toolchain, repo Makefile CGO flags): - `go build ./pkg/common/moerr/... ./pkg/sql/plan/... ./pkg/vm/engine/disttae/...` — green. - `go test ./pkg/common/moerr/` — pass (covers both error-catalog sides). - `go test ./pkg/vm/engine/disttae/cache/ -run TestColumnOnlyUpdateNeverDropsNumericAttributes` — pass (4 subtests). - `go test ./pkg/sql/plan/ -run '<19-test seam regex>'` — all 19 top-level tests pass: this PR's 9 unsigned-decimal suites, main's 8 FK-rebind suites, `TestSessionDatabaseNullability`, `TestBuildCTASPreservesMySQLSpecialColumnTypes`. No production-code change in the resolution beyond the merge itself; no CI/workflow change. Fresh CI on the new head was not awaited. ### CI fix update #5 (2026-10-30, commit 9d109f5) CI run 40929677611 (attempt 1) at head 8cc3ce9 failed `Matrixone CI execution / UT Test on Ubuntu/x86` (job 123645508612): package `pkg/sql/plan/function` failed with `--- FAIL: TestUnsignedDecimalAdmissionTemporalEnumAndUnsupportedSources` — `panic: type mismatch: casting ENUM vector to []uint16` — and `CI Required` failed as a consequence. The failure is PR-caused: the enum decode case added in update #4 built its ENUM input vector through `testutil.NewVector`, whose `T_enum` branch appends plain `uint16`; `vector.AppendFixed[uint16]` trips the race-build `checkTypeIfRaceDetectorEnabled` in `pkg/container/vector` (an enum-typed vector is not type-compatible with `[]uint16`). UT runs with `-race`, so the panic only fires there; local non-race runs passed, which is how it escaped update #4. Production code is unaffected: the admission path already reads enum vectors through `unsignedDecimalAdmissionFixed[types.Enum]`. Fix, test-only and one spot: - `pkg/sql/plan/function/func_cast_unsigned_decimal_test.go`: construct the enum source with `vector.NewVec(types.T_enum.ToType())` + `vector.AppendFixed(types.Enum(7))`, the enum vector construction already used elsewhere in the tree (e.g. `pkg/sql/compile/fuzzyCheck_test.go`). Local verification with the race detector (Go 1.27.1, repo Makefile CGO flags): - Before the fix: `go test -race -run '^TestUnsignedDecimalAdmissionTemporalEnumAndUnsupportedSources$' ./pkg/sql/plan/function/ -count=1 -v` panics with the identical `type mismatch: casting ENUM vector to []uint16` seen in the CI log. - After the fix: the same command passes, and the full `go test -race ./pkg/sql/plan/function/ -count=1` — the package CI aborted early at the panic — passes end to end. No production-code change; no CI/workflow change. Fresh CI on the new head was not awaited. ### Review fix update #1 (2026-10-30, commit 1a96756) The local review at `9d109f531e` (CHANGES_REQUESTED) reproduced one P2 defect in `pkg/container/arrowbridge/staging_text.go`: `renderedStageTextBound` estimated a staged Arrow decimal row as `precision + 3` bytes, which only covers the fixed-point render form. A declared scale outside the fixed-point domain renders the bounded scientific form (`<coeff>e<-sf>`), whose exponent bytes the estimate omitted, and a forged record can carry more coefficient digits than the declared precision. `MaxOutputRows` then admitted a window of individually valid rows whose rendered staging payload exceeded the configured byte budget — the probe admitted two 10^37 rows at scale 1e9 under a 130-byte budget but materialized 148 bytes (146 at scale -1e9) — leaving the reader's wire-size safeguard to split, copy, and discard the excess rows. Fix, scoped to the shared bound helper: - `pkg/container/arrowbridge/staging_text.go`: `renderedStageTextBound` now charges decimals the larger of the two reachable render forms over the physical coefficient span — Decimal128 at most 39 digits (|2^127|), Decimal256 at most 77 (|2^255|), signed two's-complement storage — independent of the declared precision. Fixed-point needs a sign, the digit run zero-padded to the gate-capped scale (<= 76), and the point; scientific needs a sign, the digits, and `e` plus the at-most-11-character negated int32-scale text. The resulting conservative row bounds are 79 bytes (Decimal128) and 90 bytes (Decimal256). Regression coverage (`pkg/container/arrowbridge/staging_text_test.go`): - `TestMaxOutputRowsAccountsScientificStagedText` (new, replicates the review probe): plain and dictionary-encoded `DECIMAL128(38, +/-1e9)` rows of coefficient 10^37 under a 130-byte budget admit exactly one row, and the converted staging window materializes within the budget; a two-row budget admits both with the encoding-independent 148/146-byte footprints below the estimate. - `TestRenderedStageDecimalBoundCoversWorstRenders` (new): the worst renders the gate can physically emit reach the bound exactly (Decimal256 scientific at scale `math.MaxInt32` = 90 bytes; the shared renderer's fixed-point ceiling = 79 bytes), and a forged 39-digit Decimal128 coefficient stays inside the bound. - `TestRenderedStageTextBoundKinds`: pins the 79/90 decimal bounds, including extreme declared scales; `TestMaxOutputRowsAccountsRenderedStagedText` row arithmetic updated to the new bound. Local verification (Go 1.27.1, repo Makefile CGO flags): the new regression tests fail on the pre-fix bound with the review's exact symptom (budget admits 2 rows, expected 1; `arrow-staging-probe.log` equivalent), and the full `go test ./pkg/container/arrowbridge/ -count=1` passes after the fix. `go test ./pkg/sql/colexec/external/ -count=1` passes except the pre-existing environmental `TestExternalArrowLoadFromLocalMinIOAndRejectsObjectChange`, whose local shared MinIO refuses writes because the host Data volume is at 100% capacity ("minimum free drive threshold"). Production-code change is confined to the row-size estimate rule; no CI/workflow change. Fresh CI on the new head was not awaited. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
… full generated expressions (#31489) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #30936. Related to #30935. Related to #30937. ## What this PR does / why we need it: Fixes the declared-catalog metadata defects of #30936/#30935/#30937 and delivers the corrected identities through the repository's supported model: **unconditional publication plus one idempotent stored-view refresh hop**. No feature-specific protocol gate and no mixed-version fallback exists in this PR: after the first implementation review every such mechanism was removed (`MORPCLatestVersion` stays 134, no read substitution, no admission survey, no per-tenant floor), while the stored-view migration the reviewers called "necessary" is retained. ### Design record (design-first review chain) The change is triggered (persisted-view migration, upgrade recovery, cross-subsystem changes), so the repository's design gate applies: `docs/design/20261026-declared-catalog-metadata-publication-and-repair.md` is the reviewed artifact, implementation of each round proceeded only after that round's independent design review returned PASS, and the document's status block and revision history record every reviewed revision's exact content hash, disposition and implementing head: - Revision 9 (sha256 `57043aac71c74a7cb63f0a8ac047a4ac898bf974791644569e5c57f4bd2838d9`), PASS 2026-10-28 - the shutdown-only rework that removed the protocol-135 gate family; implemented at rework head `9f454cb5d0`. - Revision 12 (sha256 `47ebfe15a45940221c3d2d5ad6955e11a5c89a1a909fa9d4e382e1ac9db0a599`), PASS 2026-10-29 - the post-consolidation vehicle plus preserved upgrade admission and on-demand continuation; implemented at head `efb7234682`. - Revision 14 (sha256 `22aaf464a18a8be7e7d4889e605850c0792bca6df7bd234e97569445b0c84c66`), PASS 2026-10-30 - the rebase onto upstream #31739's ladder: vehicle renumbered to `v4_0_19`, the merged COLUMNS identity, the frozen 4.0.18-snapshot recognition, the direct-route census. This is the delivered design content; it was implemented at head `61da7f8ef0`. - The design-first decision of record for revision 14 is identified and linked in the tracked document (revision 16) and here. The returning review was the controller-run independent pre-PR design review: a read-only, ephemeral Codex review session under the `fix-issue-loop-local-reviewer` contract, provider-separated from the implementing Grok CLI session (reviewer model `gpt-6.1-sol`, reasoning effort `xhigh`; implementing handler `magpie/tass/glm-5.3`; controller run `3dedc8b010734de9ba6a4c92c3fdf56e`, review session thread `01a18bcc-5369-7d91-ae66-c072a48a5b1e`, run window 2026-10-30T07:53:04Z-07:59:46Z, exit 0). It returned `approved: true` (PASS - design only, no findings) at 2026-10-30T07:59:46Z for exactly that content hash. Retained external evidence: the approved bytes are public at https://github.com/matrixorigin/matrixone/blob/61da7f8ef005f2ee14a3ea44e738e6baee24876d/docs/design/20261026-declared-catalog-metadata-publication-and-repair.md (that committed document hashes to the approved sha256); the verbatim decision record plus its provenance is durably published at https://gist.github.com/gouhongshen/f1120ed42e7a71f75afa79d1ff8b5bc2; and the controller retains the full review transcript and the exact checkpoint submission the reviewer was sent (`state/logs/issue-30936/1793346784-b0837235.jsonl`, `state/artifacts/issue-30936/pr-event-result-1793345798133.json`), next to every earlier round's decision record under `state/artifacts/issue-30936/` (revision 9 PASS `pre-pr-review-1793174134562.json`, revision 10 REQUEST_CHANGES `pre-pr-review-1793224739314.json`, revision 11 REQUEST_CHANGES `pre-pr-review-1793225484685.json`, revision 12 PASS `pre-pr-review-1793226200902.json`, revision 13 REQUEST_CHANGES `pre-pr-review-1793323124836.json`). - Revision 15 (sha256 `551fb06436f784e8b75fa9c7d37702ea47379ed5902256b8188d1dfcacb22f6c`) - the documentation-only consolidation at the implementation review's request (head `38901ce0e7`): the design-approval chain and the actual `v4_0_19` vehicle are stated in the document's status block, the revision-13/14 amendments are folded into the standing sections, and the transient review/run correspondence was moved out of the tracked file (it remains recorded in the review threads and retained review evidence). No decision, invariant, oracle or validation entry changed from the approved revision 14; the approved revision-14 wording governs wherever the consolidation could be read as a change. - Revision 16 (sha256 `2df7a7dfef372bf41feb160c3c3252ac9f1d6b3522106c94fe1e3f5d038d9f8d`) - the documentation-only evidence-link pass at the design-gate review's request (this push): the tracked design's status block and revision history now identify the actual design-first decision of record for the delivered revision and its reviewer, and link the retained external evidence (public byte link of the approved content, durable verbatim decision-record gist, controller-retained transcript and checkpoint submission). No decision, invariant, oracle or validation entry changed from the approved revision 14. ### Delivered vehicle The stored-view refresh hop is `pkg/bootstrap/versions/v4_0_19` - version "4.0.19", minimum upgrade version "4.0.7", required protocol 118 (a pre-existing grandfathered gate), offset 2 - registered on main's consolidated ladder behind upstream's `v4_0_18` handle (upstream #31739 consumed the planned successor slot as "4.0.18", so the vehicle was renumbered after it). Its tenant hop publishes both identities for existing accounts: a ready 4.0.7 cluster queues the single direct [4.0.7 -> 4.0.19] upgrade executed by this handler alone, a main-era 4.0.18 stamp queues the direct [4.0.18 -> 4.0.19] upgrade, older sources chain their per-handle rows through the frozen 4.0.7 stage and the 4.0.18 handle, and the login/manual on-demand walks step every successor handle (upstream's re-entrant planning loops with this PR's manual-walk completion check); fresh accounts initialize at 4.0.19 with the published identities and run no leg. ### Root causes 1. `information_schema.COLUMNS` (#30936) derived every declared-metadata field from the physical column type alone: `internal_char_length(mc.atttyp)` and `internal_numeric_precision(mc.atttyp)`. ENUM is stored as an internal uint16 and SET as a uint64 bitmap, so both published SQL NULL for `CHARACTER_MAXIMUM_LENGTH`/ `CHARACTER_OCTET_LENGTH`, while SET exposed its backing-store `NUMERIC_PRECISION=20`/ `NUMERIC_SCALE=0`. The declared labels persisted in `mo_columns.attr_enum` were never consulted. 2. `information_schema.STATISTICS` and `SHOW INDEX` (#30935) published NULL literals and the string `'NULL'` for `SUB_PART`/`Sub_part`, although prefix lengths are retained in `mo_catalog.mo_indexes.algo_params`. 3. `GENERATION_EXPRESSION` (#30937) went through `varchar(500)` casts, silently truncating declared generated-column expressions longer than 500 characters. ### Exact changes (shutdown-only delivery) - `pkg/sql/plan/function`: additive two-argument overloads (`varchar,varchar -> int64`) on `internal_char_length`/`internal_char_size`/ `internal_numeric_precision`/`internal_numeric_scale` that derive character metadata from the declared ENUM/SET labels and suppress SET's bitmap numeric identity, plus the new `mo_index_sub_part` function. The historical one-argument overloads remain bound for definitions persisted by older binaries; the new ones carry **no protocol requirement**. - `pkg/util/sysview`: the current `COLUMNS` identity composes those label-aware overloads and the unbounded `GENERATION_EXPRESSION` projection on the `#31160` binary-family NULL selector, under upstream #31739's attributed-DECIMAL `COLUMN_TYPE` decoration applied verbatim (`COLUMN_TYPE` pinned to `varchar(65535)`, `att_is_unsigned` decked ancient rows - D13-2/D14-1); the current `STATISTICS` identity publishes retained prefix lengths as a numeric `SUB_PART` (actual SQL NULL for whole-column parts). Bootstrap init, CREATE ACCOUNT and subscription publication install these identities unconditionally: after main's #31662, CREATE ACCOUNT installs the complete current definition set or aborts, so this PR adds no rung, survey or authoring floor. - Historical-snapshot reader recognition (invariant I6): the snapshot adapter `AdaptLegacyInformationSchemaColumnsDDL`, the derived view-metadata seam `ViewMetadataColumnsDDL` and the migration gate `IsInformationSchemaColumnsMigrationDDL` recognize every recent published generation byte-stably - the historical templates, the base-era NULL-selector MEDIUMINT identity, and the exact upstream 4.0.18 published identity frozen independently of the mutable current constructor (`InformationSchemaColumns4018DDL`, D14-1) - next to the corrected current. Unknown or user-edited definitions stay refused with the unchanged error, `IsCurrentInformationSchemaColumnsDDL` stays exclusive, and snapshots keep their recorded projections and timestamp; the readers stay read-only. - `pkg/bootstrap/versions`: the `v4_0_19` tenant hop carries the two shared-builder legs: the shared COLUMNS entry keeps its exact base shape (`UpgSql = sysview.InformationSchemaColumnsDDL`, protocol gate 109, exact-identity CheckFunc, DROP+CREATE), so refreshing an account installs the merged identity; the shared STATISTICS entry publishes the prefix-aware identity under the pre-existing STATISTICS gate (41). One idempotent rewrite per pre-existing account; completed legs never churn; a failed leg leaves the account marker untouched and retries. - `pkg/bootstrap` upgrade admission and continuation: upstream's re-keyed admission guards (the `>= 4.0.7` line, the registered frozen-handle identity and the `crossingPending` route predicates) are adopted verbatim; this PR keeps the recovery-path guards (the frozen 4.0.7 target's legacy-CDC admission and the offset-only resume rejection) that a final above 4.0.7 otherwise bypasses, and adds the manual walk's in-transaction completion check (an account left below the cluster final returns `cannot upgrade tenant version %s to current cn version %s` instead of caching success) - upstream's loops alone lack it. - `pkg/sql/plan`: `SHOW INDEX` publishes `Sub_part` through `mo_index_sub_part` (numeric protocol type, actual SQL NULL without a retained prefix). - `MO_INDEX_SUB_PART` is id 623 (`FUNCTION_END_NUMBER` 624) after upstream #31739 allocated 620..622 for the unsigned-Decimal admission checks; the id is internal plan wiring only and every view DDL references the name. - **Deleted with their suites** (the withdrawn mixed-version machinery): the `MORPCVersion135` constant and plan feature flag, the persisted-expression/remote-execution protocol mappings for it, the admission/authoring-floor branches in tenant publication, the `FrozenViewServingBelowMetadataFloor` read substitution and its serving-floor adapter, the metadata maintenance pass and its restore-compatibility/admission-interval tests. The pre-existing 118/126 admission handoffs, the VIEWS authoring fence, the 130-134 upstream planes and the columns/tables maintenance keep their base behavior untouched. ### Issue-to-test proof Defect oracles (unchanged red/green pair on base `7e0c9d94` vs the fixed tree; recorded probe logs and full-suite receipts in the review evidence): - #30936 (`pkg/tests/issues/issue_30936_test.go`, `issue_30936b_test.go`, `pkg/sql/plan/function/func_internal_columns_metadata_test.go`): for `t(id INT PRIMARY KEY, e ENUM('a','bb'), s SET('a','bb'))` the base returned SQL NULL character lengths and SET numeric 20/0; the fixed tree reports `e` 2/8 and `s` 4/16 with SQL NULL numeric metadata, on both CNs, for reordered and multibyte label sets (`1/3`, `2/4`), with the INT control at 10/0; empty-domain and colliding-declaration boundary batteries pin the `attr_enum` encoding boundary. - #30935 (`func_internal_index_sub_part_test.go` plus the issue SQL): `SUB_PART`/`Sub_part` report the declared prefix length (numeric `LONGLONG` at the client) and actual SQL NULL for whole-column positions on both surfaces. - #30937: full declared expressions of 499/500/501/646/800 characters round-trip through `GENERATION_EXPRESSION`, `SHOW CREATE TABLE` and the evaluated values, VIRTUAL and STORED. Delivery and history oracles (all green at the delivered head): - Publication (`pkg/frontend`, `pkg/util/sysview`) : `TestCreateTablesInformationSchemaPublishesDeclaredMetadataUnconditionally` proves fresh creation executes the corrected declared-label COLUMNS identity and the prefix-aware STATISTICS identity and never authors a predecessor identity, beside upstream's own `TestCreateTenantInformationSchemaRequiresCurrentProtocol` peer-answer rejection matrix. - Hop (`pkg/bootstrap`): rewrite/no-op/retry chains for the v4_0_19 hop - base-era NULL-selector and V110 tenants converge to exactly the published identities, a current tenant is a no-op, a mid-hop DDL failure leaves the marker untouched and repairs on retry, and a 4.0.13 account converges through the whole historical chain (`TestColumnsUpgradeReachesExistingTenants`; the maintenance keeps a single current identity across shared/maintenance/hop). - Upgrade admission and recovery (admission oracles re-derived at the three-handle registration, final 4.0.19): the ready 4.0.6, created-4.0.7, off-frozen-offset and interrupted offset-only routes keep upstream's terminal rejections (`TestLegacyCDCAdmissionBeforeUpgradeMutation`, `TestV407RejectsDifferentOffsetBeforeCreatingRoute`, `TestV407RejectsInterruptedOffsetOnlyRouteBeforeMutation`) including the recovery path, with the crossed-route non-rejection the pending-scan permits; the continuation oracles drive the real `v4_0_7` handler plus the successor registration (late-login convergence from 4.0.6 to the final, already-4.0.7 manual upgrade, failure/retry without premature caching, second-login idempotence and the no-successor-SQL-before-4.0.7-completion ordering). - Historical transition H1a/H1b (design section 7): the base-era pair and the frozen `InformationSchemaColumns4018DDL` identity are recognized byte-stably at all three reader seams, an unknown definition stays refused at every seam, and with the live view at the corrected identity a snapshot recorded at the base-era or the 4.0.18 current definition binds and returns its recorded text with its projections and timestamp preserved, while the pre-refresh leg pins a live 4.0.18 definition still gating legacy adaptation (no silent pass-through). - Version-census oracles: route fixtures carry the composed route matrix (the single direct [4.0.7 -> 4.0.19] row, the direct [4.0.18 -> 4.0.19] row, three-leg chained census for below-4.0.7 sources, the frozen-4.0.7 resume admission), and `pkg/tests/sqlintegration/TestCreateAccountCatalogInitialization` and `pkg/embed/catalog_view_identity_test.go` derive their expected version from the registered final (`GetFinalVersion`), so renumbered vehicles no longer retire a version literal one by one. ### Verification at the delivered head (repository CGo wrapper, real exit statuses in the round logs) All green at the reworked head `61da7f8ef0`: the full `./pkg/bootstrap/...` ladder (route/continuation/recovery/census, including the renamed vehicle's own `versions/v4_0_19` suite and upstream's `versions/v4_0_18` suite), the full `./pkg/util/sysview`, `TestHistoricalViewColumnsSQL` in `pkg/sql/plan`, the full `./pkg/sql/plan/function`, `TestIssue30936*` in `./pkg/tests/issues` replaying the three issue reproductions, `TestCreateAccountCatalogInitialization|TestCollationsMetadataUpgrade` in `./pkg/tests/sqlintegration`, the `pkg/embed` catalog identity pair + caller-owned continuation oracle, and the `pkg/frontend` publication oracle pair. The first full bootstrap pass at this head also exposed that upstream's crossing-admission fixtures still modeled the upstream-only route matrix; they were re-derived to this delivery's composed census (per design D13-7/D14-3, no production change) and the focused rerun and full ladder rerun are green - the first-pass failure is retained verbatim in the round logs as the fixture-round evidence. Earlier rounds' receipts remain valid for the unchanged parts per the repository's evidence-reuse rules; the distributed multi-CN BVT and hosted CI matrix remain CI work at the pushed head. ### Residual risks - Main advanced during the ladder runs (`mergeStateStatus: BEHIND`), with no file-level overlap against this PR's 37 files; freshness is left to the merge queue rather than a rebase. - ENUM/SET declarations whose labels explicitly contain a comma remain split-interpreted end to end (metadata, `SHOW CREATE TABLE` and accepted values). This is the pre-existing `attr_enum` comma-join catalog encoding (unchanged base behavior); the boundary is documented in the design note (sections 2.3/4.3/8), pinned by `TestInternalDeclaredLabelEncodingBoundaryOracle` and `TestIssue30936DeclaredLabelEncodingBoundary`, and scheduled as a separate gated catalog-format follow-up. - Convergence is framework-timed by design: until a given pre-existing account's hop leg completes, that account keeps serving its pre-correction (readable) values - the same convergence timing every version-held correction has. --------- Co-authored-by: XuPeng-SH <[email protected]>
…schema information_schema.TABLES rendered TABLE_ROWS/AVG_ROW_LENGTH/DATA_LENGTH/ INDEX_LENGTH as literal zeros and STATISTICS/SHOW INDEX rendered CARDINALITY as a literal zero even for populated, analyzed tables, because the public projections never consulted the engine's table statistics (tracked by matrixorigin#30910, also covering matrixorigin#31752/matrixorigin#31878/matrixorigin#31164). Publish the maintained statistics through the new resolver builtins (mo_table_rows/mo_table_data_size/mo_table_index_size/mo_table_col_ndv/ mo_table_col_nullcnt): TABLES and SHOW TABLE STATUS report real row and byte estimates without double counting, STATISTICS and SHOW INDEX report per-part cardinality estimates (distinct plus one NULL value group, NULL for an unavailable estimate or composite/prefix part), subscription-published views bake the publisher account identity into their persisted bodies, the session-cached subscription executor's use region is serialized against interleaving sibling scopes of one statement, stats persistence and subscription resolution escape quoted identifiers, and the repaired TABLES/STATISTICS definitions reach existing tenants through the bootstrap version registry, CREATE ACCOUNT initialization and the CN startup system-view refresh rail. Rebased onto current main, merging this PR with the sibling STATISTICS work that landed in the meantime (matrixorigin#31489/matrixorigin#31662/matrixorigin#31488): - the byte-stable historical STATISTICS template stays exactly as main persists it (CARDINALITY = 0, SUB_PART = NULL); cardinality publication and the numeric SUB_PART expression derive from the current prefix-Sub_part template only; - the periodic information_schema maintenance owner deleted upstream (matrixorigin#31662) is not reintroduced: existing tenants are repaired through the 4.0.7 tenant upgrade entry, CREATE ACCOUNT bootstrap and the CN startup InitSystemViews rail, mirroring main's PARTITIONS pattern; - the new builtin ids are renumbered (636-639) behind main's function id ledger; every reference stays by name; - estimator paths honor main's index-relation definition-access validation, including publisher-side relation identity checks for subscribed tables; the gomock fixtures are extended for those guarded calls. The affected BVT goldens are regenerated under the merged semantics (numeric SHOW INDEX Sub_part, published CARDINALITY estimates). Suits whose rows fail identically on current main against main's own goldens (pre-existing upstream golden drift, verified row-by-row against a baseline build of this main tip) are left untouched rather than modernized here. Related to matrixorigin#30910
What type of PR is this?
Which issue(s) this PR fixes:
Related to #31160
Related to #31163
Related to #27655
What this PR does / why we need it:
The 4.0.7 tenant upgrade already refreshes COLUMNS and TABLES. Remove their recurring tenant scan, process-local state, wiring, and dedicated tests.
CREATE ACCOUNT previously could fall back to predecessor views after capability discovery failed while still committing the final catalog version. Without the scan, those accounts would retain incorrect TABLES metadata because normal tenant upgrades skip current accounts. Initialize the complete current information-schema set instead; unavailable, incomplete, or insufficient capability now aborts the account transaction. Publication relation discovery uses the same current definition set.
Availability change: CREATE ACCOUNT on the new CN returns an error while the required capability is unavailable, including during a mixed-version interval; retry after readiness recovers. This change does not introduce an older-catalog initializer or lower the account version marker. Existing tenant upgrades and the VIEWS metadata fixes remain intact.
Validation:
No cross-binary 4.2.6 upgrade or mixed-binary cluster test was run.