Skip to content

[Bug]: 4.2-dev duplicates warm DiskCache reads/conversions after concurrent MemCache misses #32223

Open

Description

@LeftHandCold

Is there an existing issue for the same bug?

  • I have checked the existing issues.

This is 4.2-dev-specific unresolved-defect tracking, not a claim that the main fix regressed.

No open branch-specific Issue or open #28918 backport PR was found in the searches listed below. A closed historical issue should not leave a confirmed affected branch without active tracking.

Branch Name

4.2-dev

Commit ID

  • Observed nightly: 7283f12d0eaf919e253dab4ed0d7dc0828c6ff8e.
  • Previous nightly: 88e5fb541768ff65e2220f520e7edd9647034635.
  • Current 4.2-dev source checked on 2026-11-05: 9d07606dd04b358bd8d1b704fb0e7101a1aaa116. The same path remains; this is source verification, not a fresh nightly on this head.
  • Related main fix fix(fileservice): coalesce same-key warm disk-cache column fills #28918: merge 77202a6e9f23885fc7884a33e76256e10871d432. It is not an ancestor of the tested/current 4.2 commits; the equivalent behavior was also checked in source, rather than relying only on ancestry.

Other Environment Information

  • Observed IVF job.
  • Performance publishing job.
  • Resource check.
  • Namespace: mo-42-family-41853763768-1.
  • Image digest: sha256:d0f6ed5029ae4ce688253fcb282c97e00c72ba32f22eccf53f355fbf5e1738f8.
  • Topology: 1 TP + 2 AP CNs; each AP has 14 CPU / 55 GiB memory and 16 GiB SHARED MemCache.
  • Vector benchmark: 0bae04528673d7756c4ee2478ac8e4e41f54df1b, unchanged in the compared runs.
  • Wiki IVF 10M, 768 dimensions, 100 workers, 10,000 queries per round, K=10, probe=5, ivf_preload_entries=0.
  • No pod restarts in the final receipt for this run. This report does not attribute the slowdown to OOMKilled.

Actual Behavior

1. Completed POST rounds remain slow without query errors

Mode Previous R2 QPS Current R1 QPS Current R2 QPS
only/POST 507.83 20.11 62.28
filter/POST 506.63 123.75 99.66
threshold/POST 437.66 130.93 144.11

All six current POST rounds completed with zero reported query/connection errors. Current only/POST R2 P50/P95/P99 are 963.19 / 5632.27 / 8922.22 ms. Relevant recall values are close; only/POST is 0.7556 versus 0.7586.

These numbers establish an observed performance problem, not a controlled introducing-PR regression ratio. The entire group is degraded, physical object/cache states differ, and the preceding PRE phase has failures. See the limits below.

2. Runtime logs prove independent concurrent reads of the same extent

Current only/POST R2 runner markers:

  • UTC: 2026-11-04 18:50:05.103 - 18:52:48.474.
  • Beijing: 2026-11-05 02:50:05.103 - 02:52:48.474.
  • Timed query work is approximately 160.6 s; the marker interval also includes setup/reporting.

On AP nightly-regression-dis-ap-cn-6pp5f, one exact extent is:

path:   01a1a7b8-625c-790b-97f9-ae82b2ebe18f_00000
offset: 76356449
size:   25385955 bytes

There are 30 distinct slow-event records, finishing at 18:50:20.473231 - 18:50:21.340606 UTC, each with its own io.ReadFull and ToCacheData. They use the same pod, path, offset and size, not merely the same table or logical row. The events record the DiskCache path and not an S3 read or IOMerger wait.

One representative record contains:

io.ReadFull begin   125.945us
io.ReadFull end     113.672431ms
ToCacheData begin  113.673672ms
ToCacheData end    251.788122ms
Read return       504.779563ms

Reconstructed event intervals overlap substantially, approximately 20 simultaneous ReadFull calls when anchored to the server log timestamps. This concurrency estimate is approximate, not a hardware queue-depth measurement. The separate read/conversion calls are directly logged and do not depend on the overlap estimate.

The 30 reads account for 761,578,650 logical bytes (~726.3 MiB) for that one ~24.2 MiB extent. This is FileService logical work, not an attribution of physical device bytes. The retrieved slice reached its 800-record limit, so it is a concrete example, not an exhaustive count or estimate of all R2 duplication.

Two other extents in the same slice have 19 and 17 independent read/conversion records respectively. This is not only a single new object fetched once.

3. Metrics corroborate an expensive local-cache path on one AP

Mean of the process-wide rate(...[1m]) samples evaluated inside the R2 interval:

Metric AP 6pp5f AP gs6dw
CPU cores used 13.59 / 14 1.57 / 14
Block-device read rate 1076.65 MiB/s 5.89 MiB/s
DiskCache hit entries/s 1030.61 1.67
S3-served entries/s 1.97 0.47
DiskCache-read duration sum rate 78.72 s/s 0.13 s/s
Cached-data conversion duration sum rate 48.99 s/s 0.02 s/s
S3-read duration sum rate 0.56 s/s 0.02 s/s

The previous only/POST-near window shows almost all memory hits, fewer than one DiskCache hit entry/s on each AP, and approximately 1.85 MiB/s / almost zero device reads.

These are process-wide rolling samples, not SQL-exclusive counters. The previous R2 is shorter than one minute, so that window also includes R1. Duration sums include concurrent/nested operations and must not be added or interpreted as wall-time/CPU percentages. Cache entry counts are not bytes, unique objects, or disk IOPS. Device accounting does not prove the PVC's hardware throughput limit was reached.

4. Exact 4.2 source explains the duplicate-work path

At the tested commit:

  1. S3FS.Read checks MemCache, and defers MemCache publication.
  2. It enters DiskCache before IOMerger.
  3. DiskCache.Read invokes IOEntry.ReadFromOSFile; setCachedData invokes the conversion callback.
  4. A complete DiskCache hit returns at s3_fs.go:752, without reaching IOMerger around line 791.
  5. Concurrent memory misses can therefore independently perform the expensive read/conversion before a decoded cache entry becomes reusable.

The current 4.2-dev source retains this order and does not have main's eligible warm disk-fill coordination.

This is the concrete defect being tracked. We have not proved a new FIFO bug, a memory leak, or the exact per-key eviction chain in this nightly. The problem is avoidable duplicate work under concurrent misses, not the mere existence of capacity misses.

Expected Behavior

For eligible concurrent reads of one immutable extent, reuse a completed in-flight fill/publication where feasible instead of multiplying large disk reads and conversions solely because they started before publication.

Any 4.2 fix must preserve bounded admission, cancellation, timeout/failure fallback, FileService close behavior and ordinary cold/different-key reads. It must not require unlimited caching, stable single-CN routing, a globally serialized disk queue, or unrelated cache-budget changes.

Steps to Reproduce

  1. Use the linked 4.2 Wiki workload and retain its frozen query/input/configuration receipts.
  2. Inspect only/POST R2, where all 10,000 queries complete without errors.
  3. Query the AP's FileService slow-event logs and group by (pod, path, offset, size). Verify each occurrence contains its own ReadFull/conversion rather than counting repeated log summaries.
  4. Correlate with FileService counters and main-container device/CPU metrics, respecting scrape/window boundaries.

Reproduction status: this report independently re-read the actual nightly artifacts and historical Loki/Prometheus data and reviewed the exact running/current code. It did not rerun the 10M test or execute a new 4.2 deterministic UT. #28898 contains a main-branch mechanism reproduction; it must not be represented as fresh 4.2 validation.

For a deterministic 4.2 fix gate, adapt the existing FileService fixture: warm DiskCache, arrange concurrent misses for one immutable extent, measure actual reads/conversions, verify returned bytes and cleanup, then compare baseline/candidate. Include different-key, memory-hit, cold, admission-limit, cancel/close and leader-failure controls before workload validation.

Additional information

What this report does not attribute

Search and scope decision

Rechecked open Issues/PRs using 28898, 28918, DiskCache 4.2, cache coalescing, and Wiki 4.2; read the closed original issues and open #32157. #30167 is ENOSPC directory capacity, #30755 is shared-service ownership, #27757 is connection availability, and #29092 concerns FIFO reclaim behavior. None replaces active tracking of this observed 4.2 same-key warm-cache duplication.

Acceptance requires validation on the affected 4.2 branch. A main-only merge, one successful nightly, or a change to the global performance-series identity is not sufficient to close this issue.

Activity

  1. added
    kind/bug
    on Nov 5, 2026
  2. self-assigned this
    on Nov 5, 2026
  3. added
    severity/s0
    and removed on Nov 5, 2026
  4. XuPeng-SH commented on Nov 7, 2026

    @XuPeng-SH
    Contributor

    #28918 backport evaluation: not portable to 4.2-dev as a cherry-pick

    Tried git cherry-pick 77202a6e9f (the #28918 merge) against current 4.2-dev ff8632534e:

    Conclusion: landing this fix on 4.2-dev first requires a maintainer decision to backport the #28413 feature, then re-applying this fix, with the full pkg/fileservice normal + race validation replayed. That is a feature backport, not a cherry-pick, so no backport PR was opened for this item and this issue remains the tracker. A 4.2-local minimal coordination design was not attempted (it would be a new change, not a backport).

    The other two items from this batch are up: #32249 -> PR #32347, #32244 -> PR #32346.

  5. added a commit that references this issue on Nov 8, 2026
    0351bc8
  6. LeftHandCold commented on Nov 28, 2026

    @LeftHandCold
    CollaboratorAuthor

    4.2 field validation after #32361: Nov 28 Wiki 10M job, immutable build selection. Wiki tested 0e568746d2d3093a4356c874641ae3aa57365369, which contains 0351bc89d7 (#32361). All times here are Nov 27 UTC.

    • Both threshold/PRE rounds used the same fixed AP and 100 workers; both completed 10,000 queries. R1/R2 P50: 1578/1568 ms; P95: 2285/2303 ms; P99: 2601/12276 ms; R2 max: 14125 ms. This is not a broad 5x slowdown.
    • In the combined two-round window (19:08:05-19:13:40), the ingress AP logged 100 executions >=10 s for the benchmark tenant; all 100 connection IDs map to the round-2 ingress artifact. Subtracting Exec.Run duration from the server log timestamp gives starts 19:10:49.709-19:10:50.213; completions 19:11:02.162-19:11:03.976; durations 12.20-14.10 s. This is a first-wave server-side stall, not just client timer or routing noise.
    • During that wave, on the same AP, at least 7 overlapping reads of the same immutable extent (file ending 82f2-775e-bfb1-c5ddb646fdda_00000, offset 107191, size 25,305,920 bytes) each recorded DiskCache, io.ReadFull and ToCacheData; elapsed times 506-646 ms. This is repeated logical local-cache work, not proof of seven physical disk or object-store reads.
    • Scrapes bracketing the wave at 19:10:47.274 and 19:11:17.274: ingress AP mo_fs_shared_decode_total deltas: bypass_admission +1572, bypass_timeout +23, conversion +1708, leader +113, reuse +222. These are pod-wide 30-second counts, not per-query attribution. Sharing was active, not disabled; the bounded implementation intentionally allows fallback. These counters do not identify the rejection reason for that specific extent.

    This is evidence of residual warm DiskCache read amplification in a real PRE startup burst, not proof that #32361 is broken, that the repeated reads explain the full stall, or that main shares this cause. To discriminate: repeat only threshold/PRE on the same index/AP with synchronized vs staggered first-wave dispatch; keep the measured workload unchanged otherwise, and compare per-extent duplicate fills, sharing outcomes and subsequent steady-state latency. Do not raise the sharing budget without a memory-pressure control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions