Skip to content

fix(view): preserve restore semantics and extend S5 conformance - #30953

Merged
XuPeng-SH merged 10 commits into
matrixorigin:mainfrom
ck89119:issue-29440-main
Oct 26, 2026
Merged

XuPeng-SH merged 10 commits into
matrixorigin:mainfrom
ck89119:issue-29440-main

Conversation

@ck89119

@ck89119 ck89119 commented Oct 23, 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 #29440, under #29433.

What this PR does / why we need it:

Partial S5 delivery; keep this PR Draft and #29440 open. Full S5 acceptance is not complete, and S8 rollout remains NO-GO.

Changes

  • Preserve restored View security, creation context, unknown JSON fields, legacy absence/null distinctions, and the greater original/rebuilt protocol requirement. Admin replay must not silently turn INVOKER into DEFINER or qualify an unfrozen legacy star.
  • Bind the saved creation database and identifier policy before generating physical columns/dependencies, including all three restore dependency-sort owners. A View's containing database is not necessarily its creation database.
  • Let the clone owner remap only its explicit source-to-target creation database; preserve external dependencies and saved SQL parser policy.
  • Extend explicit S3/S4 conformance across INPLACE/COPY/recreation, RC statement advancement, historical snapshots/templates, authorization/publication changes, clone/PITR/account recovery, and two-CN origin ownership.
  • Add default-disabled, integration-only protocol wiring through the existing planning and parameterized execution owners. Real TCP tests cover QUERY/PREPARE/EXECUTE/FETCH/CLOSE, materialized cursor stability, transitive reprepare, and execution-time COPY forcing the actual compile retry path. Ordinary builds have constant-false hooks and no activation registry.
  • Exercise both origin CNs, TP/AP, and memo-on/off; executed remote-worker reports prove metadata APPLY remains on the origin.
  • Capture definitions and the system template from the actual official v4.2.6 linux/arm64 binary. This is L evidence, not an A/B upgrade or activation claim.

Validation

The earlier full closure validation below used upstream main@5fb586e1429386260b900171f65ffa844f49c981. Its results are historical, not a blanket current-source claim after the subsequent parser repair. Tooling: Go 1.27.1, matching gofmt, golangci-lint 2.14.0, and the repository CGo wrapper with verified native prerequisites. Current review-fix validation is listed separately below.

  • Focused restore/legacy tests: 7 top-level selections, 50 named results, PASS.
  • Complete owning packages: plan 19.483s and frontend 23.867s, PASS.
  • Three opt-in native suites: 136 named results, 24.298s, PASS.
  • Public SQL/privilege/subscription controls: 9.713s; default two-CN control: 8.425s, PASS.
  • Integration vet/lint, gofmt, diff check, and ordinary service build: PASS.
  • Changed executable-line coverage: ordinary production 141/149 (94.63%); including integration wiring 184/197 (93.40%). This is a diff/block intersection, not package-wide coverage. All 13 changed non-test Go files are accounted for.
  • Adaptive exact-test race validation: warm cancellation T=0.01s/N=100; planning cancel/close 0.01s/100; native Catalog 34.92s/1; Subscription 31.60s/1; TwoCN 12.10s/2. Each final stress command uses one exact test, one process, and a 120s timeout; B=30s. Complete integration owning-package race runs also pass: plan 116.576s, frontend 187.168s.
  • mo-tester regenerated the expanded restore_account_privileges.result from the current ordinary binary. Strict restore_account_privileges and view_metadata_on_demand runs pass. The result includes INVOKER denial before/cross-account/after same-account restore and bigint/11 creation-domain checks against an int/22 decoy.
  • Supplemental grant_view -n passes authorization/rows, not strict metadata. An earlier baseline overlay reproduced its 11 strict metadata-width differences, plus two INVOKER restore failures absent from the candidate; no strict-pass claim is made for this supplemental case.

Source fingerprints, nonempty selections, terminal events, commands, coverage profiles, binary/result hashes, failures, and the full ownership/unhappy-path review are retained locally. The final plan-test-only cleanup change was revalidated; unchanged frontend/native binaries do not compile plan _test.go. Owned BVT services and the temporary port-lease guard have been stopped. Local results are not a claim that remote CI is green.

P2 review follow-up: actual restore execution parser

Merged upstream main@be663676872edf6d42695bba41757af0a3251758. This closes an incomplete path in this PR's restore repair; it is not claimed to be a newly introduced regression.

The preliminary parse already used the saved identifier policy, but GetComputationWrapperInBack parsed again using the restore session's mode. A mode-1 MixedView therefore became a different target name, bypassing scoped metadata preservation. The actual execution parse now reads the saved policy for the exact replay SQL, without session/global mutation or weaker identity matching.

  • The execution-wrapper UT failed before the repair, then passed for modes 0/1/2, missing/null context, ordinary/different SQL, and malformed/invalid saved policy. Current focused selection: 6 top-level tests, 3.087s; complete frontend package: 19.257s. Current gofmt/vet/lint (0 issues) and ordinary build pass.
  • A real instance of the previously delivered ordinary binary reproduces missing mixedview and persisted DEFINER/app/app instead of INVOKER/creation_env/creation_env; the lowercase control remains correct.
  • The extended account-restore BVT checks mixed-case and lowercase views before restore, after cross-account restore, and after same-account restore: bigint/11 rows, canonical names, INVOKER, saved creation/dependency database, and reader denial without base grants. lower(relname) ensures the catalog oracle cannot silently omit a wrongly cased object.
  • Current result was regenerated with mo-tester and reviewed. Two strict runs pass on the same clean owned instance: 96/96 checks each. After generation and both runs, independent teardown queries confirm zero test accounts and snapshots. The service was stopped afterward.
  • New production cover blocks: 3/3 statements (100%). This sequential parser change introduces no shared state, asynchronous lifetime, topology, activation, or rollback contract; no unrelated race/topology rerun is claimed as proof.

Remaining acceptance boundaries

Still missing: a frozen supported L/A/B artifact/config matrix; the complete approved executable B candidate; real version transitions, two-commit interruption/restart/drain, rollback denial, and old-process reentry fencing; and the remaining historical-authorization/restore/failure combinations. Failed artifact-inventory requests are not evidence of artifact absence.

Same-binary multi-CN tests, component admission tests, historical templates, and isolated protocol wiring are not substitutes for those gates. Production S3/S4 activation stays off. No S8 refresh retirement, S9 cleanup, partition/stored-procedure/UDF scope expansion, or warning text/count compatibility changes are included. Changes to approved security, persistence, activation, or rollback contracts still require separate approval.

Design, evidence map, uncovered boundaries, and ownership review: S5 conformance.

Add deterministic opt-in DDL, snapshot, restore, warm-memo failure and cancellation coverage. Record the S5 evidence matrix and remaining activation/version gates without enabling production routing. Related to matrixorigin#29440.
@mergify mergify Bot added the kind/documentation Improvements or additions to documentation label Oct 23, 2026
@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Oct 23, 2026
@mergify mergify Bot added the kind/test-ci label Oct 23, 2026
Preserve restored security and creation environments, keep clone mappings explicit, and validate real prepared execution/retry through default-disabled integration wiring.

Related to matrixorigin#29440. Full S5 acceptance remains incomplete; production activation stays disabled.
@ck89119 ck89119 changed the title test(view): extend S5 metadata conformance coverage fix(view): preserve restore semantics and extend S5 conformance Oct 23, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Oct 23, 2026
@matrix-meow matrix-meow added size/XXL Denotes a PR that changes 2000+ lines and removed size/M Denotes a PR that changes [100,499] lines labels Oct 23, 2026
Use the persisted identifier policy when the background executor produces the actual AST, not only during preliminary classification. Cover mixed-case and lowercase account restore through real SQL, with security and creation-domain checks.

Related to matrixorigin#29440.

@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.

Incremental static review of head af46e83ced44eac7b33950a34fb9b53ca2535e87.

The latest commit closes the reported mixed-case restore gap at the actual execution parser: GetComputationWrapperInBack now asks RestoredViewLowerCaseTableNames for the exact replay SQL before constructing the AST. The helper is context-scoped, requires exact SQL equality, treats absent/null legacy policy as fallback, and rejects malformed or out-of-range saved policy; the new unit cases assert the executed AST name and that the session mode is unchanged. The expanded restore BVT checks both mixed-case and lowercase objects, persisted INVOKER/creation/dependency metadata, and reader denial. I found no new source-level blocker in this incremental parser fix.

This is a COMMENT, not approval of the full S5 work. The PR remains Draft and explicitly says full S5 acceptance is incomplete and S8 rollout is NO-GO; the supported L/A/B transition matrix, interruption/restart/drain, rollback denial and old-process fencing remain acceptance gaps. Issue #29440 remains open. This workspace has no MatrixOne checkout or Go toolchain, so I did not execute the tests; the focused UT/BVT results and binary repro in the PR description are author-reported. Exact-head combined status is empty; the only returned workflow run is unrelated Iceberg Connector E2E, which succeeded.

@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 Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 3f43b78b5e0ec16ae70acce734bd2f6e38fbc4ee

Review completed. Read the assessment.

@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.

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

Commit: 3f43b78b5e0ec16ae70acce734bd2f6e38fbc4ee

Assessment: approve

Reviewed the complete 28-file delta and affected callers. The scoped restore context preserves creation semantics before binding, while existing owners retain authorization, dependency generation and cleanup. Test-only routing shares the established planning implementation. No actionable defects remain within this partial S5 delivery.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Reused frozen current-head successful unit-test, static-analysis and BVT records.

  • Isolation preflight passed. Rebuilt native prerequisites through repository make cgo with matching provenance in an exact-source diagnostic copy.

  • Three integration suites passed: 136 named results in 29.087 seconds, covering wire execution, cursor stability, compile retry, restore/security, historical metadata and two-CN ownership.

  • Race checks passed: catalog/protocol and subscription suites individually; two-CN ownership repeated twice; cancellation repeated 100 times.

  • Verified source-copy identity, clean assigned checkout and diff-check. Reconciled commands, source fingerprints, exit receipts and retained logs in /home/xupeng/.local/state/mo-bot/jobs/671702a1013750f8b41e506d/attempt-1/receipt-index.json.

Limitations:

  • Approval covers this partial delivery. Full S5 version-transition, interruption/restart, rollback and old-process fencing validation remains outstanding; S8 rollout is not established.

  • Historical author logs were unavailable and were not treated as current-head execution proof. Performance was assessed through call-path inspection; no benchmark improvement is claimed.

@mergify mergify Bot added the queued label Oct 26, 2026
@mergify

mergify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-26 04:51 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ❌ Checks failed · in-place
  • 🚫 Left the queue — 2026-10-26 06:28 UTC · at 3ddd0a622f98a2c4ba6f7d2a6d4b8e3bc734483f

This pull request spent 1 hour 37 minutes 9 seconds in the queue, with no time running CI.

Reason

The merge conditions cannot be satisfied due to failing checks

  • CI Required

Failing checks:

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit 83c1e23 into matrixorigin:main Oct 26, 2026
5 of 6 checks passed

This branch had an error being deployed

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

Labels

kind/bug Something isn't working kind/documentation Improvements or additions to documentation kind/test-ci size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants