Repository navigation
fix: add bounded retry and error propagation to TransferPage write path - #24339
mergify[bot] merged 10 commits into
Conversation
…th (matrixorigin#24334) Under IOChaos filesystem error injection, WriteTransferPage fails silently and still sets invalid paths on pages, while the flusher keeps scheduling new flushes — causing an allocation storm that OOMs DN in 2 minutes. Changes: - WriteTransferPage now retries up to 3 times with exponential backoff (100ms, 200ms, 400ms) before giving up - WriteTransferPage returns an error; paths are only set on pages when the write actually succeeds - Callers (flushTableTail, mergeObjects) log the failure but still keep pages in-memory so transfers continue to work without disk persistence - Added unit tests with mock FS to verify retry behavior Fixes matrixorigin#24334 Co-Authored-By: Claude Opus 4.6 <[email protected]>
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
The Makefile err-check rule disallows fmt.Errorf in pkg/. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ory TTL 1. Replace time.Sleep with select on ctx.Done() so shutdown/cancellation is respected during retry backoff (review #2). 2. When WriteTransferPage fails, extend page bornTS by (diskTTL - ttl) so the in-memory hashmap survives ~5 minutes instead of being evicted after 5s by the TTL sweeper. This preserves transfer correctness for the full diskTTL window under sustained IO faults (review #4). 3. Add test for context cancellation mid-retry. 4. Add test for Transfer() behavior after hashmap eviction with no path set. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
XuPeng-SH
left a comment
There was a problem hiding this comment.
LGTM on the current head (0b9c0a5). This is the main-branch counterpart to #24337 (3.0-dev, already approved), correctly adapted for main's bufs/ReleaseMarshalBufs plumbing.
Key differences from the 3.0-dev version verified:
WriteTransferPagetakes thebufs []*bytes.Bufferparameter and callsReleaseMarshalBufs(bufs)on every exit path: success (line 467), FileAlreadyExists (line 484), context cancellation (line 500), and exhausted (line 506). No buffer pool leak.mergeobjects.go:170correctly callsReleaseMarshalBufs(marshalBufs)in thewriteFailedfast-path whereWriteTransferPageis skipped, releasing bufs accumulated byAddTransferPagein subsequent loop iterations.AddTransferPageappends to&marshalBufs(3-arg signature) matching main's interface.
Same fixes verified as in #24337:
- FileAlreadyExists treated as success
writeFailedflag fail-fasts remaining merge objects- Context-aware backoff (select ctx.Done vs time.After)
- bornTS extended by
diskTTL - TTLon write failure transfer_page_write_retry_total{succeeded|exhausted}metrics- Shift-overflow comment on backoff constant
CI all green. Fine to merge.
Merge Queue Status
This pull request spent 1 hour 2 minutes 23 seconds in the queue, with no time running CI. Waiting for any of
All conditions
ReasonThe merge conditions cannot be satisfied due to failing checks HintYou may have to fix your CI before adding the pull request to the queue again. |
Merge Queue Status
This pull request spent 35 minutes 45 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonThe merge conditions cannot be satisfied due to failing checks HintYou may have to fix your CI before adding the pull request to the queue again. |
Merge Queue Status
This pull request spent 22 seconds in the queue, including 3 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) does this PR fix or relate to?
Fixes #24334
What this PR does / why we need it:
Backports the TransferPage write reliability fix to the
mainbranch.The root cause of the DN OOM burst under IOChaos is that
WriteTransferPagesilently sets page paths even when the filesystem write fails. When the in-memory hashmap is later evicted by TTL,loadTable()attempts to read from a non-existent file path, triggering repeated flush re-scheduling and memory allocation storms.This fix:
WriteTransferPageflushTableTail,mergeObjects) log a warning and keep pages in memory when persistence fails