Skip to content

Stream query profiler traces to clients - #118415

Open
ei-grad wants to merge 79 commits into
ClickHouse:masterfrom
ei-grad:profile-trace-streaming
Open

ei-grad wants to merge 79 commits into
ClickHouse:masterfrom
ei-grad:profile-trace-streaming

Conversation

@ei-grad

@ei-grad ei-grad commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Add send_profile_traces to stream a query's profiler samples while it runs. Native clients receive revision-gated ProfileTraces packets, and HTTP framing formats expose profile_traces packets. This supplies the transport proposed in #117830 (comment) for a live flame graph in the Web UI.

The setting is disabled by default and uses the existing profiler controls. The stream supports CPU, Real, Memory, MemorySample, and MemoryPeak; other trace types remain available through system.trace_log under their own collection settings. Samples preserve the originating host and query, thread, timestamp, frame addresses and symbol names, and memory size. Distributed queries forward supported samples with their original identities. Native clients can print packets as JSONEachRow with --print-profile-traces.

Per-query queues are bounded. A collector barrier precedes the final drain, with one ten-second deadline for writing and acknowledging the marker. A timeout discards the remaining traces and logs a server warning while preserving the query result or original exception. Disabling delivery discards queued samples without waiting for the collector, including when SQL disables tracing and then fails during analysis.

Samples from draining, serializing, and decoding trace packets are excluded from the stream. Receive-side suppression follows coroutine suspension and thread migration without disabling unrelated work on the same thread. Secondary queries request traces only while delivery is active for the coordinator's client; explicit remote SQL opt-outs are preserved.

Distributed forwarding preserves producer identities through multiple hops. Separate delivery status rows report queue-loss deltas and collector timeouts even when sample queues are full. Coordinators aggregate the deltas once for the complete response; the count is independent of host selection and excludes losses before the collector.

The server's trace collector must be configured through trace_log. Receiving samples does not require permission to read or flush system.trace_log.

Related: #117830

Changelog category (leave one):

  • New Feature

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

Add the send_profile_traces setting to stream query profiler samples through the native protocol and HTTP framing formats. Native clients can print streamed samples as JSONEachRow using --print-profile-traces.


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

Add opt-in `send_profile_traces` delivery through bounded per-query
subscriptions. Route samples using signal-safe numeric identifiers so
truncated or reused query IDs cannot mix subscriptions, and order the final
drain after samples already written to the collector pipe.

Expose revision-gated `ProfileTraces` packets and matching HTTP framing
packets, retaining remote host/query identities and symbolizing samples
outside the collector. Suppress allocation sampling while queueing and
serializing traces to avoid resampling those allocations. Handle
trace packets in normal, cancellation, and INSERT error receive paths.

Document the schemas and add functional coverage for streaming, settings
overrides, restricted users, connection reuse, compression, remote queries,
and failures before an INSERT schema is sent.

Related: ClickHouse#117830
Requested in: ClickHouse#117830 (comment)

Co-Authored-By: Codex CLI <[email protected]>
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Sep 6, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [be67e88]

Summary: ❌

job_name test_name status info comment
Style check FAIL
various FAIL cidb
Code Review DROPPED
Fast test (arm_darwin) DROPPED
Build (amd_debug) DROPPED
Build (amd_asan_ubsan) DROPPED
Build (amd_tsan) DROPPED
Build (amd_msan) DROPPED
Build (amd_binary) DROPPED
Build (arm_asan_ubsan) DROPPED
Build (arm_binary) DROPPED

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Sep 6, 2026
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 6, 2026
Consume `profile_traces` events from each query response and aggregate CPU,
real-time, and allocation samples incrementally. Keep zoom references stable
while samples arrive, bound retained stacks and rendered frames, and render
symbol names as text so incoming samples cannot inject markup.

Expose per-tab profiling beside Run and retain the server sampling defaults
unless the user selects a period. Remove the follow-up `system.trace_log`
lookup and log flush, and report unsupported profiling without resubmitting
the query. Keep the toolbar usable on narrow screens.

Add executable aggregation and rendering coverage and update the existing
framing test to recognize flame-graph availability in the tab controls.

Requested in: ClickHouse#117830 (comment)
Related: ClickHouse#117830
Related: ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 6, 2026
Include the published opt-in profiler transport that the live flame graph
consumes, together with its current master base. Preserve the original Web
UI history, including the two local follow-up commits, without rewriting
commits or changing the tested UI files during the merge.

Requested in: ClickHouse#117830 (comment)
Related: ClickHouse#117830
Related: ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 6, 2026
Clearing a result switched back to the result view but left the Flame panel
visible. After profiling a query and disabling profiling for the next run,
the old controls remained beside the new result while the Flame toggle was
hidden.

Hide the panel together with the logs and metrics panels. Extend the Node
regression harness to execute the page's real `clear` method and verify that
only the result view remains visible and profiler samples are discarded.

Requested in: ClickHouse#117830 (comment)
Related: ClickHouse#117830
Related: ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... label Sep 6, 2026
Comment thread src/Interpreters/ProfileTraces.cpp Resolved
Comment thread src/Interpreters/ProfileTraces.cpp Resolved
Comment thread src/Interpreters/TraceCollector.cpp Resolved
ei-grad and others added 3 commits September 7, 2026 09:46
Integrate the updated settings compatibility implementation and hedged
connection cancellation before addressing the profiler transport feedback.
The merge preserves both the transport changes and the current base changes
without conflicts.

Related: ClickHouse#118415
`TCPHandler::updateProfileTracesQueue` modifies the supplied query state,
but only reads connection state. Mark the method const in its declaration
and definition to satisfy `readability-make-member-function-const`, which
is treated as an error in the `arm_tidy` build.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118415&sha=eb2fd93ab7bf6d6b619f92b9d179f79d08807071&name_0=PR&name_1=Build%20%28arm_tidy%29
Related: ClickHouse#118415
Related: ClickHouse#117830

Co-Authored-By: Codex CLI <[email protected]>
Share one deadline between writing the collector marker and waiting for its
acknowledgement. On timeout, close the subscription, discard pending samples,
and log a warning while preserving the query result or original exception.
Disabling delivery cancels the queue immediately, including when native
query analysis throws after applying SQL settings.

Restrict local and forwarded trace batches to the documented CPU, real-time,
and memory sample kinds. Exclude events whose metadata is not represented by
the packet, including jemalloc callbacks from transport allocations, without
changing their collection in `system.trace_log`.

Add native and HTTP regressions for supported types, real jemalloc callback
filtering, collector timeouts, and late SQL opt-out. Document the supported
types and timeout behavior, and complete the auxiliary packet descriptions.

Related: ClickHouse#118415
Related: ClickHouse#117830
Requested in: ClickHouse#117830 (comment)

Co-Authored-By: Codex CLI <[email protected]>
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 7, 2026
Include the reviewed trace-type filtering and bounded final-flush behavior
so the live flame graph uses the current profiler transport. Preserve both
branch histories and retain the previously tested UI files unchanged.

Related: ClickHouse#118415
Related: ClickHouse#117830
Comment thread src/Interpreters/ProfileTraces.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit f9471459ff261c7e3003cb31f14f344869d8fc76 was not compared: the CI logs cluster did not answer (every POST attempt failed with an exception).

See the job log for details.

ei-grad and others added 6 commits September 7, 2026 16:00
Resolve the independent additions to the 26.9 settings history while
preserving both compatibility entries. Retain master's revert of the
remote cancellation shortcut and keep profile trace packet forwarding
in the normal receive and final drain paths.

Related: ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
Prevent `CPU` and `Real` ticks during queue draining, symbolization and
packet serialization from adding the delivery path to its own stream.
Extend `ProfileTracesBlocker` with a signal-safe thread-local flag and
omit the stream subscription ID while blocked. Nested scopes restore
the previous state, and time samples remain available to `trace_log`.

Add a functional regression with real profiler ticks, positive resolved
query samples, and checks for transport stacks over Native and HTTP.
Document the delivery exclusion in the native specifications and framing
and setting references.

Related: ClickHouse#118415 (comment)
Related: ClickHouse#117830 (comment)

Co-Authored-By: Codex CLI <[email protected]>
Clear `send_profile_traces` in secondary-query wire settings when the
coordinator cannot deliver trace packets to its client. Keep the value
explicitly changed so a shard profile cannot re-enable delivery.

Strip positive SQL overrides from cloned forwarded queries using the
existing settings-removal paths. The effective wire setting is decided
when transport queues are available, including late SQL-only opt-in.
Preserve explicit SQL opt-outs and reject invalid Boolean values.

Cover plain HTTP, framed HTTP, Native, both hedged modes, nested settings,
and late opt-in and opt-out with observable remote setting values.

Related: ClickHouse#118415 (comment)
Related: ClickHouse#117830

Co-Authored-By: Codex CLI <[email protected]>
Use unique malformed query IDs so concurrent HTTP test runs do not
collide. Separate timer and memory sampling, reduce timer frequency,
and share the final trace-log flush to limit profiler load.

The shared trace pipe intentionally drops writes when full. Continue
bounded sample observations when positive evidence is absent, while
failing immediately on malformed packets, invalid samples, unexpected
results, or the wrong terminal exception.

Related: ClickHouse#118415
Related: ClickHouse#117830
CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118415&sha=78a4c733b2e6129833724b2ba301e7862f2279f3&name_0=PR

Co-Authored-By: Codex CLI <[email protected]>
Nested `DEFAULT` settings are ignored during query-tree building.
Exercise the reset at the top-level query instead, while retaining the
nested numeric and string opt-out checks. Clarify that forwarded clauses
retain their existing query-scope semantics.

Related: ClickHouse#118415 (comment)

Co-Authored-By: Codex CLI <[email protected]>
The subscription ID increased the maximum profiler record to 514 bytes,
exceeding the 512-byte `PIPE_BUF` on Darwin and FreeBSD. Reduce the legacy
pipe query-ID budget from 95 to 93 bytes and enforce the portable limit
on every platform, so Linux builds catch the same regression.

Keep the stack capacity and record field encodings unchanged. Streamed
query IDs still come from the subscription registry and retain their
full value independently of the legacy pipe ID budget.

Related: ClickHouse#118415
Related: ClickHouse#117830
CI: https://s3.amazonaws.com/clickhouse-test-reports/PRs/118415/78a4c733b2e6129833724b2ba301e7862f2279f3/pr/build_amd_freebsd/build_clickhouse/build_clickhouse.log

Co-Authored-By: Codex CLI <[email protected]>
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 7, 2026
Include suppression of delivery stacks, transport-aware remote trace
settings, and the corrected sample-observation tests. Preserve the
existing Web UI implementation while integrating the reviewed master
changes through the backend branch.

Related: ClickHouse#118415
Related: ClickHouse#117830
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 7, 2026
Include the corrected 512-byte profiler pipe budget so Darwin and
FreeBSD builds preserve atomic records. The Web UI files remain
unchanged.

Related: ClickHouse#118415
Related: ClickHouse#117830
ei-grad and others added 4 commits September 8, 2026 11:29
Keep queue-loss deltas and collector timeout status outside the bounded
sample queue, so a slow consumer can see omissions even when no stack
samples fit. Consume forwarded deltas once and report their sum for the
coordinator's distributed response, without attributing them to a host.

Reuse the existing `ProfileTraces` block schema for `Dropped` and
`Incomplete` metadata. Bound batches including these rows, saturate counts
at the maximum `Int64`, and clear metadata on explicit opt-out. Document
that these counts exclude losses before the collector and cannot certify
completeness. Validate timeout metadata while retaining sample assertions.

Related: ClickHouse#117830 (comment)
Related: ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
Decoding incoming profile traces can generate further streamed samples
at the coordinator. Keep a stream-only suppression flag in coroutine and
fiber storage while preserving ordinary memory accounting and
`system.trace_log` sampling. Swap the flag atomically so profiler signal
handlers can read it safely during context switches.

Keep the stronger queue and output suppression synchronous. Cover all
four native read modes and guard restoration through nesting, thread
migration, cancellation, and concurrent Silk fibers.

Co-Authored-By: Codex CLI <[email protected]>
Exercise separate shard origins and nested forwarding over `Native` and
framed HTTP responses. Require producer-specific query IDs, symbolized
allocation samples, intact results, and an actual hedged replica change.

Cover forwarded queue losses, a nested collector timeout, cancellation,
and exceptions. Check that following queries cannot receive stale
samples and explicit opt-out suppresses delivery metadata. Allow the
injected nested timeout to finish its two schema-description flushes and
execution flush before the SQL deadline expires.

Validate `Dropped` and `Incomplete` metadata separately from supported
sample types in the existing stateless test.

Related: ClickHouse#118415
Related: ClickHouse#117830

Co-Authored-By: Codex CLI <[email protected]>
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 8, 2026
Aggregate streamed samples by `host_name` and retain an all-node view
within one shared memory budget. Preserve each node and trace type's
zoom across updates, and reset selection and loss state for each query.

Display bounded server-queue loss counts and incomplete collection
alongside browser omissions without treating status rows as samples.
Cover node selection, precise counters, atomic budget limits, and resets
in the existing served-page harness.

Related: ClickHouse#117830
Related: ClickHouse#118415
Context: ClickHouse#117830 (comment)

Co-Authored-By: Codex CLI <[email protected]>
@ei-grad

ei-grad commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor Author

AI-generated report: distributed profiling

Intent

Discuss the collection of profiler samples for distributed queries and obtain feedback on the scope and protocol before finalizing the feature.

Current implementation

  • Samples from remote servers travel over the existing query connections. Nested forwarding preserves the producing server's host_name, local query_id, and resolved symbols.
  • The Web UI supports an aggregate view and selection of an individual host, with CPU, real-time, and sampled-allocation modes.
  • Trace opt-in depends on a receiving transport queue. Forwarded SQL and serialized remote plans preserve explicit opt-outs and prevent nested opt-ins from enabling delivery without that queue.
  • Dropped and Incomplete are metadata rows with empty stacks in the eight-column ProfileTraces block. Queue-loss deltas are aggregated across the response; collector timeouts mark the profile incomplete.
  • Native cancellation discards pending trace delivery without waiting for the final collector barrier.
  • Native uploads keep samples in the bounded queue until their input terminator. Earlier query termination discards that queue so trace delivery cannot delay the original error or completion response.
  • Trace delivery is excluded from streamed samples, including non-final HTTP compression and writes. Ordinary query output remains visible in the profile.
  • Optimized distributed INSERT SELECT removes unsupported profile settings from SQL sent to older servers. Supported servers retain nested opt-outs.

Limitations relevant to the discussion

  • Root-query association is implicit in the response; rows do not contain initial_query_id for correlation outside that response.
  • Loss counts do not identify the node where loss occurred and do not include losses before the collector.
  • Per-node coverage/completion is not reported, including whether older servers contributed samples.
  • Remote writes through RemoteInserter do not forward shard-side samples. Optimized distributed INSERT SELECT execution through remote result receivers is a separate path.

Local validation

The current corrections passed both Native/HTTP distributed cancellation cases and six isolated checks that excluded trace types remain in system.trace_log. Signal timers are disabled in those integration cases; the cancellation workload uses bounded allocations so it can run under MSan. These local runs used Linux Release, so actual MSan execution remains for CI.

Six stateless scripts passed with CI ThreadFuzzer settings and trace-log symbolization enabled. They cover standard-client external/INSERT/input uploads, retained input-allocation samples, early upload errors, native cancellation, trace-send suppression, normal final drains, pre-schema exception traces, connection reuse, and remote SELECT delivery in both hedging modes. The previous binary reproduced an opposing socket-write failure on the new external-upload regression; the corrected binary completed it. Darwin HTTP diagnostics have a Linux replay check, with the Darwin failure's cause still unresolved.

Full CI verification remains in progress; local results do not imply that the complete CI matrix has passed.

Reference: implemented protocol semantics.


Prepared with LM assistance — Codex CLI

Include the upstream row-count repairs needed by the completed CI runs.
Resolve the connection conflict by retaining profile-setting preparation
and using the shared network compression codec selector from master.

Preserve the trace subscription lifecycle, distributed forwarding and
protocol negotiation while retaining the upstream shutdown, leaf-timeout
and preauthentication changes.

Related: ClickHouse#119429
Related: ClickHouse#119400
Related: ClickHouse#117830 (comment)

Co-Authored-By: Codex CLI <[email protected]>
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 14, 2026
Carry the backend's master integration and connection conflict resolution
into the UI branch while retaining the flamegraph controls and upstream
result pagination. Both pull requests continue to target master.

Related: ClickHouse#118415
Related: ClickHouse#117830 (comment)

Co-Authored-By: Codex CLI <[email protected]>
The ordinary-output positive control in test 05157 can finish before a
timer samples a socket send. The failing Darwin run returned every row
and resolved timer samples, but its `SELECT` took only 23 ms and none of
those samples matched the send stack.

Hold the client's output pipe while a bounded wide result fills the
socket buffers. Observe the query's ordinary send stack through
`system.stack_trace` and wait for its profiler counter to advance before
draining the client. Defer trace packets until the final drain and
exclude them from the synchronization predicate, preserving both the
`INSERT` suppression assertion and the ordinary-send positive control.

Use few result blocks and a shared deadline for control queries to bound
fixture cost. The final focused Linux test passes on the unchanged
backend binary; Darwin validation remains for CI.

Related: ClickHouse#118415
Related: ClickHouse#117830
CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118415&sha=fd2bdf56bcc2fb77360ffceaa15ac90dd44bb622&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29

Co-Authored-By: Codex CLI <[email protected]>
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 14, 2026
Include the ordinary-output backpressure control from the profiler
backend so both pull requests use the same regression test. The six
live flamegraph implementation and test files remain unchanged.

Related: ClickHouse#118415
Related: ClickHouse#117830
Comment thread src/Backups/BackupsWorker.cpp Resolved
ei-grad and others added 2 commits September 14, 2026 16:17
An older DDL worker rejects `send_profile_traces = 0` or `1` in the
executable `SELECT` of a queued table creation. Its settings packet is
already clamped, but the SQL clause is applied separately afterwards.

Validate nested and duplicate values before removing the delivery
setting from the cloned executable query. Leave stored view definitions,
other DDL settings, and ordinary remote-query opt-outs unchanged.

Cover current and older workers with explicit values and `DEFAULT`.
Add nested invalid-value cases with explicit columns so deferred `SELECT`
analysis cannot let the rewrite hide an invalid setting or create a table.

Related: ClickHouse#118415 (comment)
Related: ClickHouse#117830

Co-Authored-By: Codex CLI <[email protected]>
Cover the streamed `Memory` and `MemoryPeak` size fields in the existing
local and remote queries over `Native` and `HTTP` transport. Require peak
totals to exceed the active memory profiler threshold.

Allow zero allocation deltas from `CurrentMemoryTracker::check`, while
requiring a positive delta from the allocation workload after filtering
for the remote worker. This detects an all-zero size regression without
assuming that every memory check allocates or that peaks are ordered
across trackers. Keep the existing workload and bounded attempts.

Related: ClickHouse#117830 (comment)
Related: ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 14, 2026
Share the queued `CREATE TABLE AS SELECT` compatibility fix and memory
trace conformance checks with the live flamegraph branch.

Related: ClickHouse#118415
Related: ClickHouse#117830
Integrate upstream through 360a086 while preserving the existing
profiler changes. Resolve the protocol documentation overlap by retaining
the external-table schema validation guarantee and the rule that
`ProfileTraces` delivery waits for the upload terminator.

The five overlapping C++ files preserve the previous profiler diff.
The external-table schema guard remains before storage writes, and early
upload exceptions still discard queued traces before the terminal response.

Related: ClickHouse#118415
Related: ClickHouse#119849

Co-Authored-By: Codex CLI <[email protected]>
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 14, 2026
Include the upstream integration and native protocol documentation
resolution from the profiler backend. Preserve the six UI-specific files
and keep this pull request based directly on master.

Related: ClickHouse#117830
Related: ClickHouse#118415
/// applying that packet, so an initiator-only setting written in the statement itself would otherwise
/// reach an older worker as `UNKNOWN_SETTING` or be re-applied on a newer worker.
ClusterProxy::stripInitiatorOnlySettingsFromQuery(query_ptr);
if (const auto * create = query_ptr->as<ASTCreateQuery>(); create && !create->isView() && create->select)

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.

send_profile_traces is only stripped from non-view CREATE ... AS SELECT here. Stored definitions still keep it: CREATE VIEW / CREATE MATERIALIZED VIEW ... ON CLUSTER ... AS SELECT ... SETTINGS send_profile_traces = ... and ALTER TABLE ... ON CLUSTER ... MODIFY QUERY ... SETTINGS send_profile_traces = ... both enqueue SQL that a <54493 worker will re-apply during DDL execution.

InterpreterSetQuery::applySettingsFromQuery() still reads the source SELECT's SETTINGS for these stored queries, so an older worker hits UNKNOWN_SETTING during a rolling upgrade even though the same feature already strips this setting for executable CREATE TABLE ... AS SELECT.

Please either strip send_profile_traces from these queued stored definitions too, or add an explicit version gate that rejects them before they reach older workers. A mixed-version regression on older_cluster for CREATE VIEW / MODIFY QUERY would catch this.

@ei-grad ei-grad Sep 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵 The intended scope is request-level trace delivery, following send_logs_level and send_profile_events.

daa07ea5bca adds six mixed-version cases: CREATE VIEW, CREATE MATERIALIZED VIEW, and ALTER ... MODIFY QUERY, each targeting an old or current worker. The HTTP request enables send_profile_traces=1; the submitted definition contains no trace setting. All six cases passed locally, including worker 26.5.1.882: the requests finish successfully, SHOW CREATE matches the corresponding local definition, and the delivery option is not injected into stored SQL.

Explicitly writing the new setting into a stored SELECT is a separate SQL compatibility boundary. The earlier reproduction confirmed UNKNOWN_SETTING for both CREATE forms on the old worker. ALTER ... MODIFY QUERY with its default Analyzer succeeded and retained the setting; subsequent reads were not tested.

Stored definitions therefore retain explicitly supplied SQL settings under the existing DDL rules. No special VIEW prohibition or all-worker version/availability preflight is added. The earlier claim that the metadata tests established trace opt-out behavior for subsequent view reads was unsupported and is withdrawn.

ei-grad and others added 6 commits September 15, 2026 02:24
The query profiler temporarily masks the service signal used by
`system.stack_trace`. Under the flaky-check ThreadFuzzer configuration,
the positive control in test `05157` can miss that thread even while the
query remains blocked in an ordinary socket send. Resetting its baseline
on each missed observation can exhaust the deadline despite active sampling.

Retain the first confirmed send's counter across missing probes. Still
require a later matching socket stack and ten additional profiler runs.
Keep the deadline, upload checks and final Native sample assertion intact.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117830&sha=c56360b43d3e79906bf43d371fa4d391c95765c2&name_0=PR&name_1=Stateless%20tests%20%28amd_binary%2C%20flaky%20check%29
Related: ClickHouse#117830
Related: ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
Verify that `CREATE VIEW`, `CREATE MATERIALIZED VIEW` and
`ALTER MODIFY QUERY` succeed on old and current workers when the HTTP
request enables profile traces, without injecting that setting into their
stored `SELECT` text.
Compare each distributed definition with its local counterpart.

Keep explicit stored SQL separate from request delivery settings. Clarify
the DDL comment without promising profiler behavior for later view reads.
All six focused integration cases passed on the existing binary after
checking equivalence of the HTTP, framing and DDL forwarding sources.

Related review:
ClickHouse#118415 (comment)

Co-Authored-By: Codex CLI <[email protected]>
Integrate master 775a291, including the
05182 statistics-randomization fix and the PIE trace-address reland.
Preserve the profiler changes and request-level stored-DDL regression.

The merge is automatic. All five overlapping file deltas match upstream;
streaming already uses the address convention introduced by the reland.
Merge master at 688ee33 to resolve
conflicts with the new large-allocation diagnostic.

Keep the `TraceSender` collection query and `TraceCollector` allocation
budget reset and warning alongside the existing streaming registry,
delivery suppression, and ordered flush handling. The new diagnostic
trace type remains excluded from client samples by the supported-type
filter. Preserve distributed forwarding and stored-DDL behavior.

The PR retains its 105-path scope. Compile the sender, collector, memory
tracker, profile queue, and remote executor with the existing pinned
Clang toolchain to check the combined interfaces.

Related: ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
Move the `send_profile_traces` history entry from 26.9 to 26.10 after
merging the upstream version bump. The style check requires settings
introduced by the PR to be recorded under the current release.

Keep both values and the description unchanged. Validate the actual
history parser and checker against the full 105-file PR diff: the old
entry reproduces the CI failure and the corrected entry passes.

CI report:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118415&sha=7dd8710a29cc506e0983dc23eec98ea34959834a&name_0=PR

Related: ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
Stop disabling the analyzer in `05156_profile_traces_duplicate_settings`
after merging the upstream change that makes it mandatory. The legacy
cases fail with `SETTING_CONSTRAINT_VIOLATION` before reaching the
profile trace assertions.

Keep the modern local and remote duplicate, shorthand, and default-value
checks, both serialization and hedged-request modes, coordinator and
HTTP opt-out checks, and invalid Boolean rejection coverage. Remove the
legacy-only expectations without changing mixed-version tests.

Validate the original and corrected fixtures on the exact Fast CI binary:
the original reproduces Code 452 and the corrected test passes.

CI report:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118415&sha=7d32312e57726ad4ce9a146de7477f9d8b2171e1&name_0=PR&name_1=Fast%20test

Related: ClickHouse#118415

Co-Authored-By: Codex CLI <[email protected]>
"min_insert_block_size_rows": 0,
"min_insert_block_size_bytes": 0,
"input_format_parallel_parsing": 0,
"async_insert": 0,

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 new Native upload coverage hard-codes async_insert = 0, but this PR also extends the Native protocol contract for async_insert = 1 / wait_for_async_insert packet ordering and ProfileTraces interleaving. A regression in that async branch would still leave this suite green.

Can we add at least one async case for both wait_for_async_insert modes and assert the terminal Progress / ProfileEvents / ProfileTraces behavior there?

)
):
user = users[index]
# The timezone is known only to the server; parsing must use the dedicated update packet.

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.

This validates only the new server ordering where TimezoneUpdate arrives before the schema block. The spec change also documents compatibility with older servers that still send TimezoneUpdate after the schema, but nothing here exercises that mixed-version path, so a receiver regression would still pass.

Can we add a compatibility case against an older server, or another targeted regression that proves the client still accepts the legacy packet order?

…ming

Resolve the conflict with the move of the settings changes history into the setting declarations
(ee6b44f): the history records this PR added to `SettingsChangesHistory.cpp` now live as
trailing arguments of the `DECLARE` of each setting.

Also resolved conflicts in:
- `src/Interpreters/InterpreterInsertQuery.cpp`

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Create the initiating host's local view before testing `ALTER ... ON CLUSTER`, so local authorization can succeed before remote execution. Preserve the stored-definition assertions and drop the local fixture during teardown.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118415&sha=f9471459ff261c7e3003cb31f14f344869d8fc76&name_0=PR
Related: ClickHouse#118415
Cover both `wait_for_async_insert` modes, terminal `Progress`, `ProfileEvents` and `ProfileTraces`, connection synchronization, and durable inserted data.
Exercise the native client against a legacy server fixture that sends `TimezoneUpdate` after the schema. Cover both column-metadata modes and verify the exact uploaded values and successful completion.
Keep tiny decoder allocations eligible while sampling at five percent and using bounded remote array work. Require resolved remote samples and positive `Connection::receiveProfileTraces` coverage in `system.trace_log`, while preserving the assertion that decoder samples do not feed back into the stream.

Verified 25 repetitions covering all 100 asynchronous/hedged combinations against the existing CI binary.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118415&sha=f9471459ff261c7e3003cb31f14f344869d8fc76&name_0=PR
Related: ClickHouse#118415

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-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... external Author is not a member of the ClickHouse organization pr-feature Pull request with new product feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants