Skip to content

chdig v26.7.1 - #110938

Merged
azat merged 4 commits into
ClickHouse:masterfrom
azat:chdig-v26.7.1
Jul 21, 2026
Merged

azat merged 4 commits into
ClickHouse:masterfrom
azat:chdig-v26.7.1

Conversation

@azat

@azat azat commented Jul 18, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

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

chdig v26.7.1: compress stacktraces for sharing, query patterns, separate arenas memory support, perfetto improvements, compatibility

Refs: ClickHouse/rust_vendor#73
Refs: https://github.com/azat/chdig/releases/tag/v26.7.1
Refs: azat-ch/speedscope#2 (here you will find some improvements for flamegraph sharing)
Refs: ClickHouse/pastila#54

Version info

  • Merged into: 26.7.1.1293 (included in 26.7 and later)

@clickhouse-gh

clickhouse-gh Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7cf404c]

Summary: ❌

job_name test_name status info comment
AST fuzzer (amd_msan) FAIL
Segmentation fault (STID: 4775-35c2) FAIL cidb

AI Review

Summary

This PR bumps chdig to v26.7.1 and refreshes the vendored Rust crates. The release adds query-pattern metrics, Perfetto trace compression, runtime settings propagation, and flamegraph-sharing changes, but the current tag still ships several correctness and compatibility regressions in the new trace_log, query-log, Perfetto, and query-pattern paths, so this is not ready to merge.

Findings

⚠️ Majors

  • [contrib/chdig -> src/interpreter/clickhouse.rs:457-476] [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/110938#discussion_r3608401819] The trace_type workaround still probes only system.columns for the literal trace_log table. The broken path is merge(...) / clusterAllReplicas(...) over preserved logs, where mixed Enum8 definitions can resolve the read type to plain Int8 even while system.trace_log remains Enum8, so trace_type_cast_expr stays disabled and the same history queries still filter on the wrong type.
    Suggested fix: probe the actual history/cluster read path or conservatively enable the cast whenever trace_log is read through merge(...) / cluster wrappers.
  • [contrib/chdig -> src/interpreter/clickhouse.rs:596-602,748-754] [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/110938#discussion_r3608401821] The pre-26.3 fallback still interpolates raw initial_query_id values into IN ('{}'). Any single quote in a logged query id produces invalid SQL in the second query (or changes the predicate text), so Last queries / Slow queries remain broken on older servers for such ids.
    Suggested fix: escape each id with the same SQL string escaping used elsewhere, or pass the list without rebuilding SQL text.
  • [contrib/chdig -> src/interpreter/perfetto.rs:282-350,1611-1669] [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/110938#discussion_r3610414192] The new batch cap only flushes before adding a packet to a non-empty batch. A single StreamingProfilePacket larger than COMPRESS_BATCH_LIMIT still gets wrapped whole into one compressed_packets blob, so large stack-profile exports can exceed Perfetto’s 512 KiB outer-packet limit and remain unreadable.
    Suggested fix: split oversized StreamingProfilePackets (or emit them uncompressed) and add a test that covers one packet larger than the batch cap.
  • [contrib/chdig -> src/view/providers/query_patterns.rs:144-165; src/view/sql_query_view.rs:341-360] [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/110938#discussion_r3610930904] The query-patterns view still applies ORDER BY cnt DESC LIMIT {limit} on the server and only then re-sorts the surviving rows client-side by the selected metric. That changes the contract from “top patterns by the shown metric” to “top-by-count patterns displayed in another order”, so rare but expensive patterns disappear completely once they fall outside the top cnt rows.
    Suggested fix: order and limit by the currently selected metric on the server, or re-query when the metric changes.
  • [contrib/chdig -> src/view/providers/query_patterns.rs:86-111,144-165; src/view/providers/query_patterns_metrics.rs:223-227] [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/110938#discussion_r3610930909] The fat query still expands max(peak_threads_usage) unconditionally. On servers that do not have the peak_threads_usage column, the whole Query patterns view fails to parse even if the user never selects threads (peak).
    Suggested fix: build the all-metrics query from the active quirks and use length(thread_ids) for this metric where peak_threads_usage is unavailable.
  • [contrib/chdig -> src/view/providers/query_patterns_metrics.rs:79-84,159-164; src/view/sql_query_view.rs:49-60] The new metric formatter routes avg_written_rows and parts_inserted_avg through Unit::Count, and format_count rounds every sub-1000 value to an integer. The sort order still uses the real f64, but the displayed metric is wrong (0.4 becomes 0, 1.6 becomes 2), which makes the new average-count views misleading.
    Suggested fix: keep decimal formatting for non-integer count metrics (for example a separate Unit::AverageCount or a per-metric precision flag) instead of using the integer count formatter.
Tests
  • ⚠️ Add an integration test that forces the pre-26.3 query-log fallback with an initial_query_id containing a single quote, so the literal IN (...) path proves it escapes ids correctly.
  • ⚠️ Add a perfetto.rs unit test with one StreamingProfilePacket already larger than COMPRESS_BATCH_LIMIT; the current tests only cover many small packets.
  • ⚠️ Add a query-patterns compatibility test on a server without peak_threads_usage, plus a view-level check that average-count metrics preserve fractional values.
Final Verdict
  • Status: ⚠️ Request changes

@clickhouse-gh clickhouse-gh Bot added pr-improvement Pull request with some product improvements submodule changed At least one submodule changed in this PR. labels Jul 18, 2026
Comment thread contrib/chdig Resolved
Comment thread contrib/chdig Resolved
@alexey-milovidov alexey-milovidov self-assigned this Jul 18, 2026
@azat
azat enabled auto-merge July 19, 2026 10:28
Comment thread contrib/chdig Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member

The two stress-test failures (Cannot start clickhouse-server with Part all_2_3_1_0 intersects previous part ... transaction metadata ... could not be read for table t_plt_reparent) are unrelated to this PR: they come from the 04063_part_loading_tree_rollback_reparent test leaving a poisoned table behind on non-local disks, and hit many other PRs in the last days (e.g. #109071, #101273, #101796, #108357). The fix is in progress: #110999.

I merged the latest master into this branch (no conflicts) to trigger a fresh CI run.

Comment thread contrib/chdig Resolved
Comment thread contrib/chdig Resolved
@azat

azat commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

@alexey-milovidov what for merging with master?
This will not solve CI issues, and the fix has not been merged yet
And after re-run there are even more failures

@alexey-milovidov

Copy link
Copy Markdown
Member

@azat you're right that the t_plt stress failures at server startup are unrelated to this PR and won't disappear until the fix (#110999, pinning the part_loading_tree_rollback tests to the local storage policy) is merged. I've refreshed the branch with master once more since it had fallen more than a thousand commits behind — the failure is timing-dependent, so a fresh run can come back green even without the fix. No further re-merges from my side until #110999 lands; after that one final update should make CI green. The PR itself is approved with no unresolved threads, so that's the only remaining blocker.

Comment thread contrib/chdig Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member

The only remaining CI red on 7cf404c is AST fuzzer (amd_msan): Segmentation fault — a pre-existing master bug, unrelated to this chdig submodule bump: a use-after-free in ReadFromMergeTree::initializePipeline, which strips data parts from the query-shared StorageSnapshot in place while MergeTreeAnalyzeIndexSource in another UNION ALL branch reads it concurrently. I reproduced it locally under ASan and the fix is #111192. The earlier t_plt stress reds did not reappear in this run (their fix #110999 is still open). Per the discussion above, I will not merge master into this branch again until the fixes land.

@azat

azat commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

AST fuzzer (amd_msan)

Will fix separately

@azat
azat added this pull request to the merge queue Jul 21, 2026
Merged via the queue into ClickHouse:master with commit 46c71b9 Jul 21, 2026
176 of 178 checks passed
@azat
azat deleted the chdig-v26.7.1 branch July 21, 2026 17:18
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 21, 2026
YenchangChan pushed a commit to YenchangChan/ClickHouse that referenced this pull request Aug 1, 2026
`ReadFromMergeTree::initializePipeline` replaced `storage_snapshot->data`
in place when stripping data parts from the snapshot (for streaming
queries and for `merge_tree_enable_remove_parts_from_snapshot_optimization`).
With `enable_shared_storage_snapshot_in_query` the `StorageSnapshot`
object is shared across all parts of the query via `QueryMetadataCache`,
so the in-place replacement freed the old `StorageSnapshot::Data` while
other threads of the same query could still be reading it. The
optimization path is gated off for shared snapshots, but the streaming
path (`query_info.isStream()`) was not.

Found by AST fuzzer as a segmentation fault in
`MergeTreeAnalyzeIndexSource::getIndexAnalysis`, which read
`mutations_snapshot` from the shared snapshot while a streaming
IN-subquery of another UNION branch concurrently stripped it:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110938&sha=7cf404c52497443c4c2d93f51a31c99e7eae1147&name_0=PR&name_1=AST%20fuzzer%20%28amd_msan%29
(CI run for ClickHouse#110938,
whose changes are unrelated to the crash.)

Reproduced locally under ASan as heap-use-after-free. Replace the
step's own snapshot pointer with a stripped clone instead of mutating
the shared object.

Co-Authored-By: Claude Fable 5 <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
thevar1able added a commit that referenced this pull request Nov 11, 2026
Bring the release branch to the same Rust toolchain and Rust contribs as
master, so that it shares master's `rust_vendor` commit (`c4fd435`):

- `nightly-2026-11-02` instead of `nightly-2025-07-07`.
- `wasmtime` v41 -> v45.0.1 (`561b224`), with the `ValType` API change in
  `WasmTimeRuntime.cpp` from #106836
  (also covers #98603 and
  #102603, which only moved the
  submodule).
- `delta-kernel-rs` v23 (`3ae3062`), with the FFI adaptations, tests and the
  `arrow` crate feature from #105861.
  The branch keeps its `default-engine-rustls` feature and its per-batch
  `add_files` loop in `WriteTransaction::commit`; only the `commit` call is
  changed to the committed-transaction API.
- `chdig` v26.10.1 (`a28e107`), with the `config.toml.in` sources from
  #103145,
  #110938 and
  #115216.
- `rust/workspace/Cargo.lock` re-resolved offline against that vendor commit.

Original PR: #128815

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants