Skip to content

fix: make MySQL task storage close terminal - #27074

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-27072-1a88239e
Aug 13, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-27072-1a88239e

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Aug 12, 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 #27072

What this PR does / why we need it:

Root cause

Embedded CN services use mysqlTaskStorage through database/sql. During cluster shutdown, a pooled task connection can outlive the server endpoint it uses. sql.DB.Close first makes the DB terminal, then closes idle driver connections. The MySQL driver sends a courtesy COM_QUIT; if that write fails because the endpoint has already stopped, it returns errors such as bad connection, but still closes the socket, marks the connection closed, and clears its result state.

mysqlTaskStorage.Close propagated that already-terminal driver error through the task holder and service close chain. The embedded cluster correctly treats a service close error as incomplete ownership cleanup and retains the process-wide complete-cluster admission token, so this false cleanup failure caused every later embedded-cluster test to fail admission.

Changes

  • Make the concrete MySQL task storage treat sql.DB.Close as terminal after invoking it. This is the ownership boundary that knows the driver has no cleanup left to retry.
  • Keep generic task-storage, service-close, and embedded-cluster error handling unchanged, so real service cleanup errors still propagate and retain admission.
  • Add a deterministic regression for the reported bad connection and a second driver write error. It proves the DB is closed after the error and repeated close remains safe.

Issue-to-test proof

  • TestMySQLTaskStorageCloseIsTerminalAfterDriverError injects the exact reported error and a different write error, then proves close succeeds, the DB rejects later use as closed, and close is idempotent. Before the production change, the exact test failed with bad connection.
  • TestBasicCluster exercises the issue's original embedded-cluster functional and shutdown path; it passes under coverage.
  • TestClusterAdmissionCoversFullLifecycle proves admission is released after successful full shutdown.
  • TestClusterCloseContinuesAfterServiceError proves unrelated service close errors still propagate and keep admission held; the fix does not weaken the cluster's cleanup safety rule.

BVT is not applicable because SQL cannot inject a driver Conn.Close failure or observe the process-wide test-cluster admission token. The focused unit test provides deterministic fault injection, and the embedded package tests cover the end-to-end owner chain.

Tests run

On the issue base (6a29b7d47eae06b414cce51ede4a129b6da9b68a), before the final main merges:

  • mo-cgo-test -count=1 -timeout=300s ./pkg/taskservice
  • mo-cgo-test -count=1 -timeout=900s ./pkg/embed
  • mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice
  • mo-cgo-test -race -count=1 -timeout=1800s ./pkg/embed
  • Focused -race stress with a 30-second budget: the storage regression and both admission tests measured below timer resolution and passed with N=100; TestBasicCluster measured 19.25 seconds and passed with N=1.

After rebasing onto main at 1d7b6311ce91df0968da435bb405f3d68137c595:

  • mo-cgo-test -count=1 -timeout=180s -run '^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$' ./pkg/taskservice
  • mo-cgo-test -race -count=100 -timeout=180s -run '^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$' ./pkg/taskservice
  • mo-cgo-test -count=1 -timeout=300s ./pkg/taskservice
  • mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice
  • mo-cgo-test -cover -count=1 -timeout=420s -run '^TestBasicCluster$' ./pkg/embed (64.3% package coverage)
  • go build -mod=readonly ./pkg/taskservice ./pkg/embed with the repository CGo flags
  • go vet -mod=readonly ./pkg/taskservice ./pkg/embed with the repository CGo flags

Final readiness validation on head 4c802c3f1ca6ec3ed36a8d22f3ae6714978e31af, after merging main through bdbd613fdece966769eb68481a3e58bfbc36b30c:

  • Enumerated TestMySQLTaskStorageCloseIsTerminalAfterDriverError before execution.
  • mo-cgo-test -race -count=100 -timeout=180s -run '^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$' ./pkg/taskservice (T below timer resolution, 30-second stress budget, N=100).
  • mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice
  • GOWORK=off go list -mod=readonly ./pkg/taskservice ./pkg/embed
  • GOWORK=off go build -mod=readonly ./pkg/taskservice ./pkg/embed with the repository CGo flags
  • GOWORK=off go vet -mod=readonly ./pkg/taskservice ./pkg/embed with the repository CGo flags
  • git diff --check
  • MatrixOne ALL CI run 31691982155: PR validation, Ubuntu UT, arm64 SCA, UT coverage, Compose Proxy BVT, Compose Pessimistic BVT, and final Coverage all passed.

Self-review

The complete PR diff remains limited to the concrete MySQL task storage and its regression test. database/sql owns concurrent close serialization and marks the DB closed before invoking driver cleanup; the MySQL driver makes connection cleanup idempotent even when COM_QUIT fails. The change adds no waits, goroutines, retained state, allocation growth, wire/storage format, or hot-path work. Generic task storage, CN service, and embedded-cluster cleanup errors retain their existing propagation and admission semantics.

Residual risks

This intentionally stops reporting MySQL driver's courtesy shutdown write errors from task storage. Those errors cannot be retried because database/sql has already closed the DB and the MySQL driver has already released the connection. Errors from task schedulers, runners, stores other than this concrete MySQL storage, and all other embedded services remain unchanged and continue to block admission release.

@gouhongshen

gouhongshen commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor Author

No unresolved unrelated CI blockers remain. The earlier #27071 fixed-budget producer timeout did not recur in run 31691982155: the Compose Pessimistic BVT producer and downstream Coverage job both passed. #27075 had already resolved on the preceding rerun when Java setup 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 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 review complete. The ownership change is sound: database/sql marks the DB closed and removes pending requests before collecting driver-close errors, and the pinned MySQL driver always performs idempotent connection cleanup and clears result state even when COM_QUIT fails. Therefore the returned write error is terminal and cannot represent retryable cleanup. Generic task-storage/service errors still propagate, so cluster admission safety is not weakened. The transplanted regression fails on the base and passes on this head; focused race x100, full pkg/taskservice tests, embedded lifecycle tests, and go list/build/vet for pkg/taskservice and pkg/embed all pass. Required CI is green.

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

mergify Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-13 14:35 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue — 2026-08-13 14:36 UTC · at 4c802c3f1ca6ec3ed36a8d22f3ae6714978e31af

This pull request spent 53 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

expected head sha didn’t match current head ref.

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

@mergify mergify Bot removed the queued label Aug 13, 2026
@XuPeng-SH
XuPeng-SH merged commit 56ee2d0 into matrixorigin:main Aug 13, 2026
22 of 24 checks passed
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes matrixorigin#27072

## What this PR does / why we need it:

### Root cause

Embedded CN services use `mysqlTaskStorage` through `database/sql`.
During cluster shutdown, a pooled task connection can outlive the server
endpoint it uses. `sql.DB.Close` first makes the DB terminal, then
closes idle driver connections. The MySQL driver sends a courtesy
`COM_QUIT`; if that write fails because the endpoint has already
stopped, it returns errors such as `bad connection`, but still closes
the socket, marks the connection closed, and clears its result state.

`mysqlTaskStorage.Close` propagated that already-terminal driver error
through the task holder and service close chain. The embedded cluster
correctly treats a service close error as incomplete ownership cleanup
and retains the process-wide complete-cluster admission token, so this
false cleanup failure caused every later embedded-cluster test to fail
admission.

### Changes

- Make the concrete MySQL task storage treat `sql.DB.Close` as terminal
after invoking it. This is the ownership boundary that knows the driver
has no cleanup left to retry.
- Keep generic task-storage, service-close, and embedded-cluster error
handling unchanged, so real service cleanup errors still propagate and
retain admission.
- Add a deterministic regression for the reported `bad connection` and a
second driver write error. It proves the DB is closed after the error
and repeated close remains safe.

### Issue-to-test proof

- `TestMySQLTaskStorageCloseIsTerminalAfterDriverError` injects the
exact reported error and a different write error, then proves close
succeeds, the DB rejects later use as closed, and close is idempotent.
Before the production change, the exact test failed with `bad
connection`.
- `TestBasicCluster` exercises the issue's original embedded-cluster
functional and shutdown path; it passes under coverage.
- `TestClusterAdmissionCoversFullLifecycle` proves admission is released
after successful full shutdown.
- `TestClusterCloseContinuesAfterServiceError` proves unrelated service
close errors still propagate and keep admission held; the fix does not
weaken the cluster's cleanup safety rule.

BVT is not applicable because SQL cannot inject a driver `Conn.Close`
failure or observe the process-wide test-cluster admission token. The
focused unit test provides deterministic fault injection, and the
embedded package tests cover the end-to-end owner chain.

### Tests run

On the issue base (`6a29b7d47eae06b414cce51ede4a129b6da9b68a`), before
the final main merges:

- `mo-cgo-test -count=1 -timeout=300s ./pkg/taskservice`
- `mo-cgo-test -count=1 -timeout=900s ./pkg/embed`
- `mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice`
- `mo-cgo-test -race -count=1 -timeout=1800s ./pkg/embed`
- Focused `-race` stress with a 30-second budget: the storage regression
and both admission tests measured below timer resolution and passed with
`N=100`; `TestBasicCluster` measured 19.25 seconds and passed with
`N=1`.

After rebasing onto main at `1d7b6311ce91df0968da435bb405f3d68137c595`:

- `mo-cgo-test -count=1 -timeout=180s -run
'^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$'
./pkg/taskservice`
- `mo-cgo-test -race -count=100 -timeout=180s -run
'^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$'
./pkg/taskservice`
- `mo-cgo-test -count=1 -timeout=300s ./pkg/taskservice`
- `mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice`
- `mo-cgo-test -cover -count=1 -timeout=420s -run '^TestBasicCluster$'
./pkg/embed` (64.3% package coverage)
- `go build -mod=readonly ./pkg/taskservice ./pkg/embed` with the
repository CGo flags
- `go vet -mod=readonly ./pkg/taskservice ./pkg/embed` with the
repository CGo flags

Final readiness validation on head
`4c802c3f1ca6ec3ed36a8d22f3ae6714978e31af`, after merging main through
`bdbd613fdece966769eb68481a3e58bfbc36b30c`:

- Enumerated `TestMySQLTaskStorageCloseIsTerminalAfterDriverError`
before execution.
- `mo-cgo-test -race -count=100 -timeout=180s -run
'^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$'
./pkg/taskservice` (`T` below timer resolution, 30-second stress budget,
`N=100`).
- `mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice`
- `GOWORK=off go list -mod=readonly ./pkg/taskservice ./pkg/embed`
- `GOWORK=off go build -mod=readonly ./pkg/taskservice ./pkg/embed` with
the repository CGo flags
- `GOWORK=off go vet -mod=readonly ./pkg/taskservice ./pkg/embed` with
the repository CGo flags
- `git diff --check`
- [MatrixOne ALL CI run
31691982155](https://github.com/matrixorigin/matrixone/actions/runs/31691982155):
PR validation, Ubuntu UT, arm64 SCA, UT coverage, Compose Proxy BVT,
Compose Pessimistic BVT, and final Coverage all passed.

### Self-review

The complete PR diff remains limited to the concrete MySQL task storage
and its regression test. `database/sql` owns concurrent close
serialization and marks the DB closed before invoking driver cleanup;
the MySQL driver makes connection cleanup idempotent even when
`COM_QUIT` fails. The change adds no waits, goroutines, retained state,
allocation growth, wire/storage format, or hot-path work. Generic task
storage, CN service, and embedded-cluster cleanup errors retain their
existing propagation and admission semantics.

### Residual risks

This intentionally stops reporting MySQL driver's courtesy shutdown
write errors from task storage. Those errors cannot be retried because
`database/sql` has already closed the DB and the MySQL driver has
already released the connection. Errors from task schedulers, runners,
stores other than this concrete MySQL storage, and all other embedded
services remain unchanged and continue to block admission release.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes matrixorigin#27072

## What this PR does / why we need it:

### Root cause

Embedded CN services use `mysqlTaskStorage` through `database/sql`.
During cluster shutdown, a pooled task connection can outlive the server
endpoint it uses. `sql.DB.Close` first makes the DB terminal, then
closes idle driver connections. The MySQL driver sends a courtesy
`COM_QUIT`; if that write fails because the endpoint has already
stopped, it returns errors such as `bad connection`, but still closes
the socket, marks the connection closed, and clears its result state.

`mysqlTaskStorage.Close` propagated that already-terminal driver error
through the task holder and service close chain. The embedded cluster
correctly treats a service close error as incomplete ownership cleanup
and retains the process-wide complete-cluster admission token, so this
false cleanup failure caused every later embedded-cluster test to fail
admission.

### Changes

- Make the concrete MySQL task storage treat `sql.DB.Close` as terminal
after invoking it. This is the ownership boundary that knows the driver
has no cleanup left to retry.
- Keep generic task-storage, service-close, and embedded-cluster error
handling unchanged, so real service cleanup errors still propagate and
retain admission.
- Add a deterministic regression for the reported `bad connection` and a
second driver write error. It proves the DB is closed after the error
and repeated close remains safe.

### Issue-to-test proof

- `TestMySQLTaskStorageCloseIsTerminalAfterDriverError` injects the
exact reported error and a different write error, then proves close
succeeds, the DB rejects later use as closed, and close is idempotent.
Before the production change, the exact test failed with `bad
connection`.
- `TestBasicCluster` exercises the issue's original embedded-cluster
functional and shutdown path; it passes under coverage.
- `TestClusterAdmissionCoversFullLifecycle` proves admission is released
after successful full shutdown.
- `TestClusterCloseContinuesAfterServiceError` proves unrelated service
close errors still propagate and keep admission held; the fix does not
weaken the cluster's cleanup safety rule.

BVT is not applicable because SQL cannot inject a driver `Conn.Close`
failure or observe the process-wide test-cluster admission token. The
focused unit test provides deterministic fault injection, and the
embedded package tests cover the end-to-end owner chain.

### Tests run

On the issue base (`6a29b7d47eae06b414cce51ede4a129b6da9b68a`), before
the final main merges:

- `mo-cgo-test -count=1 -timeout=300s ./pkg/taskservice`
- `mo-cgo-test -count=1 -timeout=900s ./pkg/embed`
- `mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice`
- `mo-cgo-test -race -count=1 -timeout=1800s ./pkg/embed`
- Focused `-race` stress with a 30-second budget: the storage regression
and both admission tests measured below timer resolution and passed with
`N=100`; `TestBasicCluster` measured 19.25 seconds and passed with
`N=1`.

After rebasing onto main at `1d7b6311ce91df0968da435bb405f3d68137c595`:

- `mo-cgo-test -count=1 -timeout=180s -run
'^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$'
./pkg/taskservice`
- `mo-cgo-test -race -count=100 -timeout=180s -run
'^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$'
./pkg/taskservice`
- `mo-cgo-test -count=1 -timeout=300s ./pkg/taskservice`
- `mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice`
- `mo-cgo-test -cover -count=1 -timeout=420s -run '^TestBasicCluster$'
./pkg/embed` (64.3% package coverage)
- `go build -mod=readonly ./pkg/taskservice ./pkg/embed` with the
repository CGo flags
- `go vet -mod=readonly ./pkg/taskservice ./pkg/embed` with the
repository CGo flags

Final readiness validation on head
`4c802c3f1ca6ec3ed36a8d22f3ae6714978e31af`, after merging main through
`bdbd613fdece966769eb68481a3e58bfbc36b30c`:

- Enumerated `TestMySQLTaskStorageCloseIsTerminalAfterDriverError`
before execution.
- `mo-cgo-test -race -count=100 -timeout=180s -run
'^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$'
./pkg/taskservice` (`T` below timer resolution, 30-second stress budget,
`N=100`).
- `mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice`
- `GOWORK=off go list -mod=readonly ./pkg/taskservice ./pkg/embed`
- `GOWORK=off go build -mod=readonly ./pkg/taskservice ./pkg/embed` with
the repository CGo flags
- `GOWORK=off go vet -mod=readonly ./pkg/taskservice ./pkg/embed` with
the repository CGo flags
- `git diff --check`
- [MatrixOne ALL CI run
31691982155](https://github.com/matrixorigin/matrixone/actions/runs/31691982155):
PR validation, Ubuntu UT, arm64 SCA, UT coverage, Compose Proxy BVT,
Compose Pessimistic BVT, and final Coverage all passed.

### Self-review

The complete PR diff remains limited to the concrete MySQL task storage
and its regression test. `database/sql` owns concurrent close
serialization and marks the DB closed before invoking driver cleanup;
the MySQL driver makes connection cleanup idempotent even when
`COM_QUIT` fails. The change adds no waits, goroutines, retained state,
allocation growth, wire/storage format, or hot-path work. Generic task
storage, CN service, and embedded-cluster cleanup errors retain their
existing propagation and admission semantics.

### Residual risks

This intentionally stops reporting MySQL driver's courtesy shutdown
write errors from task storage. Those errors cannot be retried because
`database/sql` has already closed the DB and the MySQL driver has
already released the connection. Errors from task schedulers, runners,
stores other than this concrete MySQL storage, and all other embedded
services remain unchanged and continue to block admission release.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes matrixorigin#27072

## What this PR does / why we need it:

### Root cause

Embedded CN services use `mysqlTaskStorage` through `database/sql`.
During cluster shutdown, a pooled task connection can outlive the server
endpoint it uses. `sql.DB.Close` first makes the DB terminal, then
closes idle driver connections. The MySQL driver sends a courtesy
`COM_QUIT`; if that write fails because the endpoint has already
stopped, it returns errors such as `bad connection`, but still closes
the socket, marks the connection closed, and clears its result state.

`mysqlTaskStorage.Close` propagated that already-terminal driver error
through the task holder and service close chain. The embedded cluster
correctly treats a service close error as incomplete ownership cleanup
and retains the process-wide complete-cluster admission token, so this
false cleanup failure caused every later embedded-cluster test to fail
admission.

### Changes

- Make the concrete MySQL task storage treat `sql.DB.Close` as terminal
after invoking it. This is the ownership boundary that knows the driver
has no cleanup left to retry.
- Keep generic task-storage, service-close, and embedded-cluster error
handling unchanged, so real service cleanup errors still propagate and
retain admission.
- Add a deterministic regression for the reported `bad connection` and a
second driver write error. It proves the DB is closed after the error
and repeated close remains safe.

### Issue-to-test proof

- `TestMySQLTaskStorageCloseIsTerminalAfterDriverError` injects the
exact reported error and a different write error, then proves close
succeeds, the DB rejects later use as closed, and close is idempotent.
Before the production change, the exact test failed with `bad
connection`.
- `TestBasicCluster` exercises the issue's original embedded-cluster
functional and shutdown path; it passes under coverage.
- `TestClusterAdmissionCoversFullLifecycle` proves admission is released
after successful full shutdown.
- `TestClusterCloseContinuesAfterServiceError` proves unrelated service
close errors still propagate and keep admission held; the fix does not
weaken the cluster's cleanup safety rule.

BVT is not applicable because SQL cannot inject a driver `Conn.Close`
failure or observe the process-wide test-cluster admission token. The
focused unit test provides deterministic fault injection, and the
embedded package tests cover the end-to-end owner chain.

### Tests run

On the issue base (`6a29b7d47eae06b414cce51ede4a129b6da9b68a`), before
the final main merges:

- `mo-cgo-test -count=1 -timeout=300s ./pkg/taskservice`
- `mo-cgo-test -count=1 -timeout=900s ./pkg/embed`
- `mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice`
- `mo-cgo-test -race -count=1 -timeout=1800s ./pkg/embed`
- Focused `-race` stress with a 30-second budget: the storage regression
and both admission tests measured below timer resolution and passed with
`N=100`; `TestBasicCluster` measured 19.25 seconds and passed with
`N=1`.

After rebasing onto main at `1d7b6311ce91df0968da435bb405f3d68137c595`:

- `mo-cgo-test -count=1 -timeout=180s -run
'^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$'
./pkg/taskservice`
- `mo-cgo-test -race -count=100 -timeout=180s -run
'^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$'
./pkg/taskservice`
- `mo-cgo-test -count=1 -timeout=300s ./pkg/taskservice`
- `mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice`
- `mo-cgo-test -cover -count=1 -timeout=420s -run '^TestBasicCluster$'
./pkg/embed` (64.3% package coverage)
- `go build -mod=readonly ./pkg/taskservice ./pkg/embed` with the
repository CGo flags
- `go vet -mod=readonly ./pkg/taskservice ./pkg/embed` with the
repository CGo flags

Final readiness validation on head
`4c802c3f1ca6ec3ed36a8d22f3ae6714978e31af`, after merging main through
`bdbd613fdece966769eb68481a3e58bfbc36b30c`:

- Enumerated `TestMySQLTaskStorageCloseIsTerminalAfterDriverError`
before execution.
- `mo-cgo-test -race -count=100 -timeout=180s -run
'^TestMySQLTaskStorageCloseIsTerminalAfterDriverError$'
./pkg/taskservice` (`T` below timer resolution, 30-second stress budget,
`N=100`).
- `mo-cgo-test -race -count=1 -timeout=600s ./pkg/taskservice`
- `GOWORK=off go list -mod=readonly ./pkg/taskservice ./pkg/embed`
- `GOWORK=off go build -mod=readonly ./pkg/taskservice ./pkg/embed` with
the repository CGo flags
- `GOWORK=off go vet -mod=readonly ./pkg/taskservice ./pkg/embed` with
the repository CGo flags
- `git diff --check`
- [MatrixOne ALL CI run
31691982155](https://github.com/matrixorigin/matrixone/actions/runs/31691982155):
PR validation, Ubuntu UT, arm64 SCA, UT coverage, Compose Proxy BVT,
Compose Pessimistic BVT, and final Coverage all passed.

### Self-review

The complete PR diff remains limited to the concrete MySQL task storage
and its regression test. `database/sql` owns concurrent close
serialization and marks the DB closed before invoking driver cleanup;
the MySQL driver makes connection cleanup idempotent even when
`COM_QUIT` fails. The change adds no waits, goroutines, retained state,
allocation growth, wire/storage format, or hot-path work. Generic task
storage, CN service, and embedded-cluster cleanup errors retain their
existing propagation and admission semantics.

### Residual risks

This intentionally stops reporting MySQL driver's courtesy shutdown
write errors from task storage. Those errors cannot be retried because
`database/sql` has already closed the DB and the MySQL driver has
already released the connection. Errors from task schedulers, runners,
stores other than this concrete MySQL storage, and all other embedded
services remain unchanged and continue to block admission release.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

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 size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: pkg/embed cluster cleanup can return bad connection and poison remaining tests

3 participants