Repository navigation
fix(objectio): release partial read cache data on error - #24311
mergify[bot] merged 7 commits into
Conversation
Release IOVector cache data when objectio read helpers return after a partial FileService read error. Also release decompression cache data if LZ4 decompression fails before ownership is returned. Co-authored-by: Copilot <[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. |
There was a problem hiding this comment.
Pull request overview
Fixes pkg/objectio read-helper error paths to ensure partially filled fileservice.IOVector cache data is released when FileService.Read returns an error (e.g., cancellation during parallel scans), and adds unit tests to cover several partial-read cleanup scenarios.
Changes:
- Release partially filled
IOVectorentries onfs.Readerror inReadExtent,ReadOneBlockWithMeta,ReadAllBlocksWithMeta, andReadOneBlockAllColumns. - Release allocated decompression cache data when LZ4 decompression fails inside
constructorFactory. - Add unit tests that simulate “partial cache fill + read error” and assert the cache data is released.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| pkg/objectio/funcs.go | Adds release-on-error logic to multiple ObjectIO read helpers to prevent leaking partially filled cached data. |
| pkg/objectio/constructors.go | Ensures decompression-allocated cache data is released on LZ4 decompression failure. |
| pkg/objectio/funcs_test.go | Adds unit tests covering partial-read cleanup behavior for several helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add coverage for ReadAllBlocksWithMeta partial read cleanup and constructorFactory decompression failure cleanup. Co-authored-by: Copilot <[email protected]>
|
Reviewed the latest PR against issue #24310. The partial-read leak path is addressed: the objectio helpers now release filled CachedData when fs.Read or follow-up processing returns an error, and constructorFactory releases the allocated decompression cache buffer if LZ4 decode fails before ownership is returned. I specifically checked the double-free concern: ReleaseReadResultOnError nils CachedData after releasing it, and only calls releaseData for entries marked done, so failed ReadFromOSFile entries whose prepareData defer already unwound their raw buffer are skipped. The issue did not show up before because successful reads transfer ownership to normal callers, but LIMIT/parallel scan cancellation can make FileService.Read return an error after some entries were already filled, leaving those cache references unreachable until eviction exposes the missing free. I do not see blocking regression risk in this change. |
Release schema-evolution generated cache data when ReadOneBlockWithMeta returns an error, and make error-returned IOVectors inert after cleanup. Co-authored-by: Copilot <[email protected]>
Clear done/fromCache when ReleaseReadResultOnError discards partially filled read results so entries are left in a consistent retry-safe state. Co-authored-by: Copilot <[email protected]>
Merge Queue Status
This pull request spent 53 minutes 34 seconds in the queue, including 53 minutes 19 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #24310
What this PR does / why we need it:
Fixes ObjectIO partial-read error paths that can drop
IOEntry.CachedDatawithout releasing it. When a FileService read fills some cache entries and then returns an error, for example after a LIMIT query cancels parallel table-scan workers, the read helper previously returned without releasing the partially-filled read results. Under cache eviction this can surface as a checked mallocmissing freepanic fromfileservice.Bytesallocated throughDiskCache.Read -> objectio.constructorFactory.This PR:
IOVector.ReleaseReadResultOnError()to release cached data and raw read buffers only for completed entries, avoiding double-deallocation of an entry whoseReadFromOSFilealready unwound its own failed raw buffer.ReadOneBlockWithMeta,ReadExtent,ReadAllBlocksWithMeta, andReadOneBlockAllColumnswhenfs.Reador post-read processing returns an error.Validation