fix(rscthrottler): add mpool-based physical memory gate for S3 writes#25034
Closed
aunjgr wants to merge 1 commit into
Closed
fix(rscthrottler): add mpool-based physical memory gate for S3 writes#25034aunjgr wants to merge 1 commit into
aunjgr wants to merge 1 commit into
Conversation
Replace the removed RSS gate with a check on mpool.GlobalStats().NumCurrBytes. mpool tracks all mmap'd off-heap allocations (vectors, hash tables, S3 buffers, cache) and is real-time accurate — no stale window, no RSS/s3-buffer double-count. The pool check (limit - reserved) bounds S3 write concurrency. The mpool gate (mpoolBytes + ask > total * limitRate) bounds physical memory. Rejection triggers flushS3WriterOnMemoryPressure, freeing mpool + reserved. Fixes OOM on TPCC regression caused by matrixorigin#24892 removing the RSS gate.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #24881
What this PR does / why we need it:
#24892 removed the RSS gate (
rss + reserved + ask > total * limitRate) fromacquireWithinRSSLimitbecause it double-counted S3 write buffers (in both RSS and reserved), causing permanent false-rejects (#24881). But removing it left no physical memory guard, causing TPCC to OOM on large REPLACE INTO operations.This PR adds a physical memory gate using
mpool.GlobalStats().NumCurrBytes— the total off-heap mmap'd memory. This covers vectors, hash tables, S3 buffers, and caches. It is real-time accurate (no stale window) and does not double-count S3 buffers.The two gates now:
limit - reserved >= ask): bounds S3 write concurrencympoolBytes + ask > total * limitRate): bounds physical memoryRejection from the mpool gate triggers
flushS3WriterOnMemoryPressurein the caller, which syncs buffered data to S3 and frees bothreservedand mpool memory, creating headroom for retry.🤖 Generated with Claude Code