Skip to content

fix(process): discard stale automatic spill disk capacity samples - #30356

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:fix/spill-cap-snapshot-30352
Oct 16, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:fix/spill-cap-snapshot-30352

Conversation

@LeftHandCold

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #30352

What this PR does / why we need it:

An automatic spill-cap refresh can combine filesystem free space sampled before another statement removes its spill with the ownership ledger after that statement releases its reservation. For example, a 192 GiB cap becomes 117 GiB even though no external space was consumed. The active-envelope rule then prevents a fresh sample from restoring the cap, causing valid spill growth to fail.

Resolve the shared CN budget before sampling and validate a disk-budget epoch before publishing the observation. Reservation, growth, release, reconciliation and cap updates invalidate in-flight samples, including release/reserve ABA and overlapping refreshes. Sampling stays outside the resource mutex, so cleanup and admission remain independent of filesystem I/O.

An invalidated or unavailable observation keeps the previous finite cap until a later statement refreshes it; there is no retry loop. Coherent samples retain the existing external-pressure tightening, explicit floor, headroom and no-growth-while-active policy. This is still an observed capacity budget, not a transactional filesystem quota; busy writers can defer a refresh.

Validation on Linux/amd64, Go 1.27.1, with native dependencies built by make cgo:

  • Pre-fix reproduction: the same deterministic release-interleaving test fails with 117 GiB instead of 192 GiB using the unchanged base implementation and a test-only sampling API adapter.
  • Complete pkg/vm/process tests: PASS (205 top-level tests); complete package under -race: PASS.
  • Three key tests separately repeated with -race -count=100: concurrent release, all invalidating transitions, and the real Process/LOCAL/Statfs boundary: PASS.
  • Complete pkg/sql/colexec/spillutil and pkg/sql/colexec/hashbuild tests: PASS (173 top-level tests total).
  • go vet ./pkg/vm/process, incremental golangci-lint v2.14.0 (the Makefile-pinned version), gofmt and git diff --check: PASS.

No large disk allocation or full BigData run is claimed. These tests prove the #30352 component defect and its fix; available evidence does not establish that this release race caused I7 in BigData run 38762357515.

@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 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 8489663ac32b100fe7815e47a7e24a9ef8d8b75b

Review completed. Read the assessment.

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

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

Commit: 8489663ac32b100fe7815e47a7e24a9ef8d8b75b

Assessment: approve

Reviewed the complete delta and affected ownership paths. The epoch check fixes stale spill-cap publication within the existing budget owner, preserves cap policies, and keeps filesystem I/O outside the admission lock. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Verified the frozen head, merge-base, patch equivalence and unchanged source. Reviewed reservation, growth, reconciliation, cleanup, competing refreshes and Process initialization.

  • Isolation preflight passed. Verified 192 native inputs and 19 retained artifacts against the repository-owned build evidence.

  • All 205 process tests passed normally and under -race; three targeted concurrency/Statfs tests each passed 100 race repetitions.

  • All spillutil and hashbuild tests passed: 37 and 136 tests respectively. go vet, gofmt and diff checks passed.

  • The unchanged base implementation, accessed through a diagnostic-only API adapter, reproduced the expected 117 GiB versus 192 GiB failure; the candidate passed.

  • Commands, source fingerprints, exits and logs are reconciled in /home/xupeng/.local/state/mo-bot/jobs/99ebfcd1b59508c10b7f74af/attempt-1/receipt-reconciliation.json.

Limitations:

  • Validation used Linux/amd64 and Go 1.27.1. No large-disk, BigData or performance benchmark was run; no attribution to BigData I7 is claimed.

  • Busy writers can defer refreshes; this remains an observed capacity budget, not a transactional filesystem quota.

  • Issue #30352's body was absent from frozen evidence. Review covered the explicit component contract in the PR; hosted CI execution logs were not independently audited.

@mergify mergify Bot added the queued label Oct 16, 2026
@mergify

mergify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-16 05:46 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-16 08:17 UTC · at c2f3e83025ef3fc07625d05012505b3c31d383f0

This pull request spent 2 hours 31 minutes 41 seconds in the queue, with no time running CI.

Reason

Pull request #30356 has been dequeued

Pull request from fork cannot be queued. This pull request comes 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.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, 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.

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
ci — c2f3e830 Deployed Oct 16, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Automatic spill cap mixes stale filesystem samples with live ownership and falsely rejects reservations

3 participants