Skip to content

test(data_plane): raw read split over a shard's chunks (tests first) - #911

Draft
zzylol wants to merge 1 commit into
perf/x4-sb-scanfrom
perf/parallel-query-exec
Draft

zzylol wants to merge 1 commit into
perf/x4-sb-scanfrom
perf/parallel-query-exec

Conversation

@zzylol

@zzylol zzylol commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem. A query-time raw read converts each ingest shard's chunks in a loop. perf(data_plane): x10 ingest/precompute costs: distinct-value label columns, compact on flush, shared metric Arc; pin ASAPPlanner#1569 #908-era code reads the shards themselves on the worker pool when --query-parallelism > 1 (RunStore::with_parallel_shard_reads), so the read is split at most ingest_threads ways (12 on a 48-thread data plane), and a shard holding a large share of the window's chunks bounds it. This is part 2 of the parallel query-time execution plan. Part 1, the exact Aggregate split, is ASAPPlanner#1571 and carries most of the gain: in the x4 SB q3 profile, 58% of samples were already on the pool for the read and 30% on the one query thread aggregating.
  • Change (this PR: tests only, on perf(data_plane): judge a keyed table's field restrictions once per series per read #910). D1: a read whose chunks are converted on up to p pool threads (RawData::read_with(.., p), a stub today) returns the sequential read's batches cell for cell, in order, with the same rows in the time range. It holds for a metric and a keyed table, key and field predicates, with and without the cross-step read cache, and with a series partition.
  • Effect. D1 fails on its chunk-task assertion (the stub reads on the calling thread). Its equality assertions pass, as they must for any implementation. The implementation waits for approval.

Review guide

  • Base: perf/x4-sb-scan (perf(data_plane): judge a keyed table's field restrictions once per series per read #910, ba11870), stacked so the bitmask field check is folded in.
  • data_plane/src/store.rs: RawRead::chunk_tasks, the RawData::read_with stub (read calls it with 1), and the test a_chunk_parallel_read_equals_the_sequential_read.
  • Planned implementation: read_with converts the in-range chunks with par_iter over (pane, chunk) in order and collects them in order. RunStore::with_read_parallelism(p) replaces with_parallel_shard_reads(bool): shards and chunks share one budget, the query's --query-parallelism on the --query-pool-threads pool.

Behavior: before → after (planned)

case before after
read of 1 h of login_fail at x4 (360 panes x 12 shards) 12 shard tasks, each converting its 360 chunks in a loop up to p tasks over (shard, chunk); same batches, same order
read with --query-parallelism 1 one thread one thread (unchanged)

Interfaces

data_plane/src/store.rs

 pub(crate) struct RawRead {
     pub batches: Vec<Batch>,
     pub rows_in_time_range: u64,
+    /// Chunks the read converted on the worker pool (0: read on the calling thread).
+    pub chunk_tasks: usize,
 }
 impl RawData {
     pub(crate) fn read(&self, metric, request, reads, partition) -> Result<RawRead, Error>;
+    /// `read` with its chunks converted on up to `parallelism` pool threads; same batches, same order.
+    pub(crate) fn read_with(&self, metric, request, reads, partition, parallelism: usize) -> Result<RawRead, Error>;
 }

Usage (end to end, after the implementation): QueryEngine::run_store builds the run's RunStore with the query parallelism. A Scan calls RunStore::read_raw_data, which reads each shard through RawData::read_with(.., p): selection and conversion per chunk on the pool, batches collected in pane and chunk order. The executor's split Aggregate (ASAPPlanner#1571) then reduces them on the same pool.

Tests

Spec and test plan: the parallel query-time execution plan, sections 2–3.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K1M6bpWvKMxYBvtAgpDYGp

…unks

Test-first phase 3 of the parallel query-time execution plan (D1): a raw
read whose chunks are converted on the worker pool returns the sequential
read's batches cell for cell and in order, and its rows in the time range,
for a metric and a keyed table, key and field predicates, with and without
the read cache and with a series partition. RawData::read_with(.., p) is a
stub that reads on the calling thread, so the chunk-task assertion fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bpWvKMxYBvtAgpDYGp
@zzylol zzylol added enhancement New feature or request area: data plane Runtime ingestion, storage, and query-serving data paths test: end-to-end Process-boundary, differential, conformance, and full-stack tests labels Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: data plane Runtime ingestion, storage, and query-serving data paths enhancement New feature or request test: end-to-end Process-boundary, differential, conformance, and full-stack tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant