Skip to content

fileservice: avoid full-object rereads during pending cache publication - #28888

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-28843-pending-cache-publication
Sep 15, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-28843-pending-cache-publication

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • BUG

Which issue(s) this PR fixes:

issue #28843

What this PR does / why we need it:

When a full-object cache fill cannot serve a request because its asynchronous publication is still pending, the regular fallback can reread the entire object. Use exact per-entry ranges for expensive sparse requests and the minimal contiguous range otherwise, preserving successful full-object cache fills and the original publication owner.

The deterministic regression uses the public S3FS.Read path and a blocked disk-cache publication after the I/O merge has completed. On base 2ea4ec2e6ef4b20321a235ef416228506813e39b, requests for 30 useful bytes consume another 9,441,280-byte object. The fix consumes 30 bytes for sparse ranges or 33 bytes for compact ranges including a three-byte gap. It checks actual object reads/consumed bytes, result contents, partial cache hits, read-to-end, cancellation and intermediate read failure, publication failure/retry, reader cleanup, private cache files and the subsequent cache hit. The supplemental custom-cache case verifies one vector-cache read, one update, and the original vector identity during the pending-publication fallback.

Validation at pre-rebase head 9e20802ca91a85c748cfad00aa9c6ae5e4340a2c:

  • Darwin arm64: focused ordinary/race regression including the custom-cache case passed. The prior seven-case focused/package normal/race, 11 repeated race runs, adjacent concurrency stress, build/vet and semantic preflight passed at the preceding product head.
  • Linux amd64/CGo: deterministic validation passed at pre-rebase head 9e20802ca91a85c748cfad00aa9c6ae5e4340a2c. The same test file is overlaid on baseline 2ea4ec2e6ef4b20321a235ef416228506813e39b; its sparse/dense cases fail specifically for another 9,441,280 consumed bytes. All eight head scenarios pass. FileService ordinary/race, build/vet, nine repeated race regression runs and 100 repeats each of three adjacent concurrency tests pass. All 20 evidence-index hashes were independently verified. Artifacts bind source/test versions, native dependencies, actual consumed bytes and object request counts.
  • BVT: N/A — SQL cannot deterministically hold the internal cache publication barrier; this regression directly exercises S3FS.Read and the real disk-cache lifecycle. Standard required CI remains applicable.

TKE mechanism acceptance: PASS

Paired acceptance run 34947682163 passed with real COS storage, Bound PVCs backed by Tencent CSI, and Linux amd64. Both versions used the same test-only publication barrier and test overlay. Each case proved that publication remained blocked, the I/O merge was released, and the publication reservation remained occupied.

Scenario Baseline consumed bytes / ObjectStorage.Read calls Head consumed bytes / ObjectStorage.Read calls
Sparse, 30 useful bytes 9,441,280 / 1 30 / 2
Compact, 30 useful bytes plus a 3-byte gap 9,441,280 / 1 33 / 1
First follower read after publication failure/retry 9,441,280 / 1 30 / 2
Cancellation before reading 0 / 0 0 / 0

Returned data, reader closure, private unpublished cache files, independent publication ownership, temporary-file cleanup, and subsequent complete cache hits passed. TKE cancellation coverage is before-read cancellation; mid-sequence cancellation/failure coverage comes from Linux validation, not a claim of HTTP-stream cancellation coverage. Read counts are ObjectStorage.Read calls, not total HTTP requests including retries.

Pre-rebase frozen identities:

  • B: 2ea4ec2e6ef4b20321a235ef416228506813e39b; H: 9e20802ca91a85c748cfad00aa9c6ae5e4340a2c.
  • Acceptance wrapper: 4503881750a0aa6b45d9f7b1339e8f68748feb5c; common test overlay: 17e80f3829317f88dba7d4efb191e574e81906e2.
  • B image: sha256:161a832748d018e09d7137ee9031ea2f59b620a4c7a804e5fff12dcca5dac4df.
  • H image: sha256:754c11441dc0a0081eaa11a84a875673a16352b5238e914f1448b1154d74de85.
  • Image publication run 34942294518 passed. The four B/H evidence and terminal artifacts in the acceptance run have verified per-file indexes and retain probe logs, actual Pod digests, PVC/PV state and verdicts.
  • Standard PR CI 34926085716, including CI Required, passed for H.

Baseline resources were cleaned before head allocation. Kubernetes/PV reclamation and empty owned COS prefixes were verified. CBS physical disk destruction was not independently verified under the explicitly accepted cleanup exception; no finalizers were forcibly removed.

QA required: yes. The local read-amplification mechanism is confirmed and its fix passed Linux and TKE FileService acceptance. This was not a distributed SQL/ANLI replay. The exact original TKE SetFile skip cause and whether all issue #28843 timeouts are resolved remain inconclusive; original-scenario validation is still required before issue closure. Reduced bytes do not imply proportional query-latency improvement. No API, SQL semantics, cache-policy default, timeout or file-format change.

Current exact-head synchronization

  • Current head: 762e14a3468100eee832b2c986338145d5796333.
  • Base: main@4cd720e0cee6fb79af901507e20b654c085d1bde.
  • Previous published head/base: 582c3ee8d05ab701084fef0d0eeecaad5aa2900b / main@77202a6e9f23885fc7884a33e76256e10871d432.
  • Original pre-sync head/base: df953892973c960a5104a8a7b7dba632c8c4e448 / main@b347a62a30719cf3f2c8ca5a2da0dcfb11639f8c.
  • Synchronization: rebase-only; no product-file edits.
  • Target-base overlap: latest main changed pkg/fileservice/s3_fs.go; range-diff and per-commit patch IDs remain equivalent.
  • Range-diff: 2/2 commits equivalent.
  • Non-merge patch IDs preserved: d1005e085aad2ccaec82a6e521f78a1162546aa4, dd55080616eb87ffbdcccb8038bb4c52681bd967.
  • Business diff SHA-256: 0cea2d5a0368086c7082cd36f2cf1b3793c62254de1cccf7956edbb1a95e526c.
  • Exact-head validation: git diff --check PASS; focused ordinary, focused race, and fileservice test build PASS.
  • Previous run 34953499563 was not rerun: Pessimistic BVT failed during CMake/Ninja setup with HTTP 500 before tests, and Coverage was a derived prerequisite failure. Superseded run 34986736802 belonged to the prior published head and was not reused.
  • Fresh CI is triggered by this head; existing review requests are preserved.

@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Sep 15, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Sep 15, 2026
@VioletQwQ-0
VioletQwQ-0 marked this pull request as ready for review September 15, 2026 08:57
@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 →

@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.

GPT-6 medium deep review APPROVE at exact head 762e14a\n\nAll changed hunks and applicable correctness, concurrency, lifecycle, liveness, resource, boundedness, compatibility, and test-evidence closures were reviewed. Reusable regression/race evidence and exact-head CI passed. No concrete blockers found.

@mergify mergify Bot added the queued label Sep 15, 2026
@mergify

mergify Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-15 16:39 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-09-15 17:39 UTC · at 9089d7c3e34f06ecb06479816cbb53d6be1178b2 · squash

This pull request spent 59 minutes 48 seconds in the queue, including 59 minutes 28 seconds running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 9089d7c into matrixorigin:main Sep 15, 2026
27 of 28 checks passed
@mergify mergify Bot removed the queued label Sep 15, 2026

This branch was previously deployed

1 inactive deployment
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.

3 participants