ReaderExecutor: pipeline-based read orchestration by CheSema · Pull Request #103706 · ClickHouse/ClickHouse · GitHub
Skip to content
Draft
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
520 commits
Select commit Hold shift + click to select a range
9dfbe97
test(IO): metric grid as state x pattern x budget matrix with a summa…
CheSema Jun 3, 2026
07f665d
test(IO): drop the drop_cache param from _measure
CheSema Jun 3, 2026
d6a3b43
feat(IO): add ReaderExecutor modeled-cost and requested-bytes Profile…
CheSema Jun 3, 2026
c1675ab
test(IO): gate the metric on cost-per-MiB and per-(metric x case) bands
CheSema Jun 3, 2026
0efff93
test(IO): align the unit grid cost model to bytes_from_source
CheSema Jun 3, 2026
f02441a
feat(IO): expose ReaderExecutor cost-per-byte as an async metric
CheSema Jun 3, 2026
c784f93
feat(IO): bridge small cached gaps on the live ReaderExecutor connection
CheSema Jun 3, 2026
140f65c
test(IO): cover the executor page-cache read path in the metric integ…
CheSema Jun 3, 2026
e547649
feat(IO): keep the live connection across small forward seeks
CheSema Jun 3, 2026
4e4fc7a
feat(IO): tune the bridge bound to 2 MiB and add the ReaderExecutor d…
CheSema Jun 3, 2026
ea1dc62
fix(test): exclude reader_executor_use_live_connections from 03413
CheSema Jun 3, 2026
f2e8565
Address review: guard the ~DiskCacheHandle deferred LRU bump against …
CheSema Jun 3, 2026
16af93e
Address review: make ~ReaderExecutor cleanup non-allocating / non-thr…
CheSema Jun 3, 2026
58312d9
Address review: pre-reserve the prefetch abandon slot so stashing nev…
CheSema Jun 3, 2026
24d1d8c
Address review: unify prefetch discard on the pre-reserved abandon slot
CheSema Jun 3, 2026
1fabec1
fix(IO): allocate the prefetch handle before scheduling its task
CheSema Jun 4, 2026
ac47888
fix(IO): publish PrefetchHandle Done before fulfilling the future
CheSema Jun 4, 2026
4c619e6
fix(IO): replace sleep-polls in prefetch pool tests with std::latch
CheSema Jun 4, 2026
20a9fbd
fix(IO): reject Rope::tryRewind into gaps between disjoint nodes
CheSema Jun 4, 2026
f1f67ec
perf(IO): keep the full read window for stateless and local reads
CheSema Jun 4, 2026
05cd497
fix(IO): direct-IO descriptors opt out of external-buffer mode
CheSema Jun 4, 2026
f1e8519
Merge remote-tracking branch 'origin/master' into reader-executor
CheSema Jun 4, 2026
8ec832b
docs(IO): clarify ReaderExecutor bytes_from_* are physical issued bytes
CheSema Jun 4, 2026
6e1fc87
fix(IO): log actual bytes for a discarded executor prefetch
CheSema Jun 4, 2026
eb612b2
refactor(IO): stop populating filesystem_cache_log from the ReaderExe…
CheSema Jun 4, 2026
7d9fc78
docs(IO): align reader_executor_log bytes_from_* column docs
CheSema Jun 4, 2026
b370b9b
fix(IO): make ReaderExecutor memory-pressure reload transactional and…
CheSema Jun 4, 2026
07bdd08
docs: mark ReaderExecutor prefetch pool settings as restart-only
CheSema Jun 4, 2026
818433d
fix(test): drop cache_log arg from gtest_filecache DiskCacheProvider …
CheSema Jun 4, 2026
8cfb789
perf(IO): retain the open cache-segment reader in DiskCacheProvider
CheSema Jun 5, 2026
0154f6a
Merge remote-tracking branch 'origin/master' into reader-executor
CheSema Jun 5, 2026
cb5451b
perf(IO): cache cache-segment readers in a bounded keep-alive set
CheSema Jun 5, 2026
f470a17
fix(IO): honor reader_executor_use_live_connections in StorageObjectS…
CheSema Jun 5, 2026
67e73b6
fix(IO): bound the executor's stateless one-shot read to a finite extent
CheSema Jun 5, 2026
a17faa5
docs(IO): align ReaderExecutor bytes-from ProfileEvent descriptions w…
CheSema Jun 5, 2026
66d42c0
docs(IO): drop stale `allocations` from `reader_executor_log` descrip…
CheSema Jun 5, 2026
2bd85de
fix(IO): disable distributed cache for unknown-size objects in Storag…
CheSema Jun 5, 2026
a4c40f5
fix(IO): qualify object-storage cache keys with storage identity
CheSema Jun 5, 2026
70155c2
perf(IO): reuse a held cache-segment reader on the sequential read path
CheSema Jun 8, 2026
20efca6
refactor(IO): add read-only planResidency probe to ICacheProvider
CheSema Jun 8, 2026
5a80cdc
refactor(IO): plan-then-stream resident reads in ReaderExecutor (sing…
CheSema Jun 8, 2026
8eb95e5
perf(IO): skip prefetch for fully-resident windows in ReaderExecutor
CheSema Jun 8, 2026
c04e8ab
refactor(IO): unify ReaderExecutor read path on the residency plan
CheSema Jun 8, 2026
913893d
fix(IO): keep the cache-status pause failpoint on the plan-resident r…
CheSema Jun 8, 2026
7fd073e
refactor(IO): introduce ReadPlan with a positional query API
CheSema Jun 8, 2026
c92d4a4
refactor(IO): serve resident runs from ReadPlan in readNextWindow
CheSema Jun 8, 2026
975edb7
fix(IO): fire the cache-status failpoint on the resident fast-path
CheSema Jun 8, 2026
b6ef568
refactor(IO): bound the executor gap read to the plan gap
CheSema Jun 8, 2026
bfdf330
refactor(IO): make readNextWindow plan-first with a gap-keyed prefetch
CheSema Jun 8, 2026
f799b12
test(IO): guard the plan-first prefetch invariant in ReaderExecutor
CheSema Jun 8, 2026
56b8d5e
refactor(IO): introduce WritePlan for the executor's cache backfill
CheSema Jun 8, 2026
89e0c3b
feat(IO): promote lower-tier reads into faster caches (WritePlan)
CheSema Jun 8, 2026
2691ce3
refactor(IO): promote through the prepare-stage plan, not a per-serve…
CheSema Jun 8, 2026
c7f4fe2
refactor(IO): skip the prefetch slot acquire on a resident cursor
CheSema Jun 9, 2026
8e4eb48
fix(IO): stop churning a SourceBufferLimit slot per warm window
CheSema Jun 9, 2026
e234515
fix(test): scope 04317 system.query_log query to currentDatabase
CheSema Jun 9, 2026
ac8c3da
refactor(IO): encapsulate the kept-open source connection in LiveConn…
CheSema Jun 9, 2026
45f6e1e
refactor(IO): prefetch jobs accumulate into a job-local Stats
CheSema Jun 9, 2026
b8bee06
refactor(IO): move the source connection into the prefetch job (pure …
CheSema Jun 9, 2026
8f92155
refactor(IO): co-own an immutable plan geometry; retire the prefetch …
CheSema Jun 9, 2026
af624b2
Merge remote-tracking branch 'origin/master' into reader-executor
CheSema Jun 9, 2026
a409146
perf(IO): sample memory pressure once per plan, not per read
CheSema Jun 9, 2026
f3c3629
refactor(IO): make the prefetch worker a pure source fetcher
CheSema Jun 10, 2026
7641e7a
refactor(IO): rework ReaderExecutor live-connection lease and metrics
CheSema Jun 10, 2026
f8755b3
Merge branch 'master' into reader-executor
CheSema Jun 10, 2026
f9c1d50
test: renumber reader_executor stateless tests to 04327-04337
CheSema Jun 10, 2026
20148b8
refactor(IO): extract ReaderExecutor read-range trimming into named s…
CheSema Jun 10, 2026
177230b
refactor(IO): unify the duplicated ReaderExecutor cache-tier backfill…
CheSema Jun 10, 2026
aa1ad95
refactor(IO): make the ReaderExecutor write handle a named plan opera…
CheSema Jun 10, 2026
1eefb49
refactor(IO): add per-range read/write cache-buffer API beside ICache…
CheSema Jun 11, 2026
d355642
refactor(IO): DiskCache realization of the per-range buffer API
CheSema Jun 11, 2026
d3c1e42
refactor(IO): PageCache realization of the per-range buffer API
CheSema Jun 11, 2026
c73ac18
refactor(IO): switch ReaderExecutor to the per-range cache buffer API
CheSema Jun 11, 2026
253045d
test(IO): migrate ReaderExecutor mocks and filecache test to the per-…
CheSema Jun 11, 2026
b429b24
refactor(IO): delete the old ICacheHandle cache API and rename Cache{…
CheSema Jun 11, 2026
edad35e
refactor(IO): make ReadPlan the single source of truth for the look-a…
CheSema Jun 11, 2026
0de7fb5
refactor(IO): name the aligned fetch window `fetchWindowAt`
CheSema Jun 11, 2026
bbc35f0
refactor(IO): extract the caches->plan translation into two helpers
CheSema Jun 11, 2026
aa90bc7
refactor(IO): unify the gap assembly + over-read rule into assembleAn…
CheSema Jun 11, 2026
f4cc7e5
refactor(IO): split readNextWindow into serveCacheBlock + coverWindow
CheSema Jun 11, 2026
d175306
refactor(IO): lift the prefetch state machine out of coverWindow
CheSema Jun 11, 2026
f1eca60
perf(IO): prefetch the first gap, overlapping it with resident streaming
CheSema Jun 11, 2026
a2fb469
perf(IO): prune lower-tier cache misses covered by a faster tier
CheSema Jun 12, 2026
987c007
test(IO): cover proactive multi-tier fill across an embedded faster-t…
CheSema Jun 12, 2026
40fca57
Merge remote-tracking branch 'origin/master' into reader-executor
CheSema Jun 12, 2026
9680332
test(IO): adapt the upstreamed metric assertions to live connection a…
CheSema Jun 12, 2026
d3ef2f4
fix(style): use VectorWithMemoryTracking in the ReaderExecutor cache …
CheSema Jun 12, 2026
38d300b
feat(IO): add void-typed JobHandle submit to PrefetchThreadPool
CheSema Jun 12, 2026
0351007
refactor(IO): absorb PrefetchJob into FetchMachine + runner
CheSema Jun 12, 2026
66aba74
feat(IO): tile-granular interruption and takeover for FetchMachine
CheSema Jun 12, 2026
e4d7f63
feat(IO): defer machine-collected windows cache fill to put steps
CheSema Jun 12, 2026
8269973
feat(IO): defer the sync path cache fill through put-only machines
CheSema Jun 12, 2026
3801145
feat(IO): defer warm-path tier promotion to put-only machines
CheSema Jun 12, 2026
f3e5dd4
fix(IO): keep I == DiskConnectionsReset under machine interrupts
CheSema Jun 12, 2026
9fcbe11
fix(IO): split machine stop intents - cost-gated takeover vs immediat…
CheSema Jun 12, 2026
83c4b74
refactor(IO): retire collect takeover; soft cancel; single stop flag
CheSema Jun 12, 2026
bb0322a
fix(IO): never cut a one-shot GET; live connections stop freely
CheSema Jun 12, 2026
49a9207
fix(style): mark the intentionally swallowing catch in waitReleased
CheSema Jun 12, 2026
f74cec4
fix(IO): resolve a revoked JobHandle with a value, not an exception
CheSema Jun 12, 2026
c3e3969
fix(tidy): remove duplicate includes
CheSema Jun 12, 2026
aa6db73
refactor(IO): declarations-only headers for executor utility classes
CheSema Jun 12, 2026
aa1c5a9
refactor(IO): reorganize cache-provider and Rope headers
CheSema Jun 12, 2026
c5e7b4d
refactor(IO): align ReadPipeline and PipelineReadBuffer cpp order wit…
CheSema Jun 12, 2026
8a270db
refactor(IO): restructure ReaderExecutor header and align cpp order
CheSema Jun 12, 2026
37dda1e
refactor(IO): replace ReaderExecutor configuration setters with Options
CheSema Jun 12, 2026
e88ee69
Merge remote-tracking branch 'origin/master' into reader-executor
CheSema Jun 13, 2026
523b9ca
docs(IO): fix stale runner comment after Options migration
CheSema Jun 13, 2026
d6b76f5
refactor(IO): extract ReadPlanGeometry to its own header
CheSema Jun 13, 2026
24b5c2f
feat(IO): PlanSchedule describer — typed ranges and step schedule
CheSema Jun 13, 2026
fd81c4f
feat(IO): describePlan emits the retrieve job set with routing and deps
CheSema Jun 13, 2026
35aa486
test(IO): validate describePlan against the live executor
CheSema Jun 13, 2026
9ae45a3
feat(IO): drive cache fill from the plan schedule
CheSema Jun 13, 2026
d90416b
test(IO): multi-fetch coverage for the plan schedule
CheSema Jun 13, 2026
f427770
feat(IO): describePlan emits UpperCacheRead for split embedded hits
CheSema Jun 13, 2026
16ee0dc
test(IO): assert executor byte-KPIs equal the schedule's prediction
CheSema Jun 13, 2026
0339f04
test(IO): embedded upper-hit is filled from the upper serve, not over…
CheSema Jun 13, 2026
3831f2c
test(IO): fully-covering upper hit needs no remote (embedded-hit case 3)
CheSema Jun 13, 2026
19987eb
refactor(IO): remove live connections from ReaderExecutor
CheSema Jun 14, 2026
f3d08f1
feat(IO): add ContinuityTracker for continuous-read detection
CheSema Jun 14, 2026
39897da
refactor(IO): make ContinuityTracker a pure estimator
CheSema Jun 14, 2026
c767109
feat(IO): feed the schedule's predicted reads + seeks into Continuity…
CheSema Jun 14, 2026
b52f2e8
test(IO): verify ContinuityTracker captures the full sequential read
CheSema Jun 14, 2026
d26c425
refactor(IO): rename live connections to long connections in ReaderEx…
CheSema Jun 14, 2026
3b1b4b0
feat(IO): add the LongConnection type and lifecycle helpers (default-…
CheSema Jun 14, 2026
06cc926
feat(IO): carry the long connection through the prefetch machine (W1)
CheSema Jun 14, 2026
533f108
feat(IO): drain a held/carried long connection in the source read (W2)
CheSema Jun 14, 2026
7f41490
Merge remote-tracking branch 'origin/master' into reader-executor
CheSema Jun 14, 2026
a0ccaf2
fix(IO): rename stale LiveConnectionLimit references in Server.cpp
CheSema Jun 15, 2026
697c0b9
feat(IO): bound long connections to the read extent and bridge cached…
CheSema Jun 15, 2026
7b767a5
feat(IO): extend the long connection past the read extent to the obje…
CheSema Jun 15, 2026
8590a64
test(IO): assert the long connection spans multiple advancing extents
CheSema Jun 15, 2026
c2312ee
feat(IO): open the long connection on the prefetch launch path (W3b)
CheSema Jun 15, 2026
d01f2cc
feat(IO): wire the long-connection observability ProfileEvents (Stage 2)
CheSema Jun 15, 2026
5e16353
test(IO): complete the live->long rename in ReaderExecutor stateless …
CheSema Jun 15, 2026
55ef505
fix(IO): attribute reaped long-connection pool resets to the query
CheSema Jun 15, 2026
e2ef8f9
test(IO): rename setting and refresh baseline in test_reader_executor…
CheSema Jun 15, 2026
68a70a6
feat(IO): open long connections when the predicted reach passes the r…
CheSema Jun 15, 2026
2d43694
refactor(IO): adopt coverage-map/schedule/processing vocabulary
CheSema Jun 15, 2026
8c9a37c
refactor(IO): allocate the per-job status sidecar from the schedule
CheSema Jun 15, 2026
b83fad1
feat(IO): assert spine proving the schedule predicts the live walk (d…
CheSema Jun 15, 2026
138a808
feat(IO): schedule-driven readNextWindow interpreter (flag-guarded, d…
CheSema Jun 15, 2026
a35b22b
test(IO): measure the schedule-driven interpreter in the metric grid
CheSema Jun 15, 2026
9583696
fix(IO): drain put machines before dropping the plan on a schedule-dr…
CheSema Jun 15, 2026
c193993
test(IO): add the schedule-driven mode to the integration metric grid
CheSema Jun 15, 2026
640eff4
fix(ci): use a memory-tracking container + pin 02910 to the legacy re…
CheSema Jun 15, 2026
3f5cb17
perf(IO): bound schedule-driven long connection by the job's exact end
CheSema Jun 15, 2026
e1fcc49
feat(IO): enable schedule-driven ReaderExecutor by default
CheSema Jun 16, 2026
4702cf8
refactor(IO): make the schedule-driven reader the sole path and decid…
CheSema Jun 16, 2026
c027f3c
refactor(IO): emit one schedule retrieve per gap, not per coalesced c…
CheSema Jun 16, 2026
4f0dce8
fix(IO): rewrite the resident-region walk-back as a while loop (cpp s…
CheSema Jun 16, 2026
e5029fe
refactor(IO): drop two unused ReaderExecutor test probes
CheSema Jun 17, 2026
6c0e16a
Merge branch 'master' into reader-executor
CheSema Jun 17, 2026
74dbf7b
refactor(IO): converge the reader executor onto upstream `ChainedBuff…
CheSema Jun 17, 2026
5872c17
refactor(IO): share one bounded reach between the long-conn trigger a…
CheSema Jun 17, 2026
b2095bf
refactor(IO): move ReaderExecutor test observability into a friend in…
CheSema Jun 17, 2026
92571d4
refactor(IO): introduce a foreground-driven put lane for deferred cac…
CheSema Jun 17, 2026
76daea3
refactor(IO): S3 - flushPutLaneOverlapping serializes the same-segmen…
CheSema Jun 17, 2026
b8d55d5
refactor(IO): make the put lane the sole deferred-cache-fill path; de…
CheSema Jun 17, 2026
f9c9ab6
refactor(IO): extract a thread-safe ReaderExecutorDecryptor (decrypti…
CheSema Jun 17, 2026
7f3c16a
refactor(IO): decrypt in the ReaderExecutor serve, not the read buffe…
CheSema Jun 18, 2026
c25acc6
feat(IO): decrypt prefetched bytes on the read-ahead worker (decrypti…
CheSema Jun 18, 2026
b86bbbd
fix(IO): mark decryptFetchedAhead's cipher [[maybe_unused]] for the U…
CheSema Jun 18, 2026
0103244
fix(IO): register reader_executor_decrypt_ahead in SettingsChangesHis…
CheSema Jun 18, 2026
a0c4d47
refactor(IO): express atEnd as an explicit if/else by source size
CheSema Jun 18, 2026
ca42a2e
Merge remote-tracking branch 'origin/master' into reader-executor
CheSema Jun 18, 2026
19ea7a4
refactor(IO): put lane references shared cache writers in place, no b…
CheSema Jun 18, 2026
7662754
feat(IO): add ReaderExecutorObservations ProfileEvent (plan-rebuild c…
CheSema Jun 19, 2026
147ac6c
perf(IO): decouple the ReaderExecutor residency lookup from the read-…
CheSema Jun 19, 2026
7f5f5ea
refactor(IO): remove the scattered ReaderExecutor SE-2 assert spine
CheSema Jun 19, 2026
bb8e7b2
fix(IO): feed the ReaderExecutor lookup estimator on cache hits only
CheSema Jun 19, 2026
071a5fa
test(IO): recalibrate the long-connection metric grid to churn-free c…
CheSema Jun 19, 2026
d1fc3b4
perf(IO): bump cache LRU via the held holder, not a second cache->get
CheSema Jun 19, 2026
bb43049
perf(IO): skip the redundant anchor-cache insert on a slot-reused reader
CheSema Jun 19, 2026
5865aa3
perf(IO): skip ReaderExecutor prefetch bookkeeping on a fully-cached …
CheSema Jun 19, 2026
a1adbe4
perf(IO): do not cancel the ReaderExecutor read-ahead on a read-exten…
CheSema Jun 19, 2026
7255aea
perf(IO): grow ReaderExecutor look-ahead on cold sequential reads
CheSema Jun 22, 2026
2d59fb5
perf(IO): fetch the full cache segment on a ReaderExecutor miss
CheSema Jun 22, 2026
d615ed1
perf(IO): coordinate concurrent cold populate via the segment downloader
CheSema Jun 22, 2026
fb23513
refactor(IO): run the ReaderExecutor cache fill inline at collect
CheSema Jun 22, 2026
4b42e0f
refactor(IO): remove the ReaderExecutor put lane; fill and promote in…
CheSema Jun 22, 2026
6474a9a
refactor(IO): remove the now-unused ReaderExecutor CacheFiller pool
CheSema Jun 22, 2026
eb5a1a7
refactor(IO): guard CacheWriter committed state with a per-writer mutex
CheSema Jun 22, 2026
6527d22
refactor(IO): record ReaderExecutor fill-target writers at launch
CheSema Jun 22, 2026
7a3abd2
perf(IO): coordinate the prefetch worker's cold-populate fetch
CheSema Jun 22, 2026
763dae6
fix(IO): revoke a sparse ReaderExecutor prefetch to the sync path
CheSema Jun 23, 2026
9ca00f6
fix(IO): join the prefetch worker before freeing the plan it writes
CheSema Jun 23, 2026
d146dfb
refactor(IO): drop dead params/fields and stale comments in ReaderExe…
CheSema Jun 23, 2026
572618f
refactor(IO): remove always-zero ReaderExecutor metrics and log columns
CheSema Jun 23, 2026
c401ddc
refactor(IO): dedup ReaderExecutor long-connection check and DiskCach…
CheSema Jun 23, 2026
bb5dd1a
refactor(IO): fold hit/miss entries into the base CacheView, drop emp…
CheSema Jun 23, 2026
06a682c
fix(IO): cover only materialized source bytes in ReaderExecutor assembly
CheSema Jun 23, 2026
8ac1161
fix(IO): complete elected-but-unfetched cache segments on the prefetc…
CheSema Jun 24, 2026
33655f7
fix(IO): drop duplicate ReaderExecutor KPI async-metric block
CheSema Jun 24, 2026
e2229b9
Merge remote-tracking branch 'origin/master' into reader-executor
CheSema Jun 24, 2026
379a824
chore: trigger sync-PR recreation
CheSema Jun 24, 2026
e3bdefc
fix(Core): place reader_executor settings under 26.7 in SettingsChang…
CheSema Jun 24, 2026
2419d56
feat(IO): add generalized_plan_window gate + pinned_end (inert, defau…
CheSema Jun 24, 2026
dce291f
feat(IO): unified generalized plan-window sizing + hit folding (gated)
CheSema Jun 24, 2026
54f31af
feat(IO): reuse the generalized plan across read_until advances (gated)
CheSema Jun 24, 2026
075d6a3
feat(IO): make the generalized plan window the default
CheSema Jun 24, 2026
e9d7a48
perf(IO): cross-cache fill classification — probe the upper tier over…
CheSema Jun 25, 2026
07f966f
refactor(IO): fetch fills the bottom cache tier; promote up on the se…
CheSema Jun 25, 2026
8e45ec0
test(IO): make EvictableSegmentMockCache data-faithful
CheSema Jun 25, 2026
80363da
refactor(IO): serve populatable retrieves from the committed cache cell
CheSema Jun 26, 2026
8471787
feat(IO): add streaming cache writes that hold the segment downloader
CheSema Jun 26, 2026
752b7b4
perf(IO): progressive fill-ahead run-ahead in ReaderExecutor
CheSema Jun 26, 2026
4bb230a
fix(IO): re-plan past plan_end when a read-ahead machine is in flight
CheSema Jun 26, 2026
57450de
perf(IO): account over-read as net waste, not gross over-fetch
CheSema Jun 26, 2026
d89b5c3
test(IO): update PlanSchedule retrieve tests to the bottom-tier-fill …
CheSema Jun 26, 2026
024e783
test(IO): probe segment-open-once on a fixed-small plan window
CheSema Jun 26, 2026
bf81bd6
feat(IO): add reader_executor_plan_look_ahead_max_window setting
CheSema Jun 26, 2026
a02014b
test(IO): integration A/B for the plan-window knob under load
CheSema Jun 26, 2026
4c20002
refactor(IO): drop the legacy plan path; fold single-tier plans cell-…
CheSema Jun 27, 2026
13f72ff
perf(IO): fix the plan window; drop continuity-for-plan-sizing
CheSema Jun 27, 2026
0db4a1e
perf(IO): reuse the base-request residency probe when the plan does n…
CheSema Jun 27, 2026
08d738f
Merge branch 'master' into reader-executor
CheSema Jun 27, 2026
65944cd
test(IO): re-baseline seek-heavy metric bands after merging master
CheSema Jun 27, 2026
03c675f
fix(IO): recover abandoned DOWNLOADING segment when a reader is its l…
CheSema Jun 29, 2026
5de0e71
test(IO): assert only config-independent invariants in the metric sta…
CheSema Jun 29, 2026
bb6ba1f
refactor(IO): remove dead ReaderExecutor plan state (pinned_end, BufE…
CheSema Jun 29, 2026
04d0e39
refactor(IO): remove dead PlanSchedule fields retain_for_serve and up…
CheSema Jun 29, 2026
2c71a12
refactor(IO): inline the ReaderExecutor put step, drop the dead defer…
CheSema Jun 29, 2026
75c7bf7
refactor(IO): remove the two dead ReaderExecutor profile counters
CheSema Jun 29, 2026
67d9e50
refactor(IO): demote reader_executor_decrypt_ahead to a test-only Opt…
CheSema Jun 29, 2026
a779791
refactor(IO): simplify ChainedBuffers + DiskCacheProvider (low-risk)
CheSema Jun 29, 2026
6ca25c0
refactor(IO): tidy ReaderExecutor exec-core/fetch helpers
CheSema Jun 29, 2026
ede1e59
refactor(IO): inline ContinuityTracker ewma_alpha + sweep stale comments
CheSema Jun 29, 2026
bd5f96b
refactor(IO): remove the experimental decrypt-ahead path
CheSema Jun 29, 2026
c132b0d
refactor(IO): replan only when the plan is fully consumed, not pre-em…
CheSema Jun 29, 2026
3dd1511
refactor(IO): un-thread the to_read parameter via a readCeiling() helper
CheSema Jun 29, 2026
d051922
refactor(IO): localize EOF handling in readNextWindow; factor prepare…
CheSema Jun 29, 2026
3327bd7
refactor(IO): make prepareCursor the sole serve-path scheduler; drop …
CheSema Jun 29, 2026
cee6c48
refactor(IO): merge serveCacheBlock into serveHitStep
CheSema Jun 29, 2026
5a570fb
refactor(IO): extract IFetchMachineRunner interface; rename to PoolFe…
CheSema Jun 29, 2026
3203064
refactor(IO): factor the FetchMachine step into makeFetchStep
CheSema Jun 29, 2026
8d7a31b
refactor(IO): add LocalFetchMachineRunner (inline runner), not yet wired
CheSema Jun 29, 2026
6ef81de
feat(IO): unified-foreground - serve the foreground via an inline Fet…
CheSema Jun 30, 2026
3f8ce13
perf(IO): inline foreground stops at the first sibling-led segment
CheSema Jun 30, 2026
cab3217
perf(IO): unify the foreground serve onto inline scheduled fills (fla…
CheSema Jun 30, 2026
47ae0d9
perf(IO): fold the legacy window fetch into the unified inline fill
CheSema Jun 30, 2026
45003bc
Merge remote-tracking branch 'origin/master' into reader-executor
CheSema Jun 30, 2026
6623e5d
feat(IO): make the unified inline foreground the ReaderExecutor default
CheSema Jul 1, 2026
e800c8e
refactor(IO): delete the legacy synchronous foreground read stack
CheSema Jul 1, 2026
330ee26
refactor(IO): remove the reader_executor_unified_foreground flag
CheSema Jul 1, 2026
0e45921
refactor(IO): count cache-as-buffer reads honestly (drop the cache-hi…
CheSema Jul 3, 2026
d9a7463
refactor(IO): make the schedule's fetch jobs executable as written (m…
CheSema Jul 3, 2026
37215f3
refactor(IO): display-derived job progress + one display wait (model M2)
CheSema Jul 4, 2026
76cae15
refactor(IO): one schedule-driven executor for the handed fills (mode…
CheSema Jul 4, 2026
43d9894
refactor(IO): one serve window, no serve-path geometry, no phase enum…
CheSema Jul 4, 2026
1500181
Merge remote-tracking branch 'origin/master' into reader-executor
CheSema Jul 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
2 changes: 1 addition & 1 deletion ci/jobs/scripts/clickhouse_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ def prepare_stateful_data(self, with_s3_storage, is_db_replicated):
fi
clickhouse-client --query "CREATE TABLE test.hits_s3 (WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UInt8, MobilePhoneModel String, Params String, IPNetworkID UInt32, TraficSourceID Int8, SearchEngineID UInt16, SearchPhrase String, AdvEngineID UInt8, IsArtifical UInt8, WindowClientWidth UInt16, WindowClientHeight UInt16, ClientTimeZone Int16, ClientEventTime DateTime, SilverlightVersion1 UInt8, SilverlightVersion2 UInt8, SilverlightVersion3 UInt32, SilverlightVersion4 UInt16, PageCharset String, CodeVersion UInt32, IsLink UInt8, IsDownload UInt8, IsNotBounce UInt8, FUniqID UInt64, HID UInt32, IsOldCounter UInt8, IsEvent UInt8, IsParameter UInt8, DontCountHits UInt8, WithHash UInt8, HitColor FixedString(1), UTCEventTime DateTime, Age UInt8, Sex UInt8, Income UInt8, Interests UInt16, Robotness UInt8, GeneralInterests Array(UInt16), RemoteIP UInt32, RemoteIP6 FixedString(16), WindowName Int32, OpenerName Int32, HistoryLength Int16, BrowserLanguage FixedString(2), BrowserCountry FixedString(2), SocialNetwork String, SocialAction String, HTTPError UInt16, SendTiming Int32, DNSTiming Int32, ConnectTiming Int32, ResponseStartTiming Int32, ResponseEndTiming Int32, FetchTiming Int32, RedirectTiming Int32, DOMInteractiveTiming Int32, DOMContentLoadedTiming Int32, DOMCompleteTiming Int32, LoadEventStartTiming Int32, LoadEventEndTiming Int32, NSToDOMContentLoadedTiming Int32, FirstPaintTiming Int32, RedirectCount Int8, SocialSourceNetworkID UInt8, SocialSourcePage String, ParamPrice Int64, ParamOrderID String, ParamCurrency FixedString(3), ParamCurrencyID UInt16, GoalsReached Array(UInt32), OpenstatServiceName String, OpenstatCampaignID String, OpenstatAdID String, OpenstatSourceID String, UTMSource String, UTMMedium String, UTMCampaign String, UTMContent String, UTMTerm String, FromTag String, HasGCLID UInt8, RefererHash UInt64, URLHash UInt64, CLID UInt32, YCLID UInt64, ShareService String, ShareURL String, ShareTitle String, ParsedParams Nested(Key1 String, Key2 String, Key3 String, Key4 String, Key5 String, ValueDouble Float64), IslandID FixedString(16), RequestNum UInt32, RequestTry UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDate, intHash32(UserID)) SAMPLE BY intHash32(UserID) SETTINGS index_granularity = 8192, storage_policy='s3_cache'"
# AWS S3 is very inefficient, so increase memory even further:
clickhouse-client --max_estimated_execution_time 0 --max_execution_time "$MAX_EXECUTION_TIME" --max_memory_usage 30G --max_memory_usage_for_user 30G --query "INSERT INTO test.hits_s3 SELECT * FROM test.hits SETTINGS enable_filesystem_cache_on_write_operations=0, write_through_distributed_cache=0, max_insert_threads=16"
clickhouse-client --max_estimated_execution_time 0 --max_execution_time "$MAX_EXECUTION_TIME" --max_memory_usage 30G --max_memory_usage_for_user 30G --query "INSERT INTO test.hits_s3 SELECT * FROM test.hits SETTINGS enable_filesystem_cache_on_write_operations=0, write_through_distributed_cache=0, max_insert_threads=8"

clickhouse-client --query "CREATE TABLE test.hits_parquet (Title String, URL String, Referer String, SearchPhrase String, WatchID UInt64, UserID UInt64, CounterID UInt32, EventTime DateTime, EventDate Date, RegionID UInt32, ClientIP UInt32) ENGINE = S3('https://clickhouse-public-datasets.s3.eu-central-1.amazonaws.com/hits_compatible/hits.parquet', NOSIGN)"

Expand Down
26 changes: 26 additions & 0 deletions programs/server/Server.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <Server.h>
#include <Common/CurrentThread.h>
#include <Common/QueryScope.h>
#include <Common/MemoryPressureMonitor.h>
#include <IO/LongConnectionLimit.h>

#include <memory>
#include <Interpreters/ClientInfo.h>
Expand Down Expand Up @@ -320,6 +322,10 @@ namespace ServerSetting
extern const ServerSettingsUInt64 max_io_thread_pool_free_size;
extern const ServerSettingsUInt64 max_io_thread_pool_size;
extern const ServerSettingsUInt64 max_keep_alive_requests;
extern const ServerSettingsUInt64 max_remote_read_connections;
extern const ServerSettingsUInt64 reader_executor_memory_pressure_level_1_pct;
extern const ServerSettingsUInt64 reader_executor_memory_pressure_level_2_pct;
extern const ServerSettingsUInt64 reader_executor_memory_pressure_level_3_pct;
extern const ServerSettingsUInt64 max_outdated_parts_loading_thread_pool_size;
extern const ServerSettingsUInt64 max_per_cpu_untracked_memory;
extern const ServerSettingsUInt64 max_partition_size_to_drop;
Expand Down Expand Up @@ -2413,6 +2419,15 @@ try
ServerSettings new_server_settings;
new_server_settings.loadSettingsFromConfig(config());

/// Reject an invalid memory-pressure threshold triple BEFORE applying any
/// live setting below: `setThresholds` validates too, but it runs after the
/// pools/throttlers/workloads are already reloaded, so a late throw would
/// leave those earlier settings from the same rejected reload published.
validateMemoryPressureThresholds(

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.

validateMemoryPressureThresholds now prevents the invalid threshold triple from being applied to the live ReaderExecutor components, but it runs after config().replace has already installed the rejected config into the global application config. A failed SYSTEM RELOAD CONFIG can therefore still leak unrelated rejected values through system.server_settings, which rebuilds rows from context->getConfigRef: for example, reload a config that changes reader_executor_prefetch_pool_size and also sets reader_executor_memory_pressure_level_1_pct=150. The reload throws here, the prefetch pool still uses the old ServerSettings, but system.server_settings can report the new reader_executor_prefetch_pool_size from the rejected config. The new integration test only checks the threshold rows, which are live-overridden, so it misses this split-brain state. Please validate against loaded_config before replacing the live config, or roll the config back on validation failure.

new_server_settings[ServerSetting::reader_executor_memory_pressure_level_1_pct],
new_server_settings[ServerSetting::reader_executor_memory_pressure_level_2_pct],
new_server_settings[ServerSetting::reader_executor_memory_pressure_level_3_pct]);

DB::abort_on_logical_error.store(new_server_settings[ServerSetting::abort_on_logical_error], std::memory_order_relaxed);

size_t max_server_memory_usage = new_server_settings[ServerSetting::max_server_memory_usage];
Expand Down Expand Up @@ -2674,6 +2689,17 @@ try
new_server_settings[ServerSetting::cpu_slot_quantum_ns],
new_server_settings[ServerSetting::cpu_slot_preemption_timeout_ms]);

/// Apply the thresholds (already validated above, so this won't throw)
/// and reset the monitor's cooldown so the next sample reclassifies
/// against the new ladder.
memoryPressureMonitor().setThresholds(
Comment thread
clickhouse-gh[bot] marked this conversation as resolved.
new_server_settings[ServerSetting::reader_executor_memory_pressure_level_1_pct],
new_server_settings[ServerSetting::reader_executor_memory_pressure_level_2_pct],
new_server_settings[ServerSetting::reader_executor_memory_pressure_level_3_pct]);

global_context->getLongConnectionLimit()->setCapacity(
new_server_settings[ServerSetting::max_remote_read_connections]);

if (config().has("resources"))
{
global_context->getResourceManager()->updateConfiguration(config());
Expand Down
3 changes: 3 additions & 0 deletions src/Common/CurrentMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
M(Read, "Number of read (read, pread, io_getevents, etc.) syscalls in fly") \
M(RemoteRead, "Number of read with remote reader in fly") \
M(ReaderExecutorActive, "Number of live ReaderExecutor instances.") \
M(ReaderExecutorPrefetchInFlight, "Number of ReaderExecutor prefetch tasks currently queued or executing.") \

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.

The metric text says this counts prefetch tasks that are currently queued or executing, but the counter is tied to the FetchMachine object's lifetime. After the pool task finishes and FetchMachineRunner stores AwaitCollect, maybeLaunchAhead can keep the completed machine alive while the cursor is still before machine->physical_window.end(), so system.metrics continues to report an in-flight prefetch even though nothing is queued or executing.

Please either scope the increment to the scheduled job lifetime, or change the metric description to say it includes completed-but-not-yet-collected read-ahead machines.

M(ReaderExecutorChainedBufferBytes, "Bytes currently held in live ReaderExecutor chain buffers (OwnedChainedBuffer) -- live in-flight read memory, not a cumulative total.") \
M(Write, "Number of write (write, pwrite, io_getevents, etc.) syscalls in fly") \
M(NetworkReceive, "Number of threads receiving data from network. Only ClickHouse-related network interaction is included, not by 3rd party libraries.") \
Expand Down Expand Up @@ -536,6 +537,8 @@
M(MergeTreeSnapshotCommitThreads, "Number of threads used to commit snapshot") \
M(MergeTreeSnapshotCommitThreadsActive, "Number of active threads used to commit snapshot") \
M(MergeTreeSnapshotCommitThreadsScheduled, "Number of scheduled threads used to commit snapshot") \
\
M(LongConnections, "Number of long source connections currently held open by ReaderExecutor for sequential read optimization.") \


#ifdef APPLY_FOR_EXTERNAL_METRICS
Expand Down
2 changes: 2 additions & 0 deletions src/Common/FailPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ static struct InitFiu
REGULAR(smt_sleep_in_schedule_data_processing_job) \
REGULAR(cache_warmer_stall) \
REGULAR(file_cache_dynamic_resize_fail_to_evict) \
PAUSEABLE_ONCE(reader_executor_pause_after_window) \
PAUSEABLE_ONCE(reader_executor_pause_after_cache_status) \
REGULAR(file_cache_slru_downgrade_fail_before_finalize) \
REGULAR(file_cache_modify_size_limits_fail) \
REGULAR(check_table_query_delay_for_part) \
Expand Down
25 changes: 25 additions & 0 deletions src/Common/HistogramMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,31 @@ namespace HistogramMetrics
"Duration of S3 read request connections, from request initiation to connection close, in microseconds.",
{1000, 10000, 50000, 200000, 500000, 1000000, 2000000, 5000000, 10000000, 60000000});

Metric & ReaderExecutorCacheReadLatency = Factory::instance().registerMetric(
"reader_executor_cache_read_microseconds",
"Per-call latency of CacheReader::read inside ReaderExecutor, in microseconds.",
{10, 100, 1000, 5000, 20000, 100000, 500000, 2000000});

Metric & ReaderExecutorCachePopulateLatency = Factory::instance().registerMetric(
"reader_executor_cache_populate_microseconds",
"Per-call latency of CacheWriter::write inside ReaderExecutor, in microseconds.",
{10, 100, 1000, 5000, 20000, 100000, 500000, 2000000});

Metric & ReaderExecutorSourceReadLatency = Factory::instance().registerMetric(
"reader_executor_source_read_microseconds",
"Per-call latency of source reads driven by ReaderExecutor, in microseconds.",
{100, 1000, 10000, 100000, 500000, 2000000, 5000000, 15000000});

Metric & ReaderExecutorPrefetchWaitLatency = Factory::instance().registerMetric(
"reader_executor_prefetch_wait_microseconds",
"Per-event wait time when the ReaderExecutor consumer blocked on a not-yet-ready prefetch future, in microseconds. Directly contributes to query latency.",
{10, 100, 1000, 10000, 100000, 500000, 2000000, 10000000});

Metric & ReaderExecutorSyncReadLatency = Factory::instance().registerMetric(
"reader_executor_sync_read_microseconds",
"Per-event latency of in-line synchronous reads when no usable prefetch was available, in microseconds. Directly contributes to query latency.",
{100, 1000, 10000, 100000, 500000, 2000000, 5000000, 15000000});

Metric & S3ReadRequestBytes = Factory::instance().registerMetric(
"s3_read_request_bytes",
"Bytes read per S3 read request connection.",
Expand Down
218 changes: 218 additions & 0 deletions src/Common/MemoryPressureMonitor.cpp
Loading
Loading