Skip to content

fix: skip full file preload for readutil long scans - #24484

Closed
LeftHandCold wants to merge 1 commit into
matrixorigin:4.0-devfrom
LeftHandCold:fix/readutil-skip-full-preload-4.0-v2
Closed

LeftHandCold wants to merge 1 commit into
matrixorigin:4.0-devfrom
LeftHandCold:fix/readutil-skip-full-preload-4.0-v2

Conversation

@LeftHandCold

Copy link
Copy Markdown
Collaborator

Summary

  • add SkipFullFilePreloads to readutil long-scan policy after readBlockCnt > threshHold
  • preserve existing SkipMemoryCacheWrites behavior
  • keep the fix scoped to the readutil caller; no fileservice global logic is changed
  • add a regression test for the long-scan policy bits

Root cause

Policy:2 only skipped memory-cache writes. For readutil long scans, the caller could still trigger full-object preloads into disk cache and OS page cache, amplifying range reads into full-file downloads. The missing caller flag is SkipFullFilePreloads; this PR only adds it on the existing long-scan threshold path.

Tests

  • go test ./pkg/vm/engine/readutil -count=1

Long scans already skip memory cache writes after exceeding the read block threshold. Also skip full-file preloads so these range reads do not populate disk cache and OS page cache with whole objects.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 20, 2026 03:45
@LeftHandCold
LeftHandCold requested a review from XuPeng-SH as a code owner May 20, 2026 03:45
@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 →

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes read amplification for readutil “long scans” by updating the caller-side fileservice.Policy once the reader exceeds its long-scan threshold, ensuring that range reads don’t accidentally trigger full-object preloads into disk cache / OS page cache.

Changes:

  • Extend the long-scan threshold path to set SkipFullFilePreloads in addition to the existing SkipMemoryCacheWrites.
  • Refactor policy selection into a small helper (nextBlockReadPolicy) to keep Read() simpler.
  • Add a regression unit test validating the policy bits after the threshold is crossed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/vm/engine/readutil/reader.go Introduces nextBlockReadPolicy() and applies it in persisted-block reads to add SkipFullFilePreloads for long scans.
pkg/vm/engine/readutil/relation_data_test.go Adds a regression test asserting the long-scan policy includes SkipMemoryCacheWrites + SkipFullFilePreloads and does not cache full files.

@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label May 20, 2026
@LeftHandCold

Copy link
Copy Markdown
Collaborator Author

Superseded by the disk cache stale-index root-cause fix. The repeated S3 GETs after SetFile are caused by disk cache index/physical-file inconsistency after async postEvict, not primarily by readutil missing SkipFullFilePreloads. See issue #24493 and replacement PRs #24494 / #24495.

This branch was previously deployed

1 inactive deployment
ci — 0958219d Deployed May 20, 2026 by LeftHandCold via Matrixone Utils CI / Coverage #36753
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants