Skip to content

Show live disk I/O throughput in clickhouse-client's progress line - #116577

Open
valerypetrov wants to merge 89 commits into
ClickHouse:masterfrom
valerypetrov:client-disk-io-progress
Open

valerypetrov wants to merge 89 commits into
ClickHouse:masterfrom
valerypetrov:client-disk-io-progress

Conversation

@valerypetrov

@valerypetrov valerypetrov commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes: #116565

clickhouse-client's live progress line reports CPU, memory, and temp-disk-spill usage during query execution, but has no visibility into I/O throughput — useful for spotting an I/O-bound query in real time, the way the CPU figure helps spot a CPU-bound one.

This adds a live IO rate (e.g. 12.40 MB/s IO) to the same resource-usage segment, following the exact mechanism already used for CPU and memory. The rate is the plain sum of the byte counters of everything the query moves: block devices (OSReadBytes/OSWriteBytes), object storage (ReadBufferFromS3Bytes/WriteBufferFromS3Bytes, ReadBufferFromAzureBytes/WriteBufferFromAzureBytes), HTTP (ReadWriteBufferFromHTTPBytes/WriteBufferFromHTTPBytes), and network (NetworkSendBytes/NetworkReceiveBytes, plus StreamingExchangeSendBytes/StreamingExchangeReceiveBytes for the streaming exchanges of a distributed plan, which the former two do not count).

The network counters also include the packets of the progress reporting itself (Progress, ProfileEvents), which is a small amount. There are no corrections for that: a rate below 1 MB/s is simply not shown.

  • ClientBase::onProfileEvents sums these counters into ThreadEventData. They are already collected per thread, aggregated into the query's counters, and streamed to the client as per-interval deltas on the existing ProfileEvents channel (send_profile_events, on by default) — no protocol change.
  • ProgressIndication feeds the sum into an EventRateMeter (same 2-second window as the CPU meter) and renders it in writeProgress when it is at least 1 MB/s.
  • The Play UI (play.html) shows the same <rate>/s IO term from the same counters, with the same 1 MB/s threshold.
  • Azure uploads previously had no byte counter (only request counts such as AzureUpload), so a new WriteBufferFromAzureBytes profile event is added, incremented where the Azure write buffers and the copy helper actually push data (Upload/StageBlock/Append), mirroring WriteBufferFromS3Bytes.
  • Delivery during writes is live on the TCP path: a server-side INSERT ... SELECT runs as a completed pipeline whose interactive callback already streams ProfileEvents every interactive_delay; for inserts fed by client data, the receive loop now also flushes profile events on the same cadence while waiting for the next packet (previously only per received packet and once at the end).

The OS-level counters measure actual block-device I/O (page-cache reads are not counted) and come from Linux taskstats, so they stay zero on non-Linux servers; the object-storage and network counters are platform-independent. Old servers (< the incremental-ProfileEvents protocol version) are unaffected.

Tests: three expect tests drive a real pty and assert the <rate>/s IO term in the live progress line, one per carrier class: 05026_client_io_progress_line.expect (network — an idle query, whose only traffic is the progress reporting, never shows a rate below 1 MB/s, while a paced query that streams ~30 MB to the client shows its rate; runs on every platform), 05026_client_io_progress_line_disk.expect (disk reads — a direct-I/O read throttled to ~10 MB/s under FORMAT Null keeps network at KB/s, so the MB-scale rate can only come from OSReadBytes), and 05026_client_io_progress_line_write.expect (object-storage writes — a paced INSERT uploads ~30 MB to the minio endpoint as forced 6 MB multipart parts, and a further progress frame is required after the matched one, proving the rate was rendered mid-query). 05026_client_disk_io_progress_streaming.sql, 05026_client_io_network_receive_http_bytes.sh, 05026_client_io_streaming_exchange_bytes.sh and 05026_client_io_azure_write_bytes.sh check that the counters of each carrier reach the client's ProfileEvents stream; 05026_insert_profile_events_stall_tcp.sh and 05026_insert_returning_stall_tcp.sh cover the periodic flush while an INSERT waits for client data; the Play UI's meter is covered by 04548_play_ui_framing_fallbacks.sh and by scenarios of test_play_image_preview and test_play_notebook.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

clickhouse-client's live progress line and the Play UI now show the query's IO throughput (e.g. 12.40 MB/s IO) — disk, object storage, and network combined — alongside the existing CPU and memory figures, when it is at least 1 MB/s. Added the profile event WriteBufferFromAzureBytes (bytes written to Azure blob storage).


Workflow [PR]
Sync PR [sync-upstream/pr/116577]

Extend the live resource-usage segment of the progress line with disk I/O
read/write rates, following the exact mechanism already used for CPU/memory:

- `ClientBase::onProfileEvents` extracts the OS-level `OSReadBytes`/`OSWriteBytes`
  counters (already streamed per query, per host, as interval deltas) into
  `ThreadEventData`.
- `ProgressIndication` feeds them into two `EventRateMeter`s (same 2 s window
  as the CPU meter) and renders `<rate>/s read` / `<rate>/s write` in
  `writeProgress`.

The counters measure actual block-device I/O (page-cache reads are not
counted), matching the intent of spotting I/O-bound queries live. On non-Linux
servers the counters stay zero and the segment simply does not appear. No
server or protocol change; the feature rides the existing ProfileEvents stream.

Closes: ClickHouse#116565
The first version asserted `OSReadBytes`/`OSWriteBytes` using `numbers()`
(in-memory, no reads) and `INSERT INTO FUNCTION null()` (no writes), so both
counters stayed zero and the test failed deterministically; the `OSTYPE` guard
also failed on macOS instead of skipping. Rewrite around a real `MergeTree`
table: a direct-I/O `SELECT` for the read counter and an
`fsync_after_insert` `INSERT` for the write counter, with a `no-darwin`
tag (the counters are Linux-only).
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Aug 26, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3dd16e5]

Summary: ✅


AI Review

Summary

Adds aggregate IO throughput to clickhouse-client and Play, instruments Azure writes, and streams insert profile events while waiting for client data. Reviewed head 3dd16e5ab65361b0f1549eed2205e5fb9ce7ba9e, the current code, regression coverage, and all prior discussion. No actionable findings remain under the agreed plain-counter semantics and 1 MB/s display threshold. Both Play Node regression harnesses pass locally.

Missing context / blind spots
  • ⚠️ Native and object-storage tests were not rerun locally because this checkout has no built ClickHouse binary. Builds and some checks for the current head are still running; their completed CI results will close this validation gap.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Aug 26, 2026
@alexey-milovidov

alexey-milovidov commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

This is interesting! Three things (before looking into the code):

  1. Will it fit?
  2. Let's also add ReadBufferFromS3/Azure; for this purpose, it can be named "disk reads" as well. However, what if we simplify it by naming it "IO" and adding network reads/writes as well?
  3. Check out the Web UI (play.html), we added real-time metrics there a few days ago - it shows the same metrics as the client on the progress bar, so we need to keep it consistent.

@alexey-milovidov alexey-milovidov self-assigned this Aug 26, 2026
@valerypetrov

valerypetrov commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

@alexey-milovidov , Looks okay on my computer(please see the screenshot).

Those ideas are great. I've added features as you asked. I was also thinking about the cost of query in $(when you query the ClickHouse with data stored in S3/Azure).

image

@valerypetrov

valerypetrov commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Let me also rename XX MB/s to IO read XX MB/s & IO write XX MB/s.

Broaden the progress line's resource segment from disk-only device I/O to
`IO` (block devices + object storage) and network, per review feedback:

- IO read = `OSReadBytes` + `ReadBufferFromS3Bytes` + `ReadBufferFromAzureBytes`;
  IO write = `OSWriteBytes` + `WriteBufferFromS3Bytes`.
- Network read/write = `NetworkReceiveBytes`/`NetworkSendBytes`.
- Rendered as `<rate>/s read IO`, `<rate>/s write IO`, `<rate>/s net read`,
  `<rate>/s net write` via two more `EventRateMeter`s, mirroring the CPU meter.
- The Web UI (play.html) real-time resource meters now fold the same events and
  render the identical fields, keeping the two consistent.

Rewrite the streaming test per the direct-IO precedent (assert
`OSReadBytes` > 0 via `query_thread_log` with `pread_threadpool` and a full
part) so it is reliable on Linux CI.

Closes: ClickHouse#116565
@alexey-milovidov

Copy link
Copy Markdown
Member

If we have all of these: disk read/write, net read/write, it will be messy. Let's use just one number: IO, that sums everything.

@alexey-milovidov

Copy link
Copy Markdown
Member

about the cost of query in $(when you query the ClickHouse with data stored in S3/Azure).

Better to postpone that. You can count GET/PUT/LIST requests, but it depends on the storage tier (e.g., Glacier), and the service type (e.g., Express), and who pays for it also depends (e.g., requester pays), and if it is even AWS (e.g., Cloudflare R2), and it will also not show network cost, and the network cost depends on the region, and even on tiny details like if you misconfigured and accidentally use Internet Gateway and NAT for S3. So you'd better not do this.

Comment thread src/Common/ProgressIndication.cpp Resolved
@valerypetrov

Copy link
Copy Markdown
Contributor Author

about the cost of query in $(when you query the ClickHouse with data stored in S3/Azure).

Better to postpone that. You can count GET/PUT/LIST requests, but it depends on the storage tier (e.g., Glacier), and the service type (e.g., Express), and who pays for it also depends (e.g., requester pays), and if it is even AWS (e.g., Cloudflare R2), and it will also not show network cost, and the network cost depends on the region, and even on tiny details like if you misconfigured and accidentally use Internet Gateway and NAT for S3. So you'd better not do this.

Yeah, it would be hard to implement. I agree. Let's postpone that. But as an end-user, it would be nice to have, especially in order to fix some super inefficient queries. (Look, you spent on this query $XX, but you could save some money if you rewrote it.)

Per review: sum all IO counters (block-device reads/writes and object-storage
reads/writes) into one `IO` meter, rendered as `<rate>/s IO`. Network read/write
stay separate. Web UI consolidated identically.
Per review: one `IO` number instead of separate disk-read/write and net-read/write
meters. IO sums block-device reads/writes (`OSReadBytes`/`OSWriteBytes`),
object-storage reads/writes (S3, Azure), and ClickHouse's network traffic
(`NetworkReceiveBytes`/`NetworkSendBytes`), rendered as `<rate>/s IO`. Web UI
consolidated identically.
Comment thread src/Client/ClientBase.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 3dd16e5ab with master 19f5e0ac8 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

28 translation units recompiled, 134 s compile time in total, 28 of them have a recent master baseline.

Job report

The IO meter summed OS, S3 read/write, Azure read, and network bytes, but
Azure uploads only counted requests, so Azure-backed inserts showed 0 B/s IO.
Add WriteBufferFromAzureBytes, incremented where the write buffers and the
copy helper actually push data (Upload/StageBlock/Append), mirroring
WriteBufferFromS3Bytes, and include it in the client and play.html sums.
The query_log lookup matched any recent direct-io SELECT in the database;
pin it with log_comment. Add an expect test that drives a real pty (wide,
so the profiling suffix fits) and asserts '<rate>/s IO' appears in the
progress line while a paced SELECT streams ~30 MB to the client,
covering ClientBase::onProfileEvents -> ProgressIndication::writeProgress.
FORMAT Null would not do: the server sends no data for it, so the stream
goes to INTO OUTFILE /dev/null, paced by sleepEachRow per 1 MB block.
The network expect test and the query_thread_log check together still let
the disk counters silently drop out of ThreadEventData::io_bytes. The new
expect test reads a 44 MB table with direct IO throttled to ~10 MB/s under
FORMAT Null, so network traffic stays at KB/s and the MB-scale '/s IO' the
test expects can only come from OSReadBytes flowing through
onProfileEvents into the meter.

Two constraints found while validating: writeProgress renders the
profiling suffix for known-total queries only when the query was under
half done at 0.5 s (the read throttler's initial burst must not cover
half the table), and the client redraws ':) ' while echoing a sent query,
so each step waits for its completion marker before the prompt.
Comment thread src/Client/ClientBase.cpp Resolved
The read and network carriers were proven end-to-end, but every
write-side event could drop out of the meter's sum with all tests green.
The new expect test INSERTs ~30 MB of incompressible parts, paced to one
1 MB part per 0.1 s by source sleeps with squashing disabled, entirely
server-side - the client connection stays at KB/s, so the MB-scale
'/s IO' the test expects can only come from OSWriteBytes reaching the
meter through onProfileEvents.
OSWriteBytes is not a stable carrier for this test: its event contract
says buffered writes may be accounted asynchronously, so a local-disk
INSERT can legitimately keep it at 0 until the query is done. The S3
write counter is deterministic - counted per part as the query uploads -
so the INSERT now goes to the minio endpoint as forced 5 MB multipart
parts (a single PutObject at finalize would be one burst delta, which
the rate meter's heating discards). The S3 upload bypasses the
native-protocol socket buffers, so the client connection stays at KB/s
and the MB-scale '/s IO' can only come from the object-storage write
counter - which also covers the write literal family this PR extended.
CI showed every run of the test dying with EntityTooSmall at
CompleteMultipartUpload: s3_min_upload_part_size = 5000000 is 4.77 MiB,
just under the 5 MiB minimum S3 enforces for non-final parts. Parts are
now 6 MB. Also disable parallel part upload so the parts are sent by the
query thread itself - its per-interval deltas are what the client meter
consumes, while the IO thread pool's contribution is not guaranteed to
reach the streamed ProfileEvents mid-query (CI rendered only the KB/s
connection trickle while the pool was uploading). 300 rows instead of
400 to stay well inside the expect timeout on loaded flaky-check
runners, which paced the source at a tenth of the design speed.
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=116577&sha=latest&name_0=PR (03223_nested_json_in_shared_data_merges in Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel), row order of SELECT JSONAllPaths(arrayJoin(json.a[])) without ORDER BY under randomized settings; it passed 822 times on the same check elsewhere in the last 3 days, and this PR does not touch JSON or MergeTree reading) and provide a fix in a separate PR. If the fix is already in progress, link it here.

@groeneai

Copy link
Copy Markdown
Collaborator

Acknowledged. I'm investigating the 03223_nested_json_in_shared_data_merges row-order failure under ParallelReplicas; no fix is in flight yet, so I'll follow up here with a separate PR (or my findings) shortly.

@groeneai

Copy link
Copy Markdown
Collaborator

The fix is in #128385 (test-only). With randomized index_granularity = 1 on the s3 lane, the merged part is read as two 8-mark tasks (merge_tree_min_read_task_size) whose streams are united unordered, so rows came out in a different order; the six SELECTs now use order by all. Replaying the failing job's settings on an s3-backed server: 78/100 fail before, 100/100 pass after.

valerypetrov and others added 2 commits October 31, 2026 17:44
With a randomized max_insert_threads the blocks of INSERT ... RETURNING may be
processed by different threads, so the result rows can arrive in any order
(CI saw 3,1,2). The test checks the packet framing, not the order, so sort the output.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
alexey-milovidov pushed a commit to ylw510/ClickHouse that referenced this pull request Nov 2, 2026
The six `select JSON*Paths(arrayJoin(json.a[])) from test` queries had no
ORDER BY, so they asserted the physical read order of the merged part.

With a randomized `index_granularity = 1` the merged part (10, then 15 rows)
has one granule per row. On a remote disk the minimum read task is
`merge_tree_min_read_task_size` = 8 marks (the `_for_remote_filesystem`
row/byte minimums default to 0), so the part is read as two tasks, [0, 8) and
[8, N), whose streams are united without order; the short task usually
finishes first and its rows are printed first. That is the failure seen in
`Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel)` on
PR ClickHouse#116577 (172 of 174 same-settings reruns failed). Only release builds can
draw that granularity: debug and sanitizer builds draw it from [100, 65536].

Order each SELECT by its own result (`order by all`) and reorder the
reference within each section accordingly. The per-section contents are
unchanged, and since every row carries exactly one path, those multisets
still pin which path is dynamic and which is in shared data.

`order by _part_offset` is not usable here: the planner evaluates the
JSON*Paths functions after that sort, on a JSON column re-assembled from the
two read tasks' chunks, which changes the reported layout (the `c` paths
become dynamic). With `order by all` the sort key is the function result, so
the function still runs on each read chunk before the sort.

Related: ClickHouse#116577
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@maxknv maxknv added the external Author is not a member of the ClickHouse organization label Nov 2, 2026
# Conflicts:
#	src/IO/AzureBlobStorage/copyAzureBlobStorageFile.cpp
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Merged the latest master (e347281) to resolve a conflict in src/IO/AzureBlobStorage/copyAzureBlobStorageFile.cpp: master added an HTTPConnectionInfoScope before the single-part Upload, right where this PR increments WriteBufferFromAzureBytes; both are kept. The affected translation units (copyAzureBlobStorageFile.cpp, ClientBase.cpp, Connection.cpp, TCPHandler.cpp, ProfileEvents.cpp, ProgressIndication.cpp) build, and the PR diff against master is unchanged. There are no unresolved review threads.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Fixed the CH Inc sync conflict: the sync branch now merges the latest private master (one conflict in src/IO/AzureBlobStorage/copyAzureBlobStorageFile.cpp, resolved the same way as in the public merge, keeping both the WriteBufferFromAzureBytes increment and HTTPConnectionInfoScope) plus the current PR head ed4bc98. The sync PR is MERGEABLE again, and its diff against private master matches this PR's diff file by file. No changes to this branch were needed: all other checks are green and there are no unresolved review threads.

valerypetrov and others added 3 commits November 10, 2026 17:00
…ress

Bring the branch up to date with master.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The distributed leg failed in the debug and tsan jobs: a 4 KiB OSWriteBytes of the server arrived in the last ProfileEvents packet and the meter showed it as a short spike (41 MB/s), which the test took for counted service traffic. The idle leg failed on any IO term at all, so it was exposed to the same stray write.

Service traffic counted as IO is sustained, a stray write decays. So both legs now fail only when every progress line after 200 of the 300 rows shows 10 KB/s or more, and interactive_delay of 10 ms raises the service traffic to about 100 KB/s (idle) and 40 KB/s (distributed) so it stays far above a stray write.

The test takes about 11 seconds and went over the 15 second limit for new tests in the Fast test, so it is tagged no-fasttest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Merged the latest master (9b41283) to clear the CH Inc sync failure. Its only failing test was 05494_join_hashed_keys, which timed out under MSan in the private CI. That test is unrelated to this PR, and master has since tagged it no-msan (#130766) and taken its Join inserts off parallel replicas (#130995). The merge was clean, and the translation units this PR changes still compile.

Comment thread programs/server/play.html Resolved
Comment thread src/Client/ClientBase.cpp Resolved
valerypetrov and others added 2 commits November 12, 2026 17:22
A server sends the blocks of a distributed INSERT with Connection::sendData,
which counted no native data bytes, so the initiator's live IO rate stayed
at zero during the upload. Connection now counts the Data packets with rows
it sends, and the prepared ones, to NativeProtocolDataBytes, like the server
counts its result packets.

In Play the IO rate was sampled only while the cell's tab was shown, so a
query that stopped moving data kept its old rate when its tab was opened
again. A background cell now samples its IO rate on its own clock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The harness gained this scenario, but the pinned SCENARIOS list did not, so the
drift check failed in every integration job.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
valerypetrov and others added 2 commits November 21, 2026 20:31
The IO meter of `clickhouse-client` and the Play UI sums plain
`NetworkSendBytes` and `NetworkReceiveBytes` again, and the `IO` term is
shown only when the rate is at least 1 MB/s, so the progress-reporting
packets themselves do not show up.

This removes the `NativeProtocolDataBytes`, `NativeProtocolDataReceiveBytes`
and `FramingServiceBytes` profile events, the chunk framing byte counting in
`ReadBufferFromPocoSocketChunked`, and the decoded payload metering in the
Play UI, together with the tests that pinned them.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Merged the latest master (4766e0d) on top of 4b99154; the merge was clean.

I ran the PR's tests locally on this merge (the server binary was built from a tree whose C++ differs from it only in comments): 05026_client_io_progress_line, 05026_client_io_progress_line_disk, 05026_client_io_network_receive_http_bytes, 05026_client_io_streaming_exchange_bytes, 05026_client_disk_io_progress_streaming, 05026_insert_profile_events_stall_tcp, 05026_insert_returning_stall_tcp and 05212_client_progress_history_under_annotation pass 3 runs each, 04548_play_ui_framing_fallbacks matches its reference, and the test_play_image_preview and test_play_notebook harnesses pass. 05026_client_io_progress_line_write and 05026_client_io_azure_write_bytes need the CI MinIO and Azurite endpoints, so they were not run locally.

I also updated the PR description and the changelog entry: they still listed the removed NativeProtocolDataBytes, NativeProtocolDataReceiveBytes and FramingServiceBytes events and did not mention the 1 MB/s threshold.

Optional and not applied here: now that the byte corrections are gone, the Play UI's IO rate comes only from the profile_events packets, like the CPU usage, so it can be sampled where the CPU usage is sampled. That removes the separate IO clocks (sampling on progress packets, the replay clock, the per-group offsets in Run all, the sampling of a background tab) and the tests that pin them: 6 files, +62 −347. It is a single commit on top of this branch, 0258943 in the branch client-io-progress-play-simplify.

@stresshouse

stresshouse Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 29 queries analysed

No query changed in a way this PR could cause. The only flagged query is clickbench Q31: +13.4% (246 ms vs 217 ms). That falls inside master's current range for this query (195–266.5 ms), so it was already marked inconclusive, and the query has a noisy history on master. This is consistent with the diff, which only touches the client's progress line and play UI IO meter, adds Azure write byte counters, and changes profile-event flushing while the server waits for INSERT data. Q31's SELECT GROUP BY runs none of that code, so there is no reason to contest the result.

clickbench

⚠️ 1 inconclusive

Flagged queries (1 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 31 not_sure 217 246 +13.4% <0.0001 aggregation: Q31 is a high-cardinality GROUP BY on WatchID, ClientIP. This PR only changes client-side progress metering and INSERT-path profile-event flushing, and the query has a noisy history.

Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on.

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: 1ff51c4a-16f4-4e4a-90b7-0c05cf149296
  • MIRAI run: c789be0e-e9dc-456e-afbb-987d104651b1
  • PR check IDs:
    • clickbench_894685_1795398072
    • clickbench_894691_1795398072
    • tpch_adapted_1_official_894726_1795398072
    • tpch_adapted_1_official_894745_1795398072

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Merged the latest master (f70b8dd) on top of 5ce9b97; the merge was clean, the translation units this PR changes compile, and the PR diff against master is unchanged. The last review thread (drop the byte corrections, hide rates below 1 MB/s) is verified against 4b99154 and resolved, so the full CI suite, which was skipped by the review-threads gate, runs on this push.

CH Inc sync was red because of a single test in the private CI, 05480_autopr_plan_based_group_by_order_by_top_k in Stateless tests (amd_jemalloc_uaf, meta in keeper, s3 storage, parallel): the last four q05480_priced_* rows of the system.query_log check were missing from the output. This PR does not touch automatic parallel replicas or the query log, and the push re-runs the sync.

@groeneai, investigate the failure: 05480_autopr_plan_based_group_by_order_by_top_k (result differs with reference, the final q05480_priced_no_order_by, q05480_priced_order_by, q05480_priced_query_based_no_order_by, q05480_priced_query_based_order_by rows are absent; private run https://github.com/ClickHouse/clickhouse-private/actions/runs/44988424932/job/137106305699) and provide a fix in a separate PR. If the fix is already in progress, link it here.

@groeneai

Copy link
Copy Markdown
Collaborator

Acknowledged. I'm investigating 05480_autopr_plan_based_group_by_order_by_top_k (the missing q05480_priced_* query_log rows); I'll follow up here with a PR (or my findings) shortly.

@groeneai

Copy link
Copy Markdown
Collaborator

I could not open the private run, so this is from the test and a local reproduction. The four missing rows are the last block of the test, which reads the output divisor from the AutoParallelReplicas "The applied formula" line in system.text_log. AutoParallelReplicasApplied is counted only after that line is logged, so with the query_log block intact (I assume it was, since only these four rows were named) the line was logged and lost on its way to system.text_log, which drops entries when its queue overflows, when a flush fails, or below its logger level.

Fix: #133636. The test now reads the line from the server logs the client receives (send_logs_level = trace, --server_logs_file), which go through the query's own unbounded logs queue; the reference is unchanged. Locally, a text_log at level debug reproduces exactly this diff 3/3, and a 16-row text_log queue 10/10; the new test passes both and 50/50 with random settings. The public CI has no such failure in about 4900 runs. Reverting #125888 would also stop it, but only its test is affected, so I recommend this fix.

This branch has not been deployed

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

Labels

can be tested Allows running workflows for external contributors comp-cli clickhouse-client (interactive CLI) and client library. external Author is not a member of the ClickHouse organization pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include disk I/O throughput in clickhouse-client's live progress/resource-usage line

4 participants