Skip to content

test: isolate cluster restore from shared issue tests - #28019

Merged
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
gouhongshen:agent/issue-28010-e58049f2
Sep 2, 2026
Merged

mergify[bot] merged 1 commit into
matrixorigin:mainfrom
gouhongshen:agent/issue-28010-e58049f2

Conversation

@gouhongshen

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 #28010

What this PR does / why we need it:

Root cause

TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges runs a full-cluster restore against the base cluster returned by embed.RunBaseClusterTests. A full-cluster restore replaces cluster-wide catalog tables, including mo_catalog.mo_role_privs. SharedTestCluster.Run keeps that cluster alive for subsequent issue tests and does not rebuild it after the callback changes catalog state or times out.

In CI run 33618283377, the restore path replaced mo_catalog.mo_role_privs; subsequent unrelated tests using the shared sys:dump / moadmin session failed with Error 20101 (do not have privilege to execute the statement) during normal DDL and account setup or cleanup. The failure therefore came from sharing a cluster across a destructive full-cluster restore, not from the unrelated Data Branch changes.

Changes

  • Move only TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges into the existing pkg/tests/issues/isolated package.
  • Start a dedicated two-CN test cluster with the authentication, lock-service, and Iceberg settings required by the original test, wait for system bootstrap, and close the cluster with test cleanup.
  • Preserve the original full SQL scenario and assertions for account ID remapping, publication metadata rebinding, subscription privilege object rebinding, and reader access.
  • Keep the account-scoped [Bug]: Cross-account account snapshot restore leaves table grants bound to source object IDs #26640 restore and PITR tests on the shared base-cluster helper because they do not perform a full-cluster catalog replacement.

No production code or SQL behavior is changed.

Issue-to-test proof

The moved regression test creates publisher and subscriber accounts, a publication and subscription, roles and grants, takes a cluster snapshot, drops both accounts, restores the full cluster, and verifies:

  • restored account IDs differ from the source IDs;
  • publication account and database IDs point to the restored objects;
  • the subscription role privilege object ID points to the restored subscription database;
  • the restored subscription reader can query the expected row.

The test now owns its cluster lifecycle in the isolated package, which has no shared base cluster. This prevents a failed or catalog-mutating full-cluster restore from affecting unrelated issue tests while retaining direct executable coverage of the original reproduction.

BVT is not appropriate for this change: no production SQL contract changed, and the behavior under test is test-cluster ownership and lifecycle isolation.

Tests run

  • .agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/tests/issues/isolated -short -run '^TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges$' -count=1 -timeout=15m — passed on the final head, 26.185s.
  • .agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/tests/issues/isolated -race -short -run '^TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges$' -count=1 -timeout=15m — passed, 112.612s.
  • Full normal runs for pkg/tests/issues and pkg/tests/issues/isolated — passed, 85.837s and 261.079s respectively.
  • Full race runs for pkg/tests/issues and pkg/tests/issues/isolated — passed, 512.671s and 317.342s respectively.
  • go vet ./pkg/tests/issues ./pkg/tests/issues/isolated with the repository CGo include and linker flags — passed.
  • git diff --check origin/main...HEAD — passed.

The full package runs were completed before the final rebase onto the latest origin/main; the rebase added only upstream commit #28009, and the focused normal and race tests were rerun on the final head.

Residual risks

  • The isolated test starts one additional two-CN cluster. Its final focused normal run took 26.185s; this is the necessary cost of preventing shared-cluster catalog contamination.
  • Full-cluster restore remains a long-running integration path with the original bounded 300-second test context and can still expose genuine restore failures.
  • Because this is a test-fixture isolation change, any remaining CI privilege cascade would indicate another test mutating the shared base cluster.

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

Reviewed exact head d8c1ad4.

The change preserves the original #26640 SQL scenario and moves only the destructive full-cluster restore case from the shared base fixture to a dedicated two-CN cluster. I checked the lifecycle counterexamples: partial cluster startup registers cleanup for a non-nil cluster; assertion/timeout/restore failure still reaches cluster Close; and even if the restored catalog prevents SQL cleanup, destroying the dedicated cluster prevents privilege/catalog state from escaping into later issue tests. The moved case remains selected in CI and retains the account-ID, publication/database-ID, privilege-object-ID, and reader-access oracles.

The extra cluster startup is a bounded test-only cost (about 26s in the reported focused run), justified by the isolation boundary. Exact-head focused normal/race evidence and the substantive CI checks are green. No correctness, lifecycle, coverage, or performance blocker found.

@mergify mergify Bot added the queued label Sep 2, 2026
@mergify

mergify Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-02 14:51 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-02 14:51 UTC · at 3ec2c2524f88cb3365b9bc464d02458c9a77798a · squash

This pull request spent 28 seconds in the queue, including 5 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 / 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 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 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 Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • 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 3ec2c25 into matrixorigin:main Sep 2, 2026
49 of 50 checks passed
@mergify mergify Bot removed the queued label Sep 2, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…8019)

### Root cause

`TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges` runs a full-cluster restore against the base cluster returned by `embed.RunBaseClusterTests`. A full-cluster restore replaces cluster-wide catalog tables, including `mo_catalog.mo_role_privs`. `SharedTestCluster.Run` keeps that cluster alive for subsequent issue tests and does not rebuild it after the callback changes catalog state or times out.

In CI run 33618283377, the restore path replaced `mo_catalog.mo_role_privs`; subsequent unrelated tests using the shared `sys:dump` / `moadmin` session failed with Error 20101 (`do not have privilege to execute the statement`) during normal DDL and account setup or cleanup. The failure therefore came from sharing a cluster across a destructive full-cluster restore, not from the unrelated Data Branch changes.

### Changes

- Move only `TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges` into the existing `pkg/tests/issues/isolated` package.
- Start a dedicated two-CN test cluster with the authentication, lock-service, and Iceberg settings required by the original test, wait for system bootstrap, and close the cluster with test cleanup.
- Preserve the original full SQL scenario and assertions for account ID remapping, publication metadata rebinding, subscription privilege object rebinding, and reader access.
- Keep the account-scoped matrixorigin#26640 restore and PITR tests on the shared base-cluster helper because they do not perform a full-cluster catalog replacement.

No production code or SQL behavior is changed.

### Issue-to-test proof

The moved regression test creates publisher and subscriber accounts, a publication and subscription, roles and grants, takes a cluster snapshot, drops both accounts, restores the full cluster, and verifies:

- restored account IDs differ from the source IDs;
- publication account and database IDs point to the restored objects;
- the subscription role privilege object ID points to the restored subscription database;
- the restored subscription reader can query the expected row.

The test now owns its cluster lifecycle in the isolated package, which has no shared base cluster. This prevents a failed or catalog-mutating full-cluster restore from affecting unrelated issue tests while retaining direct executable coverage of the original reproduction.

BVT is not appropriate for this change: no production SQL contract changed, and the behavior under test is test-cluster ownership and lifecycle isolation.

### Tests run

- `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/tests/issues/isolated -short -run '^TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges$' -count=1 -timeout=15m` — passed on the final head, 26.185s.
- `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/tests/issues/isolated -race -short -run '^TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges$' -count=1 -timeout=15m` — passed, 112.612s.
- Full normal runs for `pkg/tests/issues` and `pkg/tests/issues/isolated` — passed, 85.837s and 261.079s respectively.
- Full race runs for `pkg/tests/issues` and `pkg/tests/issues/isolated` — passed, 512.671s and 317.342s respectively.
- `go vet ./pkg/tests/issues ./pkg/tests/issues/isolated` with the repository CGo include and linker flags — passed.
- `git diff --check origin/main...HEAD` — passed.

The full package runs were completed before the final rebase onto the latest `origin/main`; the rebase added only upstream commit matrixorigin#28009, and the focused normal and race tests were rerun on the final head.

### Residual risks

- The isolated test starts one additional two-CN cluster. Its final focused normal run took 26.185s; this is the necessary cost of preventing shared-cluster catalog contamination.
- Full-cluster restore remains a long-running integration path with the original bounded 300-second test context and can still expose genuine restore failures.
- Because this is a test-fixture isolation change, any remaining CI privilege cascade would indicate another test mutating the shared base cluster.

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…8019)

### Root cause

`TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges` runs a full-cluster restore against the base cluster returned by `embed.RunBaseClusterTests`. A full-cluster restore replaces cluster-wide catalog tables, including `mo_catalog.mo_role_privs`. `SharedTestCluster.Run` keeps that cluster alive for subsequent issue tests and does not rebuild it after the callback changes catalog state or times out.

In CI run 33618283377, the restore path replaced `mo_catalog.mo_role_privs`; subsequent unrelated tests using the shared `sys:dump` / `moadmin` session failed with Error 20101 (`do not have privilege to execute the statement`) during normal DDL and account setup or cleanup. The failure therefore came from sharing a cluster across a destructive full-cluster restore, not from the unrelated Data Branch changes.

### Changes

- Move only `TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges` into the existing `pkg/tests/issues/isolated` package.
- Start a dedicated two-CN test cluster with the authentication, lock-service, and Iceberg settings required by the original test, wait for system bootstrap, and close the cluster with test cleanup.
- Preserve the original full SQL scenario and assertions for account ID remapping, publication metadata rebinding, subscription privilege object rebinding, and reader access.
- Keep the account-scoped matrixorigin#26640 restore and PITR tests on the shared base-cluster helper because they do not perform a full-cluster catalog replacement.

No production code or SQL behavior is changed.

### Issue-to-test proof

The moved regression test creates publisher and subscriber accounts, a publication and subscription, roles and grants, takes a cluster snapshot, drops both accounts, restores the full cluster, and verifies:

- restored account IDs differ from the source IDs;
- publication account and database IDs point to the restored objects;
- the subscription role privilege object ID points to the restored subscription database;
- the restored subscription reader can query the expected row.

The test now owns its cluster lifecycle in the isolated package, which has no shared base cluster. This prevents a failed or catalog-mutating full-cluster restore from affecting unrelated issue tests while retaining direct executable coverage of the original reproduction.

BVT is not appropriate for this change: no production SQL contract changed, and the behavior under test is test-cluster ownership and lifecycle isolation.

### Tests run

- `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/tests/issues/isolated -short -run '^TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges$' -count=1 -timeout=15m` — passed on the final head, 26.185s.
- `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/tests/issues/isolated -race -short -run '^TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges$' -count=1 -timeout=15m` — passed, 112.612s.
- Full normal runs for `pkg/tests/issues` and `pkg/tests/issues/isolated` — passed, 85.837s and 261.079s respectively.
- Full race runs for `pkg/tests/issues` and `pkg/tests/issues/isolated` — passed, 512.671s and 317.342s respectively.
- `go vet ./pkg/tests/issues ./pkg/tests/issues/isolated` with the repository CGo include and linker flags — passed.
- `git diff --check origin/main...HEAD` — passed.

The full package runs were completed before the final rebase onto the latest `origin/main`; the rebase added only upstream commit matrixorigin#28009, and the focused normal and race tests were rerun on the final head.

### Residual risks

- The isolated test starts one additional two-CN cluster. Its final focused normal run took 26.185s; this is the necessary cost of preventing shared-cluster catalog contamination.
- Full-cluster restore remains a long-running integration path with the original bounded 300-second test context and can still expose genuine restore failures.
- Because this is a test-fixture isolation change, any remaining CI privilege cascade would indicate another test mutating the shared base cluster.

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…8019)

### Root cause

`TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges` runs a full-cluster restore against the base cluster returned by `embed.RunBaseClusterTests`. A full-cluster restore replaces cluster-wide catalog tables, including `mo_catalog.mo_role_privs`. `SharedTestCluster.Run` keeps that cluster alive for subsequent issue tests and does not rebuild it after the callback changes catalog state or times out.

In CI run 33618283377, the restore path replaced `mo_catalog.mo_role_privs`; subsequent unrelated tests using the shared `sys:dump` / `moadmin` session failed with Error 20101 (`do not have privilege to execute the statement`) during normal DDL and account setup or cleanup. The failure therefore came from sharing a cluster across a destructive full-cluster restore, not from the unrelated Data Branch changes.

### Changes

- Move only `TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges` into the existing `pkg/tests/issues/isolated` package.
- Start a dedicated two-CN test cluster with the authentication, lock-service, and Iceberg settings required by the original test, wait for system bootstrap, and close the cluster with test cleanup.
- Preserve the original full SQL scenario and assertions for account ID remapping, publication metadata rebinding, subscription privilege object rebinding, and reader access.
- Keep the account-scoped matrixorigin#26640 restore and PITR tests on the shared base-cluster helper because they do not perform a full-cluster catalog replacement.

No production code or SQL behavior is changed.

### Issue-to-test proof

The moved regression test creates publisher and subscriber accounts, a publication and subscription, roles and grants, takes a cluster snapshot, drops both accounts, restores the full cluster, and verifies:

- restored account IDs differ from the source IDs;
- publication account and database IDs point to the restored objects;
- the subscription role privilege object ID points to the restored subscription database;
- the restored subscription reader can query the expected row.

The test now owns its cluster lifecycle in the isolated package, which has no shared base cluster. This prevents a failed or catalog-mutating full-cluster restore from affecting unrelated issue tests while retaining direct executable coverage of the original reproduction.

BVT is not appropriate for this change: no production SQL contract changed, and the behavior under test is test-cluster ownership and lifecycle isolation.

### Tests run

- `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/tests/issues/isolated -short -run '^TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges$' -count=1 -timeout=15m` — passed on the final head, 26.185s.
- `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/tests/issues/isolated -race -short -run '^TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges$' -count=1 -timeout=15m` — passed, 112.612s.
- Full normal runs for `pkg/tests/issues` and `pkg/tests/issues/isolated` — passed, 85.837s and 261.079s respectively.
- Full race runs for `pkg/tests/issues` and `pkg/tests/issues/isolated` — passed, 512.671s and 317.342s respectively.
- `go vet ./pkg/tests/issues ./pkg/tests/issues/isolated` with the repository CGo include and linker flags — passed.
- `git diff --check origin/main...HEAD` — passed.

The full package runs were completed before the final rebase onto the latest `origin/main`; the rebase added only upstream commit matrixorigin#28009, and the focused normal and race tests were rerun on the final head.

### Residual risks

- The isolated test starts one additional two-CN cluster. Its final focused normal run took 26.185s; this is the necessary cost of preventing shared-cluster catalog contamination.
- Full-cluster restore remains a long-running integration path with the original bounded 300-second test context and can still expose genuine restore failures.
- Because this is a test-fixture isolation change, any remaining CI privilege cascade would indicate another test mutating the shared base cluster.

Approved by: @XuPeng-SH

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

kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants