Skip to content

fix(objectio): release idle write arenas on 4.2-dev - #32773

Merged
XuPeng-SH merged 2 commits into
4.2-devfrom
codex/32751-arena-idle-reclaim-42-20261115
Nov 15, 2026
Merged

XuPeng-SH merged 2 commits into
4.2-devfrom
codex/32751-arena-idle-reclaim-42-20261115

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 #32751

What this PR does / why we need it:

On 4.2-dev, a burst can leave writer arenas idle while sinker closes or checkpoints continually defer the global drain. The 4.2 shared pool budget limits retention but does not make surplus arenas age out while other work continues.

Expire each arena after one minute of inactivity, taking the most recently returned arena first so an active working set stays warm. Preserve the 4.2 per-tier count and byte limits, shared budget, bounded checkout, legacy global drain, and explicit memory-pressure release. Detach idle arenas under the pool lock and release them outside it; a timer generation check prevents stale callbacks from draining newly parked arenas.

On an isolated 1-CN CPU-only 57 test with one 8 MiB field and 31 64 KiB fields, both versions verified all row hashes after LOAD and ALTER. At 75 seconds the base still held a 32 MiB arena and 16 MiB compression buffer, plus 9.95 MiB pooled Go serialization capacity; the new pool no longer held them. On the new version the native allocator briefly cached the 48 MiB, then expired that cache after about one second; sampled CN RSS fell from 501.87 to 482.05 MiB during this transition. Go heap and filesystem caches have separate lifetimes, and allocated capacity is not the same as resident memory.

Trade-offs and validation:

  • A 1-minute idle gap may require a new arena on the next write. A synthetic cold allocation and touch of 16 MiB took 4.6–5.6 ms versus about 29 µs warm on this host; this is not a SQL latency measurement. In a small hot-pool benchmark, serial checkout/return increased from 27.05 to 43.82 ns while removing one 16-byte allocation; a four-thread synthetic loop improved. These samples are not a throughput guarantee.
  • Six alternating small 1-CN SQL runs showed ALTER sampled RSS increments of 20.3–25.8 MiB on base and 10.5–24.1 MiB on head. The first long-observation pair had the opposite ordering; 5 ms sampling and a small sample prevent a general peak or latency claim.
  • Go 1.26.4 package race, four focused concurrency/timer tests repeated 100 times under race, targeted sinker and memory-pressure tests, and incremental lint passed.

This change targets idle retention; it does not bound active query memory or by itself resolve OOM while processing a very large row.

@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 15, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: edd11f9b50a0066729813eed69aa442fa5e9eee8

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: edd11f9b50a0066729813eed69aa442fa5e9eee8

Assessment: approve

Per-arena expiry extends the existing pool coherently. Budget accounting, bounded checkout and writer ownership remain intact; generations isolate stale callbacks, and cleanup runs outside the pool lock. No actionable findings remain.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Full pkg/objectio normal and race suites passed after source-matched native prerequisite recovery.

  • All four new timer/lifecycle tests passed with -race -count=100.

  • Five sinker/layout/cancellation tests and three admission/recovery tests passed under race.

  • go vet, changed-file gofmt and complete-delta whitespace checks passed.

  • All three discussion entries reconciled; source unchanged. validation-audit.json matches 11 receipts to retained evidence, including the initial missing-header diagnostic and successful recovery.

Limitations:

  • Author SQL/RSS and benchmark results were not independently reproduced; raw logs were unavailable. This assessment does not establish umbrella issue #32751 acceptance.

  • Hosted product checks and Go analysis remained pending in the frozen evidence snapshot.

This branch was previously deployed

1 inactive deployment
ci — edd11f9b Deployed Nov 15, 2026 by mergify[bot]
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