Repository navigation
test: isolate cluster restore from shared issue tests - #28019
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
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.
Merge Queue Status
This pull request spent 28 seconds in the queue, including 5 seconds running CI. Required conditions to merge
|
…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
…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
…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
What type of PR is this?
Which issue(s) this PR fixes:
Related to #28010
What this PR does / why we need it:
Root cause
TestIssue26640ClusterRestoreRebindsSubscriptionPrivilegesruns a full-cluster restore against the base cluster returned byembed.RunBaseClusterTests. A full-cluster restore replaces cluster-wide catalog tables, includingmo_catalog.mo_role_privs.SharedTestCluster.Runkeeps 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 sharedsys:dump/moadminsession 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
TestIssue26640ClusterRestoreRebindsSubscriptionPrivilegesinto the existingpkg/tests/issues/isolatedpackage.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:
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.pkg/tests/issuesandpkg/tests/issues/isolated— passed, 85.837s and 261.079s respectively.pkg/tests/issuesandpkg/tests/issues/isolated— passed, 512.671s and 317.342s respectively.go vet ./pkg/tests/issues ./pkg/tests/issues/isolatedwith 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