Skip to content

fix(fileservice): bound full-object cache wait fallback - #24871

Merged
mergify[bot] merged 4 commits into
matrixorigin:mainfrom
LeftHandCold:fix/fileservice-bounded-full-object-wait
Jun 8, 2026
Merged

fix(fileservice): bound full-object cache wait fallback#24871
mergify[bot] merged 4 commits into
matrixorigin:mainfrom
LeftHandCold:fix/fileservice-bounded-full-object-wait

Conversation

@LeftHandCold

@LeftHandCold LeftHandCold commented Jun 7, 2026

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:

issue #24870

What this PR does / why we need it:

Summary

  • add a short bounded wait before full-file disk cache reads miss while the full-file cache is being updated
  • use the same short bound for full-object IOMerger waits, then fall back to minimal S3 range read only if the full-object merge is still active
  • keep the streaming full-object disk-cache fill from fix(fileservice): stream full-object disk cache without read wait amplification #24759 and release the captured Data slice after CachedData is produced
  • remove the immediate full-object bypass helper path that caused cache reuse loss during warmup

Root Cause

#24759 correctly fixed RSS pressure by streaming full-object disk cache fill, but the same PR also made concurrent range reads bypass full-object disk-cache update and full-object IOMerger immediately. Under TPCC/sysbench warmup this can turn one shared full-object fill into many independent S3 range reads, reducing cache convergence and increasing S3 fan-out.

A full revert to the old unbounded wait was tested in nightly run 26930027366 and made TPCC 1000w load too slow. The bounded-wait probe in nightly run 26935873712 kept the completed sysbench cases clean (ignored errors: 0) and let the TPCC job succeed, so this PR keeps the no-long-wait property while restoring a short opportunity for cache reuse.

Copilot AI review requested due to automatic review settings June 7, 2026 14:47
@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 →

@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Jun 7, 2026
@LeftHandCold
LeftHandCold force-pushed the fix/fileservice-bounded-full-object-wait branch from e1115bb to 7749ae8 Compare June 7, 2026 14:49

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 adjusts MatrixOne’s fileservice S3 read-path concurrency behavior to improve cache convergence under concurrent range reads, by adding a short bounded wait for in-flight full-object work (disk-cache fill and IOMerger merges) before falling back to minimal-range S3 reads.

Changes:

  • Add a short bounded wait for full-object IOMerger waits, and fall back to minimal-range S3 reads only if the full-object merge remains active.
  • Add a short bounded wait when reading the full-file disk-cache entry while it is being updated (instead of immediately treating it as a miss).
  • In the streaming full-object disk-cache fill path, release the captured Data slice after CachedData is produced; add tests for both the bounded-wait behavior and the Data release behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/fileservice/s3_fs.go Adjusts read/merge control flow to use a short wait for full-object merges and minimal-range fallback only when still merging; releases entry Data after producing CachedData in streaming fill.
pkg/fileservice/s3_fs_test.go Adds a regression test ensuring full-object streaming fill returns CachedData without retaining the full-object Data slice.
pkg/fileservice/io_merger.go Introduces shortIOWaitDuration and makes IOMerger waiting honor short max wait durations (not delayed by the slow wait interval).
pkg/fileservice/io_merger_test.go Adds a test verifying short max-wait isn’t delayed by the slow wait duration.
pkg/fileservice/disk_cache.go Adds a short bounded wait when attempting to read the full-file cache entry while it’s being updated.

Comment thread pkg/fileservice/disk_cache.go

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I did not find a blocking logic bug in the implementation itself, but there are two important unhappy-path regressions that still need tests before I am comfortable approving this.

  • pkg/fileservice/disk_cache.go now adds a bounded wait (waitUpdateCompleteFor(..., shortIOWaitDuration)) before treating an in-progress full-file cache update as a miss, but there is no regression test for the success path where the update finishes within that window and the read then hits disk cache. That is one of the main new branches introduced by this PR.
  • pkg/fileservice/s3_fs.go now adds a bounded wait for full-object IOMerger work and then falls back to minimal-range S3 read when the merge is still active, but I do not see a test that pins this timeout/fallback path either. This is the other key unhappy-path boundary added by the change.

Please add regression coverage for both new timeout/wait branches, then this should be in much better shape.

@LeftHandCold

Copy link
Copy Markdown
Contributor Author

Addressed in cb2b316.

Added regression coverage for both requested paths:

  • DiskCache now has a test for the bounded full-file update wait success path: the read waits while the full-file cache entry is marked updating, then hits the full-file disk cache after the update completes within the short wait window.
  • S3FS now records the object-storage read range in the full-object IOMerger contention test and asserts the read falls back to the minimal range [123, 130) while the full-object merge is still active.

Verified:

  • GOCACHE=/private/tmp/mo-gocache-pr24871-review GOFLAGS=-mod=mod go test ./pkg/fileservice -run 'TestDiskCacheReadWaitsForFullFileUpdateWithinShortWait|TestS3FSRangeReadSkipsFullObjectIOMergeBeforeDiskCacheUpdate' -count=1
  • GOCACHE=/private/tmp/mo-gocache-pr24871-review GOFLAGS=-mod=mod go test ./pkg/fileservice -count=1

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me.

The bounded-wait change stays focused on the real regression: it gives full-object cache reuse a short chance to win, but still preserves the no-long-wait fallback to a minimal S3 range read. The updated tests also cover the important timing-sensitive branches well enough for this kind of internal fileservice fix.

@mergify

mergify Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-06-08 15:06 UTC · Rule: main
  • Checks skipped · PR is already up-to-date
  • Merged2026-06-08 15:06 UTC · at 749c9824fde2e7cead9b0090efb324e9769d5f18 · squash

This pull request spent 21 seconds in the queue, including 3 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Ubuntu/x86
    • check-neutral = Matrixone CI / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI / SCA Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-neutral = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage

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 kind/enhancement size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants