Skip to content

fix(hashbuild): avoid false budget admission rejection - #26318

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
aptend:fix/26192-budget-estimator-multipliers
Jul 29, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
aptend:fix/26192-budget-estimator-multipliers

Conversation

@aptend

@aptend aptend commented Jul 28, 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:

issue #26192

What this PR does / why we need it:

HashBuild budget accounting used whole-payload multipliers that double-counted memory already covered by retained batches and auxiliary reservations. Wide LOAD DATA input could therefore be rejected even though one decoded/runtime-filter payload fit the hard query budget.

This PR:

  • replaces duplicated whole-payload multipliers with one payload plus explicit allocator, metadata, and framing slack;
  • accounts transient old/new allocation overlap when reusable vectors, spill arrays, unique keys, and marshal buffers grow;
  • reuses the existing spill high-water lease and grows only the uncovered transient difference, preventing duplicate admission rejection;
  • falls back to releasing the old reader batch before decoding when a reuse peak cannot be admitted;
  • adds tight-budget, large/small batch, spill replacement, cleanup, and corrupted-record regression coverage.

Validation:

  • hashbuild and spillutil package tests
  • hashbuild and spillutil package tests with race detector
  • focused transient-overlap tests with race detector repeated 100 times
  • go vet for both packages
  • independent blocker reviews converged with no remaining correctness blocker

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

@matrix-meow matrix-meow added the size/XL Denotes a PR that changes [1000, 1999] lines label Jul 28, 2026
@aptend
aptend force-pushed the fix/26192-budget-estimator-multipliers branch from df50955 to 689aa22 Compare July 28, 2026 13:29
@aptend
aptend force-pushed the fix/26192-budget-estimator-multipliers branch from 689aa22 to b0f7844 Compare July 28, 2026 14:47

@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 re-review complete. The previous partial-tail blocker is fixed at 82d84f2: admission now follows the exact per-vector mpool.GrowCapacity replacement sequence, preserves earlier retained deltas, and covers remainder allocation. The deterministic 2 x 4096-row / 1 KiB varchar regression now passes. I also re-audited reservation ownership, spill reader/writer cleanup, recursive scatter source charging, and bounded serialization/reuse peaks. Full affected packages pass under -race on the exact head and after a clean merge with current main; all 17 new boundary tests pass with -race -count=50; go vet and diff check pass. No remaining blocker.

@mergify mergify Bot added the queued label Jul 29, 2026
@mergify

mergify Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-29 02:22 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-07-29 02:58 UTC · at d33e1f0792a7edb252edbb1e5e24cb0de4685e99 · squash

This pull request spent 35 minutes 15 seconds in the queue, including 35 minutes running CI.

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

@mergify
mergify Bot merged commit f0e5cd7 into matrixorigin:main Jul 29, 2026
24 of 25 checks passed
@mergify mergify Bot removed the queued label Jul 29, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…26318)

HashBuild budget accounting used whole-payload multipliers that double-counted memory already covered by retained batches and auxiliary reservations. Wide LOAD DATA input could therefore be rejected even though one decoded/runtime-filter payload fit the hard query budget.

This PR:

- replaces duplicated whole-payload multipliers with one payload plus explicit allocator, metadata, and framing slack;
- accounts transient old/new allocation overlap when reusable vectors, spill arrays, unique keys, and marshal buffers grow;
- reuses the existing spill high-water lease and grows only the uncovered transient difference, preventing duplicate admission rejection;
- falls back to releasing the old reader batch before decoding when a reuse peak cannot be admitted;
- adds tight-budget, large/small batch, spill replacement, cleanup, and corrupted-record regression coverage.

Validation:

- hashbuild and spillutil package tests
- hashbuild and spillutil package tests with race detector
- focused transient-overlap tests with race detector repeated 100 times
- go vet for both packages
- independent blocker reviews converged with no remaining correctness blocker

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…26318)

HashBuild budget accounting used whole-payload multipliers that double-counted memory already covered by retained batches and auxiliary reservations. Wide LOAD DATA input could therefore be rejected even though one decoded/runtime-filter payload fit the hard query budget.

This PR:

- replaces duplicated whole-payload multipliers with one payload plus explicit allocator, metadata, and framing slack;
- accounts transient old/new allocation overlap when reusable vectors, spill arrays, unique keys, and marshal buffers grow;
- reuses the existing spill high-water lease and grows only the uncovered transient difference, preventing duplicate admission rejection;
- falls back to releasing the old reader batch before decoding when a reuse peak cannot be admitted;
- adds tight-budget, large/small batch, spill replacement, cleanup, and corrupted-record regression coverage.

Validation:

- hashbuild and spillutil package tests
- hashbuild and spillutil package tests with race detector
- focused transient-overlap tests with race detector repeated 100 times
- go vet for both packages
- independent blocker reviews converged with no remaining correctness blocker

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…26318)

HashBuild budget accounting used whole-payload multipliers that double-counted memory already covered by retained batches and auxiliary reservations. Wide LOAD DATA input could therefore be rejected even though one decoded/runtime-filter payload fit the hard query budget.

This PR:

- replaces duplicated whole-payload multipliers with one payload plus explicit allocator, metadata, and framing slack;
- accounts transient old/new allocation overlap when reusable vectors, spill arrays, unique keys, and marshal buffers grow;
- reuses the existing spill high-water lease and grows only the uncovered transient difference, preventing duplicate admission rejection;
- falls back to releasing the old reader batch before decoding when a reuse peak cannot be admitted;
- adds tight-budget, large/small batch, spill replacement, cleanup, and corrupted-record regression coverage.

Validation:

- hashbuild and spillutil package tests
- hashbuild and spillutil package tests with race detector
- focused transient-overlap tests with race detector repeated 100 times
- go vet for both packages
- independent blocker reviews converged with no remaining correctness blocker

Approved by: @XuPeng-SH

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/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants