Repository navigation
perf(fileservice): decide whole-object prefetch of narrow reads per table - #32040
Conversation
…able (matrixorigin#32033) The disk cache keeps one thrash signal per table instead of one per cache, so a table that fits keeps its whole-object prefetch while another table thrashes. A table switches first when its whole objects are used least, and turns off after its own quiet period, which doubles when it thrashes again. The IVFFLAT pre-filter join back is marked narrow like the plain join back. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#32033) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
…d objects (matrixorigin#32033) S3FS.Read applies the per-table decision to every narrow read, using the table from the read context. Reads of no table are never skipped, an evicted file's table mapping is dropped, and only scans with a read policy carry a table in their context. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: a4f42da34042bc3d4000e2cb3cef9c3389686fe7
Assessment: request_changes
The per-table policy is coherent, but its history map needs bounded retention before approval.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
- P2
pkg/fileservice/disk_cache_preload.go:162: A long-lived CN observes whole-object evictions for successive table IDs, including tables subsequently dropped or no longer read.
Impact: Each table permanently adds a groupUsage entry. Memory grows with historical table count, independently of disk capacity and preloadObjectsMax. Bound or expire these histories while preserving active cooldown behavior, and add a table-churn regression test.
Evidence: removed creates p.groups entries; deleted only clears object records, and quiet-period recovery only resets flags/samples. No group deletion or capacity limit exists. A probe using the unchanged controller retained all 128 table histories after their objects were removed, explicit deletion, 24 hours of simulated idle time and another read. See controller-probe-distinct-objects.log.
Validation:
-
Read all 19 changed files and reconciled both discussion items; reviewed the linked issue and design.
-
Isolation preflight passed. Controller diagnostics confirmed retention while table-separation, zero-group and quiet-recovery controls passed.
-
Frozen CI reports 13 successful, 14 skipped and two neutral checks.
-
Source identity, probe provenance and terminal receipts were reconciled in validation-manifest.json; source remains unchanged.
Limitations:
-
The probe tests the controller directly, not live SQL or full-package behavior. Broader package/race/performance validation stopped after the lifecycle blocker.
-
Performance measurements are author-reported; their raw logs were unavailable. No production OOM is claimed.
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
The per-table thrash-signal rework is correct; I found no new blocking or non-blocking issues. Prior behavior (#32034) kept one thrash signal per disk cache; this PR maps each whole-object cache file to a table via a context-carried group (table ID) and keeps an independent EWMA, tiered-threshold, and quiet-period signal per table, deciding per narrow read in S3FS.Read and per object in the prefetch gates. I verified from code: group propagation (table_scan attaches TableID when ReadPolicy != 0; scope.go falls back to ObjRef.Obj, which carries the table ID; remote-run deserialization restores TableDef and node; the IVFFLAT entries scanner attaches the hidden table's TblId; group 0 never skips); the preloadUsage state machine (tiered trip 0.1 over 4 evictions and 0.4 over 16, average/sample reset on turn-off, quiet-period doubling capped at 10 min, explicit deletes excluded, objects map bounded at 1<<16) against its new unit tests; path consistency between the read/prefetch fill and the skip decision (both normalize via parseFilePathAtService and pathForFile on the object Name().String()); the prefetch gates (local per-block skip with consistent cursor bookkeeping; remote retains tombstone prefetch); and the IVFFLAT pre-filter rewrite (the filter scan is copied before scanNode.NarrowScan is set, so only the join-back scan is marked, with a test proving the copy stays unmarked). All callers of the renamed FullFilePreloadSkipped API are migrated and no stale implementers of the removed interface remain. An earlier mo-bot review raised a P2 that preloadUsage.groups retains one entry per table ID forever under table churn; the author has not addressed it, so it is not duplicated here, and it remains the one open, non-blocking concern. Limitation: tests could not be executed in this checkout because the touched packages require native third-party libraries (jemalloc, CRoaring, xxHash, usearch under thirdparties/install) that are absent, CGO_ENABLED=0 is unsupported (pkg/common/mpool requires the C allocator), and building them is environment setup outside review scope; validation was static, including compile-level checks of every changed call site and test helper.
|
mo-bot review · Commit: New discussion was assessed; the previous review remains unchanged. |
🚫 Left the queue · pull request branch update failed51 min in the queue, with no time running CI. So far
Reason The pull request can't be updated
To get back in the queue
Requeued — the merge queue status continues in this comment ↓. Times in UTC · dashboard · how the merge queue works |
🛑 Queue command cancelled |
✅ Merged into
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #32033
What this PR does / why we need it:
Follow-up to #32034. #32034 keeps one thrash signal per disk cache: when one table thrashes, every narrow read switches to range reads, including tables that would fit. This PR keeps one signal per table.
Design (
docs/design/20261102-thrash-aware-prefetch.md, updated):JOIN(base, SEMI(search, filter scan))) is now marked narrow like the plain join back; the filter scan copied from the base scan is not.S3FS.Readfor every narrow read, from the table in the read context; reads of no table are never skipped.Measurements (wiki_all 1M, IVFFLAT lists=1000, probe_limit=8, filtered query, MinIO, empty disk cache; 50 cold, 50 warm, 35 s pause, 50 more; avg ms, p95 in brackets):
Not in this PR: marking reads narrow by the share of an object's blocks they select (point and primary-key lookups without a plan mark). Tried and rejected: the TPC-H joins with selective runtime filters became narrow, and TPC-H round one took 64 s with 9,678 S3 requests.
Tests: per-table signal unit tests (separation, tiered trip, own quiet period, doubling, deletes, bounds), a real disk cache reporting a group, S3FS per-group decision, the prefetch gate and both data sources, table id reaching the read context from the scan operator, the scope fallback to the object reference, the IVFFLAT entries search, and the pre-filter join back plan mark.
🤖 Generated with Claude Code