Skip to content

test(embed): isolate shared test-cluster lifecycles (#26522) - #26752

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-26522-lifecycle-fix
Aug 7, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-26522-lifecycle-fix

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Aug 6, 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:

Fixes #26522

What this PR does / why we need it:

The post-merge recurrence was not only cross-process parallelism. In the serial Ubuntu/x86 stage, pkg/tests/issues retained its 3-CN shared base cluster and a following test started a bespoke 1-CN cluster. Admission was reentrant in one test binary, so the runner-wide lock did not see six live services.

This PR makes complete test-cluster lifetime exclusive by default, without repeatedly stopping and rebuilding the issues package's shared base:

  • Reject an implicit second complete cluster in one test process. Only tests whose assertion genuinely needs multiple complete clusters use WithConcurrentTestClusters.
  • Move the three bespoke-configuration issue regressions to pkg/tests/issues/isolated, a separate test binary. It has no shared base cluster.
  • Put that package in run_ut.sh's existing serial race-test scope, so it is explicitly scheduled as an embedded-cluster workload.
  • Extract the shared join-spill SQL helpers into an issues/internal package; the original shared-base regression and the isolated regressions use the same implementation.

No production HAKeeper timeout, heartbeat, RPC, or retry behavior changes. #26566 remains the separate production command-progress design issue.

Validation:

  • go test -count=1 ./pkg/testutil/clusteradmission
  • .agents/skills/mo-dev/scripts/mo-cgo-test -run '^$' ./pkg/embed ./pkg/tests/issues ./pkg/tests/issues/isolated ./pkg/tests/service ./pkg/tests/issues/internal/joinspill
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestHashBuildSharedBudgetRecoverySQL|TestIssue25782BroadcastHashBuildFailsClosedUnderHardBudget|TestSpeedupAbortAllTxn)$' ./pkg/tests/issues/isolated (41.4s)
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestAuthenticatedTestsReuseBaseCluster|TestIssue25526PreparedUpdateJoinSecondExecute|TestIssue25753PreparedNumericProtocolLifecycle|TestIssue26408JoinSpillSQLRegression)$' ./pkg/tests/issues (18.3s)
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^TestIssue26568ExplainMultiCNHashJoin$' ./pkg/tests/issues
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^TestStartTestClusterReturnsCleanupOwnerOnRollbackFailure$' ./pkg/embed
  • bash -n optools/run_ut.sh and the serial package-list resolution

Self-review:

  • Scope is limited to embedded test-cluster admission and test placement. No production code path changed.
  • The isolated regressions retain their original test names and assertions; only their process lifetime changed.
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestClusterAdmissionCoversFullLifecycle|TestDoStartLockedErrorPaths|TestClusterStartRollbackClosesPartiallyStartedServices|TestStartTestClusterReturnsCleanupOwnerOnRollbackFailure)$' ./pkg/embed
  • Recompiled ./pkg/tests/issues, ./pkg/tests/issues/isolated, and ./pkg/tests/issues/internal/joinspill.
  • Fresh Ubuntu/x86 CI is required after 28a824a78d; the preceding run failed only in PR test scaffolding (four pkg/embed assertions and one unused alias), not with the [Bug]: Embedded-cluster UTs still lose HAKeeper connections under Ubuntu/x86 load #26522 runtime signature. No automatic retry was performed.

@gouhongshen
gouhongshen force-pushed the agent/issue-26522-lifecycle-fix branch from 9cb7a17 to 2351e16 Compare August 6, 2026 08:18
@matrix-meow matrix-meow added size/L Denotes a PR that changes [500,999] lines and removed size/M Denotes a PR that changes [100,499] lines labels Aug 6, 2026
@gouhongshen
gouhongshen marked this pull request as ready for review August 6, 2026 08:28
@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 →

@gouhongshen
gouhongshen marked this pull request as ready for review August 7, 2026 07:09
@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.

Deep-reviewed the complete diff and latest head 8e0b8f6. No blocking findings.

The lifecycle contract is coherent:

  • the first complete test cluster owns the runner-wide flock for its full lifetime;
  • an implicit same-process second cluster fails fast;
  • only explicit multi-cluster tests may add reentrant leases;
  • the final lease releases the flock;
  • startup/close failures retain the cleanup owner and admission until cleanup actually succeeds.

The three bespoke issues regressions are moved to a separate package without weakening their assertions, the shared join-spill helpers preserve behavior, and the new package is removed from the parallel race scope and run in the existing serial scope. This appropriately fixes the test-cluster resource-concurrency problem without changing or masking the separate production HAKeeper command-progress contract tracked by #26566.

Fresh validation on this head:

  • diff check and bash -n optools/run_ut.sh;
  • package-list and serial-scope resolution;
  • build/vet for all affected packages;
  • clusteradmission unit tests and race x20;
  • focused embed admission/rollback/cleanup tests;
  • TestMultiClusterCanWork and TestBaseClusterCanWorkWithNewCluster.
    All passed. CI is also green.

@mergify mergify Bot added the queued label Aug 7, 2026
@mergify

mergify Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-07 08:02 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-08-07 08:02 UTC · at 8e0b8f6f8e7c81744bba966273819e1a3258c641 · squash

This pull request spent 24 seconds in the queue, including 3 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 Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • 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

@mergify
mergify Bot merged commit 8824b6c into matrixorigin:main Aug 7, 2026
25 of 26 checks passed
@mergify mergify Bot removed the queued label Aug 7, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…) (matrixorigin#26752)

The post-merge recurrence was not only cross-process parallelism. In the serial Ubuntu/x86 stage, `pkg/tests/issues` retained its 3-CN shared base cluster and a following test started a bespoke 1-CN cluster. Admission was reentrant in one test binary, so the runner-wide lock did not see six live services.

This PR makes complete test-cluster lifetime exclusive by default, without repeatedly stopping and rebuilding the issues package's shared base:

- Reject an implicit second complete cluster in one test process. Only tests whose assertion genuinely needs multiple complete clusters use `WithConcurrentTestClusters`.
- Move the three bespoke-configuration issue regressions to `pkg/tests/issues/isolated`, a separate test binary. It has no shared base cluster.
- Put that package in `run_ut.sh`'s existing serial race-test scope, so it is explicitly scheduled as an embedded-cluster workload.
- Extract the shared join-spill SQL helpers into an `issues/internal` package; the original shared-base regression and the isolated regressions use the same implementation.

No production HAKeeper timeout, heartbeat, RPC, or retry behavior changes. matrixorigin#26566 remains the separate production command-progress design issue.

Validation:

- [x] `go test -count=1 ./pkg/testutil/clusteradmission`
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -run '^$' ./pkg/embed ./pkg/tests/issues ./pkg/tests/issues/isolated ./pkg/tests/service ./pkg/tests/issues/internal/joinspill`
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestHashBuildSharedBudgetRecoverySQL|TestIssue25782BroadcastHashBuildFailsClosedUnderHardBudget|TestSpeedupAbortAllTxn)$' ./pkg/tests/issues/isolated` (41.4s)
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestAuthenticatedTestsReuseBaseCluster|TestIssue25526PreparedUpdateJoinSecondExecute|TestIssue25753PreparedNumericProtocolLifecycle|TestIssue26408JoinSpillSQLRegression)$' ./pkg/tests/issues` (18.3s)
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^TestIssue26568ExplainMultiCNHashJoin$' ./pkg/tests/issues`
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^TestStartTestClusterReturnsCleanupOwnerOnRollbackFailure$' ./pkg/embed`
- [x] `bash -n optools/run_ut.sh` and the serial package-list resolution

Self-review:

- Scope is limited to embedded test-cluster admission and test placement. No production code path changed.
- The isolated regressions retain their original test names and assertions; only their process lifetime changed.
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestClusterAdmissionCoversFullLifecycle|TestDoStartLockedErrorPaths|TestClusterStartRollbackClosesPartiallyStartedServices|TestStartTestClusterReturnsCleanupOwnerOnRollbackFailure)$' ./pkg/embed`
- [x] Recompiled `./pkg/tests/issues`, `./pkg/tests/issues/isolated`, and `./pkg/tests/issues/internal/joinspill`.
- [ ] Fresh Ubuntu/x86 CI is required after `28a824a78d`; the preceding run failed only in PR test scaffolding (four `pkg/embed` assertions and one unused alias), not with the matrixorigin#26522 runtime signature. No automatic retry was performed.

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

The post-merge recurrence was not only cross-process parallelism. In the serial Ubuntu/x86 stage, `pkg/tests/issues` retained its 3-CN shared base cluster and a following test started a bespoke 1-CN cluster. Admission was reentrant in one test binary, so the runner-wide lock did not see six live services.

This PR makes complete test-cluster lifetime exclusive by default, without repeatedly stopping and rebuilding the issues package's shared base:

- Reject an implicit second complete cluster in one test process. Only tests whose assertion genuinely needs multiple complete clusters use `WithConcurrentTestClusters`.
- Move the three bespoke-configuration issue regressions to `pkg/tests/issues/isolated`, a separate test binary. It has no shared base cluster.
- Put that package in `run_ut.sh`'s existing serial race-test scope, so it is explicitly scheduled as an embedded-cluster workload.
- Extract the shared join-spill SQL helpers into an `issues/internal` package; the original shared-base regression and the isolated regressions use the same implementation.

No production HAKeeper timeout, heartbeat, RPC, or retry behavior changes. matrixorigin#26566 remains the separate production command-progress design issue.

Validation:

- [x] `go test -count=1 ./pkg/testutil/clusteradmission`
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -run '^$' ./pkg/embed ./pkg/tests/issues ./pkg/tests/issues/isolated ./pkg/tests/service ./pkg/tests/issues/internal/joinspill`
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestHashBuildSharedBudgetRecoverySQL|TestIssue25782BroadcastHashBuildFailsClosedUnderHardBudget|TestSpeedupAbortAllTxn)$' ./pkg/tests/issues/isolated` (41.4s)
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestAuthenticatedTestsReuseBaseCluster|TestIssue25526PreparedUpdateJoinSecondExecute|TestIssue25753PreparedNumericProtocolLifecycle|TestIssue26408JoinSpillSQLRegression)$' ./pkg/tests/issues` (18.3s)
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^TestIssue26568ExplainMultiCNHashJoin$' ./pkg/tests/issues`
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^TestStartTestClusterReturnsCleanupOwnerOnRollbackFailure$' ./pkg/embed`
- [x] `bash -n optools/run_ut.sh` and the serial package-list resolution

Self-review:

- Scope is limited to embedded test-cluster admission and test placement. No production code path changed.
- The isolated regressions retain their original test names and assertions; only their process lifetime changed.
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestClusterAdmissionCoversFullLifecycle|TestDoStartLockedErrorPaths|TestClusterStartRollbackClosesPartiallyStartedServices|TestStartTestClusterReturnsCleanupOwnerOnRollbackFailure)$' ./pkg/embed`
- [x] Recompiled `./pkg/tests/issues`, `./pkg/tests/issues/isolated`, and `./pkg/tests/issues/internal/joinspill`.
- [ ] Fresh Ubuntu/x86 CI is required after `28a824a78d`; the preceding run failed only in PR test scaffolding (four `pkg/embed` assertions and one unused alias), not with the matrixorigin#26522 runtime signature. No automatic retry was performed.

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

The post-merge recurrence was not only cross-process parallelism. In the serial Ubuntu/x86 stage, `pkg/tests/issues` retained its 3-CN shared base cluster and a following test started a bespoke 1-CN cluster. Admission was reentrant in one test binary, so the runner-wide lock did not see six live services.

This PR makes complete test-cluster lifetime exclusive by default, without repeatedly stopping and rebuilding the issues package's shared base:

- Reject an implicit second complete cluster in one test process. Only tests whose assertion genuinely needs multiple complete clusters use `WithConcurrentTestClusters`.
- Move the three bespoke-configuration issue regressions to `pkg/tests/issues/isolated`, a separate test binary. It has no shared base cluster.
- Put that package in `run_ut.sh`'s existing serial race-test scope, so it is explicitly scheduled as an embedded-cluster workload.
- Extract the shared join-spill SQL helpers into an `issues/internal` package; the original shared-base regression and the isolated regressions use the same implementation.

No production HAKeeper timeout, heartbeat, RPC, or retry behavior changes. matrixorigin#26566 remains the separate production command-progress design issue.

Validation:

- [x] `go test -count=1 ./pkg/testutil/clusteradmission`
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -run '^$' ./pkg/embed ./pkg/tests/issues ./pkg/tests/issues/isolated ./pkg/tests/service ./pkg/tests/issues/internal/joinspill`
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestHashBuildSharedBudgetRecoverySQL|TestIssue25782BroadcastHashBuildFailsClosedUnderHardBudget|TestSpeedupAbortAllTxn)$' ./pkg/tests/issues/isolated` (41.4s)
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestAuthenticatedTestsReuseBaseCluster|TestIssue25526PreparedUpdateJoinSecondExecute|TestIssue25753PreparedNumericProtocolLifecycle|TestIssue26408JoinSpillSQLRegression)$' ./pkg/tests/issues` (18.3s)
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^TestIssue26568ExplainMultiCNHashJoin$' ./pkg/tests/issues`
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^TestStartTestClusterReturnsCleanupOwnerOnRollbackFailure$' ./pkg/embed`
- [x] `bash -n optools/run_ut.sh` and the serial package-list resolution

Self-review:

- Scope is limited to embedded test-cluster admission and test placement. No production code path changed.
- The isolated regressions retain their original test names and assertions; only their process lifetime changed.
- [x] `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^(TestClusterAdmissionCoversFullLifecycle|TestDoStartLockedErrorPaths|TestClusterStartRollbackClosesPartiallyStartedServices|TestStartTestClusterReturnsCleanupOwnerOnRollbackFailure)$' ./pkg/embed`
- [x] Recompiled `./pkg/tests/issues`, `./pkg/tests/issues/isolated`, and `./pkg/tests/issues/internal/joinspill`.
- [ ] Fresh Ubuntu/x86 CI is required after `28a824a78d`; the preceding run failed only in PR test scaffolding (four `pkg/embed` assertions and one unused alias), not with the matrixorigin#26522 runtime signature. No automatic retry was performed.

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/bug Something isn't working kind/test-ci size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Embedded-cluster UTs still lose HAKeeper connections under Ubuntu/x86 load

3 participants