Skip to content

fix: park TAE worker shutdown and defer waiter allocation - #32915

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/c20-c21
Nov 19, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/c20-c21

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • Improvement

Which issue(s) this PR fixes:

Related to #32278 (C20 and C21; the umbrella issue remains open).

What this PR does / why we need it:

  • Park the worker shutdown owner on a condition variable while admitted work drains instead of spinning on the pending count. Preserve nonblocking sends and wake on execution completion or admission rollback; broadcast terminal completion to concurrent stop callers and arbitrate concurrent start and stop.
  • Create a transaction-waiter notification channel only when a caller waits on a nonempty generation, retaining cancellation and generation isolation.

On the same local Go toolchain and Apple M4, five 1-second held-operation samples had median process CPU of 960.9 ms on the base and 0.035 ms with the change. Five no-wait transaction-generation samples went from 112 B and 1 allocation per generation to 0 B and 0 allocations. The benchmark samples share a process per revision and are local microbenchmarks, not production measurements. The accepted-send control remained allocation-free; throughput samples were noisy.

Validation

  • Relevant task packages and txnbase: normal and race runs; 100 race repetitions of the new concurrency/lifecycle selections, including racing send/stop, reservation rollback, concurrent start/stop, copied handler drain, and waiter generations.
  • TestTxnModeSwitchDrainsInflightCatalogEvents and TestTxnModeSwitchWaitCancelRollsBack.
  • Changed-package go vet and golangci-lint.

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

@mergify

mergify Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 7ed5b6a415ec527b5770ef5c13b9af8d4591de52

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 7ed5b6a415ec527b5770ef5c13b9af8d4591de52

Assessment: approve

Worker shutdown now parks until admitted operations finish or rejected reservations roll back. All concurrent stop callers observe the same completion signal. Transaction waiters allocate a channel only when a caller waits on a nonempty generation, preserving cancellation and isolation between generations.

Model: gpt-6.2-sol / xhigh

Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3

Validation:

  • The worker, tasks, and txnbase packages passed normal tests, race tests, and go vet. Nine focused worker, handler, and waiter tests each passed 100 race repetitions.

  • The database mode-switch regressions passed 10 race repetitions for draining in-flight catalog events and 100 for rollback after cancellation.

  • Across five local samples per revision, median process CPU during a 250 ms held shutdown fell from 249.1 ms to 0.092 ms. Unwatched transaction generations went from 112 bytes and one allocation to zero. The accepted-send control was allocation-free on both revisions and its timing ranges overlapped.

  • The source remained clean. All 23 check receipts and their retained logs are indexed in validation-reconciliation.json.

Limitations:

  • The performance measurements cover local component probes. Production CPU savings and sustained queue throughput were outside their scope.

  • The frozen CI snapshot showed the shared build, x86 unit tests, and arm64 static analysis still in progress.

This branch was successfully deployed

No deployments
ci — 11db848e Deployed Nov 19, 2026 by XuPeng-SH
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/enhancement size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants