Skip to content

fileservice: preserve ENOMEM from disk cache reads - #33162

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/main-33095-diskcache-enomem
Nov 24, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/main-33095-diskcache-enomem

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 #33095 (the issue remains open for the 4.2-dev fix and incident tracking).

What this PR does / why we need it:

After the main read-buffer fix, DiskCache.Read still treated ENOMEM as a recoverable cache miss. It could then fall back to object storage and attempt another allocation. This change returns ENOMEM from the existing cache-read error boundary while preserving fallback for ordinary cache errors such as a truncated cache file.

If a multi-entry cache read succeeds for an earlier entry and then fails with ENOMEM, error cleanup now clears aliases to the released, vector-owned buffer before retry. It preserves caller-owned buffers and unfinished entries.

The added disk-backed tests cover range and full-file cache hits, wrapped ENOMEM, no object-store fallback on allocation failure, retry with the same vector, ordinary short-read fallback, partial-hit cleanup, and reader-pin release from an active download generation.

Validation

  • Focused fileservice tests: PASS
  • Focused race tests: PASS
  • Full ./pkg/fileservice: PASS
  • Incremental golangci-lint from base 9fdbc41: 0 issues
  • git diff --check: PASS

Related 4.2-dev PR: #33131.

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

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: b1c00d1b984664a1b1f18581a1c0c04cb5fefa73

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

Assessment: approve

Disk-cache reads now return wrapped ENOMEM before attempting an origin read. Ordinary short cache reads still fall back to storage. Error cleanup releases vector-owned buffers from completed entries and clears their aliases so the vector can be retried safely.

Model: gpt-6.2-sol / xhigh

Session: 01a20d47-b35e-7bd2-9d5c-61978a866730 · slot 0 · generation 6

Validation:

  • All 11 focused fileservice tests passed in normal and race modes. The active-download pin test passed 100 race-enabled repetitions.

  • The normal fileservice package passed with two tests that leave a shared cache deadline set excluded. The resulting duplicate origin read reproduced on both the merge base and the PR. The merge-base download test passed three times in isolation.

  • Verified the frozen diff and matched the check commands, source fingerprints, exit receipts, and retained logs in validation-reconciliation.json. Recorded all discussion dispositions in discussion-assessment.json.

Limitations:

  • The unfiltered normal and race runs hit the preexisting download test failure and then timed out. The full race suite has no passing result.

  • Validation covered the main-branch fix with injected allocation failures. The 4.2-dev fix and the original CN mapping-exhaustion incident were outside this review.

This branch was successfully deployed

No deployments
ci — 20a86278 Deployed Nov 24, 2026 by XuPeng-SH
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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants