Skip to content

[4.2.1 hotfix] fix(window): release account buffers on prepared reset - #32112

Merged
XuPeng-SH merged 1 commit into
release/v4.2.1-hotfix-20261026from
codex/fix-421-window-account-20261104
Nov 4, 2026
Merged

XuPeng-SH merged 1 commit into
release/v4.2.1-hotfix-20261026from
codex/fix-421-window-account-20261104

Conversation

@XuPeng-SH

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:

Related to #31089. Backports the Window lifecycle fix from #31127 to the 4.2.1 hotfix branch.

What this PR does / why we need it:

A prepared JOIN followed by a Window can leave account-owned input and expression buffers alive after execution. Window Reset clears their logical data but retains their backing, so allocation-account finalization reports an invariant failure and suspends admission for subsequent account-owning queries on the same CN.

Release the Window-owned buffers belonging to an allocation account at Reset, detach the result wrapper's borrowed references, and clear freed expression slots. Continue reusing unaccounted buffers. The change scans Window's buffered vector slots at Reset; it does not add per-row work or change account admission policy.

On base 87866e6d2822, a three-row prepared JOIN with an unpartitioned cumulative SUM reproduced allocation account invariant failure (48 bytes, four allocations); a subsequent JOIN failed with allocation account admission is suspended. A direct Window/registry control reproduced the same transition and showed that freeing Window's retained buffers releases the suspension. The user's incident has not yet been correlated with this specific query shape.

Validation on macOS arm64, Go 1.26.4, with native libraries built from this hotfix source:

  • Full Window package normal and race tests.
  • Public prepared SQL regression normal and race: literal and prepared JOIN/window queries, repeated and empty executions, result equality, and new connection authentication.
  • Window account regression: partitioned and unpartitioned execution, cancellation, direct Free, two generations, and unaccounted buffer reuse.
  • Incremental formatting, vet, repository error checks, molint and golangci-lint for the affected packages.

GitHub CI is pending. The standalone customer workload and Linux runtime have not been tested in this local run.

Backport the Window allocation-lifecycle repair to the 4.2.1 hotfix branch. Retire inherited account-owned buffers before terminal account completion while preserving reuse of unaccounted storage. Cover prepared SQL and account lifecycle controls.
@XuPeng-SH
XuPeng-SH requested a review from aunjgr as a code owner November 4, 2026 02:23
@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 added kind/bug Something isn't working kind/test-ci labels Nov 4, 2026
@mergify

mergify Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@XuPeng-SH

XuPeng-SH commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 404a1099aea7571e32a698490261d8fc85ebc600

"interrupted"

@XuPeng-SH
XuPeng-SH merged commit d8286ad into release/v4.2.1-hotfix-20261026 Nov 4, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/fix-421-window-account-20261104 branch November 4, 2026 02:50
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants