Skip to content

fix(embed): preserve base cluster startup errors - #26203

Merged
XuPeng-SH merged 8 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-25929
Jul 28, 2026
Merged

XuPeng-SH merged 8 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-25929

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Jul 27, 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 #25929

What this PR does / why we need it:

RunBaseClusterTests stored the base cluster globally but kept its initialization error in a call-local variable. If the first NewCluster or Start attempt failed, sync.Once was permanently consumed. A later call then observed a fresh nil error and dereferenced the still-nil global cluster, replacing the original startup failure with an unrelated nil-pointer panic.

This change:

  • stores the one-time cluster result and initialization error together;
  • reports the same original startup error on every later call without retrying initialization or invoking the test callback;
  • requires a test reporter (t or b) so startup errors are fatal and cannot be discarded by callers;
  • migrates every existing RunBaseClusterTests test and benchmark caller to the non-ignorable API;
  • separates cluster startup and per-test session preparation so the lifecycle is explicit.

The focused regression test invokes a failing initializer twice and verifies that initialization runs once, both calls report the original error, and the test callback is never invoked.

Validation:

  • make build
  • go vet ./pkg/embed ./pkg/tests/ddl ./pkg/tests/issues ./pkg/tests/dml ./pkg/tests/txnexecutor
  • compile all five affected packages with go test ... -run "^$" -count=1
  • go test -v ./pkg/embed -run "^TestOnceClusterReportsInitializationError$" -count=1
  • go test -v ./pkg/embed -run "^TestBaseClusterOnlyStartOnce$" -count=1
  • go test -v ./pkg/tests/dml -run "^TestDataBranchDiffAsFile$" -count=1
  • post-merge caller validation: go test ./pkg/tests/issues -run '^$' -count=1 and go vet ./pkg/tests/issues
  • after the latest main merge, migrated the newly added issue_25986_test.go caller to the required test-reporter API

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

Blocking finding:

[P1] Make all RunBaseClusterTests callers observe the cached startup error. onceCluster.run now returns the stored initialization error before invoking the callback, but this PR updates only TestDataBranchDiffAsFile. Of 45 RunBaseClusterTests occurrences in the tree (including the helper definition), only 3 calls are wrapped with require.NoError; roughly 41 test/benchmark call sites still discard the return value. If the shared cluster fails to initialize, those callers will skip their entire test callback and still report success. Before this change a later call at least panicked, so the suite could not go green without running its assertions. Please update every caller to fail on the returned error, or change the helper API to report the error through testing.TB/another non-ignorable mechanism.

The focused regression test, build, vet, DML compile check, diff check, and current CI all pass on 6c5531e; this issue concerns the failure path that normal green CI does not exercise.

@gouhongshen

Copy link
Copy Markdown
Contributor Author

Addressed in 78524340d. The finding is valid: caching the startup error while leaving callers free to discard it could turn an initialization failure into a false PASS.

RunBaseClusterTests now requires a test reporter and calls Fatalf with the cached original error before any test callback can run. All 44 existing test/benchmark call sites now pass t or b, so there are no remaining callers using the ignorable-error API. The regression test now verifies both the first and repeated failure reports, one initializer invocation, and zero callback invocations.

Verified with all five affected packages compiled, vet across those packages, make build, the real cluster reuse test, and TestDataBranchDiffAsFile.

@mergify

mergify Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-28 07:20 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ❌ Checks failed · in-place
  • 🚫 Left the queue — 2026-07-28 09:22 UTC · at ba30095f8f02c2744595e87d75fa52cccd9b901a

This pull request spent 2 hours 1 minute 13 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • 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)
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of: [🛡 GitHub branch protection]
    • 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)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
All conditions
  • any of [🛡 GitHub branch protection]:
    • 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)
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • 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)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection] (documentation)
  • github-review-decision = APPROVED [🛡 GitHub branch protection] (documentation)

Reason

The merge conditions cannot be satisfied due to failing checks

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.

Requeued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-28 11:21 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-07-28 13:06 UTC · at 57f69ee16f07d27149347297cdbd885c8e43b56c

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

Reason

The pull request can't be updated

This pull request seems to come from a fork, and Mergify needs the author's permission to update its branch.
The author needs to enable "Allow edits from maintainers" on this pull request, or update the branch manually.

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

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

  • Requeue this pull request

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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: TestDataBranchDiffAsFile panics in RunBaseClusterTests cleanup

3 participants