Skip to content

Enable the analyzer in the streaming-queries test client - #115957

Merged
Michicosun merged 4 commits into
ClickHouse:masterfrom
groeneai:pin-analyzer-streaming-lib
Aug 25, 2026
Merged

Michicosun merged 4 commits into
ClickHouse:masterfrom
groeneai:pin-analyzer-streaming-lib

Conversation

@groeneai

@groeneai groeneai commented Aug 22, 2026 •

Copy link
Copy Markdown
Collaborator

Enable the analyzer in the streaming-queries test client

Related: #113737

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

...

Description

04235_streaming_queries_alter_projection_rejected fails deterministically on master on
Stateless tests (amd_llvm_coverage, old analyzer, s3 storage, DBReplicated, WasmEdge, parallel, 2/3):
9 master commits and 17 unrelated pull-request branches in three days, 3 of 3 reruns each. It has
never passed on that job; every other job is green. Report for the first occurrence:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=9f73b426899380fb82c5acb883d0ad33a443e8cf&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20old%20analyzer%2C%20s3%20storage%2C%20DBReplicated%2C%20WasmEdge%2C%20parallel%2C%202%2F3%29

Root cause: streaming.lib's STREAMING_CLIENT did not enable the analyzer, and streaming queries
are only implemented there (InterpreterSelectQuery.cpp raises NOT_IMPLEMENTED). The job's
old analyzer option installs users.d/analyzer.xml, which turns the analyzer off through the
default profile, so the SELECT ... STREAM the test spawns exits immediately (all 26 failing runs
log Streaming queries are not supported with the old analyzer. (NOT_IMPLEMENTED)), no subscription
is registered, and the guard in MergeTreeData::checkAlterIsPossible is correctly skipped. That
explains both halves of the diff: the missing SUPPORT_IS_DISABLED and index_granularity becoming
128. The guard is correct and unchanged.

The setting is a precondition of the fixture, like the enable_streaming_queries=1 already on that
line, so it is pinned in streaming.lib; nine .sql siblings pin enable_analyzer = 1 in their
bodies for the same reason. 04545_streaming_queries_row_policy_multi_partition built its own client
invocation instead of sourcing the library, so it inherited none of those defaults. It now sources
streaming.lib and uses $STREAMING_CLIENT and $STREAMING_TABLE_SETTINGS like the other ten, with
its query-level settings moved to a SETTINGS clause, so all eleven shell streaming tests share one
pin. A no-old-analyzer tag was rejected, it would remove the job's only streaming.lib coverage.

Validated on a server carrying users.d/analyzer.xml: both tests fail before the change and pass
after, on the same build; with the guard also removed, 04235 still fails, so the assertion is not
vacuous. 04545 passes there 10 of 10 and in 4 concurrent copies, all 26 streaming tests pass, and
removing the library pin makes it fail with NOT_IMPLEMENTED again.


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

Version info

  • Merged into: 26.9.1.87 (included in 26.9 and later)

Streaming queries are only implemented in the analyzer: InterpreterSelectQuery
raises NOT_IMPLEMENTED ("Streaming queries are not supported with the old
analyzer") before the query runs. STREAMING_CLIENT did not enable it, so on jobs
built with the "old analyzer" option, which installs users.d/analyzer.xml and
disables the analyzer through the default profile, every STREAM query issued
through the lib exits immediately.

04235_streaming_queries_alter_projection_rejected failed deterministically on
master because of this. The SELECT ... STREAM it spawns died before registering
a subscription, so MergeTreeData::checkAlterIsPossible correctly found no
subscription, skipped the schema-changing-ALTER guard, and let MODIFY PROJECTION
through. Both halves of the diff, the missing SUPPORT_IS_DISABLED and
index_granularity becoming 128, come from that one cause. The guard is correct
and unchanged.

Pinning it in the lib rather than in the one test states a precondition of the
fixture, next to the enable_streaming_queries=1 that is there for the same
reason, and covers the nine sibling .sh tests that are latently affected but
currently skipped on that job by --no-long. Five .sql streaming siblings already
pin enable_analyzer = 1 in their bodies. A no-old-analyzer tag was rejected: it
would remove that job's only streaming.lib coverage.

Verified against a server carrying users.d/analyzer.xml: the test fails with the
exact CI diff before the change and passes after it, on the same build. With the
change applied and the guard deleted from MergeTreeData.cpp the test still
fails, so the assertion is not vacuous. 50 randomized and 50 non-randomized runs
pass, and the full 14-test streaming.lib family passes on a default server.
04545_streaming_queries_row_policy_multi_partition does not source
streaming.lib. It builds its own client invocation, so the analyzer pin added to
STREAMING_CLIENT does not reach it and its SELECT ... STREAM still hits
NOT_IMPLEMENTED when the default profile disables the analyzer. The test runs
with set -e against a one-line reference, so that exit aborts the script before
it prints anything.

It has not been failing only because its long tag keeps it out of the jobs that
disable the analyzer. Verified against a server carrying users.d/analyzer.xml:
the test fails without the flag and passes with it, ten runs in a row, and it
still passes on a default server where the setting is already the default.
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Aug 22, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (2 rounds, 0 open blockers)

Two independent reviews of this diff (mine, cold, plus a second model), across two rounds.
Round 1 found one real gap; round 2 returned no findings.

# Finding Verdict
❌ 04545_streaming_queries_row_policy_multi_partition.sh issues its SELECT ... STREAM through its own client invocation, not streaming.lib, so the lib pin does not reach it. It runs under set -e against a one-line reference, so an old-analyzer profile aborts it before it prints. AGREE, fixed
⚠️ The description named only the streaming.lib change after a second file was added. AGREE, description rewritten
⚠️ The failure count in the description was stale. Re-measured: 9 master commits and 17 unrelated pull-request branches over three days, 26 rows, every one Failed 3 out of 3 reruns, every one logging not supported with the old analyzer. AGREE, corrected
⚠️ My own open #113737 edits the same line of 04545 (it removes --max_execution_time=20). AGREE, linked above
💡 04657_streaming_queries_unique_key_reject is in the same unprotected state as 04619, not just 04619. It is skipped on that job by its no-replicated-database tag, and its assertion already accepts NOT_IMPLEMENTED. AGREE, both disclosed
💡 The added comment in streaming.lib states a standing property of streaming queries, not a fix history. DISAGREE, kept as written
💡 Nothing is weakened: no assertion, tag or reference byte changes, and enable_analyzer is not one of the settings the test runner randomizes. Removing the guard from MergeTreeData.cpp still fails the test. DISAGREE, no change
❌ Round 0 blocker of mine: the guard's rejection might not reach the client under Replicated DDL, making this a real bypass. DISAGREE

On that last one: DDLWorker::tryExecuteQuery rethrows unconditionally on the initiator, four
tests asserting server errors from the same checkAlterIsPossible are green on that exact job
(2196 to 2202 runs each), and all 26 failing runs record the server rejecting the STREAM query
itself, so no subscription ever existed for the guard to act on. Every DBReplicated stateless job
in the last week is also an old-analyzer job, so the analyzer option is the variable that
separates them.

git diff -- src/ is empty. The two changed files are test support only.

Session id: cron:clickhouse-review-slot-11:20260822-230600

@clickhouse-gh

clickhouse-gh Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7510f0f]

Summary: ✅


AI Review

Summary

This PR makes streaming.lib force enable_analyzer = 1 for shell streaming tests and rewrites 04545_streaming_queries_row_policy_multi_partition.sh to use the shared fixture, so the old-analyzer CI lane exercises a real STREAM path instead of failing early with NOT_IMPLEMENTED. I did not find a new correctness or coverage problem in the current diff; the rewrite is consistent with the rest of the shell streaming test family.

Missing context / blind spots
  • ⚠️ Most build/test jobs were still pending at review time; only Fast test and Style check had completed. The remaining CI matrix is the main outstanding evidence for cross-platform shell-test safety.
Final Verdict

✅ No review findings from the current diff. Merge looks reasonable once the pending CI finishes.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 22, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? YES. clickhouse-test 04235_streaming_queries_alter_projection_rejected against a server carrying tests/config/users.d/analyzer.xml fails every run with the byte-exact CI diff.
b Root cause explained? YES. The old analyzer job option installs users.d/analyzer.xml, disabling the analyzer through the default profile. Streaming queries are analyzer-only, so the spawned SELECT ... STREAM exits with NOT_IMPLEMENTED, no subscription is registered, subscription_manager.hasSome() is correctly false, the guard is skipped, and MODIFY PROJECTION applies. One cause produces both halves of the diff.
c Fix matches root cause? YES. The missing precondition is stated where the fixture's client is built. No widened bound, no blanket no-random-*, no silencing tag.
d Test intent preserved / new tests added? YES. No test file is touched and the assertions are byte-identical. Removing the guard from MergeTreeData.cpp with this change applied still fails the test, so the oracle is intact. The existing test is the regression test.
e Both directions demonstrated? YES. Same build, same old-analyzer server: fails with the exact CI diff without the change, passes with it. Repeated on the final Build-ID-verified binary.
f Fix is general across code paths? YES. Pinned in streaming.lib, so all ten consumers are covered, including the nine currently skipped on that lane by --no-long. The five raw $CLICKHOUSE_CLIENT calls in the family are plain INSERTs with no analyzer dependency. The .sql streaming siblings already pin the setting or carry no-old-analyzer.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A for the product, since no code path is added. Setting-matrix coverage measured instead: 50 randomized and 50 non-randomized runs, on both old-analyzer and default-analyzer servers, all green.
h Backward compatible? (maintainer-approved exception only) YES. No setting default changed, so no SettingsChangesHistory.cpp entry; no serialization or format change; test-support only.
i Invariants and contracts preserved? YES. No src/ change (git diff --stat -- src/ is empty). The invariant established is a harness one: any client issuing a STREAM query in the functional suite needs enable_analyzer = 1, because the server otherwise rejects the query before it runs. The setting is already the default on every lane except the old-analyzer one, so no other lane changes behaviour.

Session id: cron:clickhouse-impl-slot-40:20260822-204300

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @Michicosun, could you review this? Test-only: streaming queries need the analyzer, but streaming.lib's client did not enable it, so on the old analyzer job the spawned SELECT ... STREAM exits with NOT_IMPLEMENTED and 04235_streaming_queries_alter_projection_rejected fails deterministically on master.

Comment thread tests/queries/0_stateless/streaming.lib Resolved
@clickhouse-gh

clickhouse-gh Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 7510f0f58 with master 4a31c250c (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
Binary Master PR Δ
programs/clickhouse-stripped 705.79 MiB 702.76 MiB -3.03 MiB (-0.43%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

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

Job report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 51f5b75

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens.

Check / test Reason Owner / fixing PR
Stress test (arm_tsan) / Found patch part ... that intersects mutation with version ... (STID 2781-51e9) pre-existing trunk logical error in the lightweight-updates patch-merge path, not reachable from this diff #115064 (external, open)

Detail on that row:

  • The abort is thrown at src/Storages/MergeTree/PatchParts/PatchPartsUtils.cpp:456 in
    patchHasHigherDataVersion, on patch-8f8a8ef7a53dcc7595b677dc20952c9f-0_0_26_2_26
    whose data-version range 10..26 spans mutation version 16. Failures: 1/5 on that job.
  • Do not merge patch parts across the data version of an existing part #115064 ("Do not merge patch parts across the data version of an existing part") is the
    owner by CONTENT, not by area: it is the only open PR that edits PatchPartsUtils.cpp, it
    adds getDataVersionsByPartition plus findDataVersionInRange so a merge producing a patch
    whose version range spans an existing part version is never assigned, and its own new comment
    names patchHasHigherDataVersion, the exact throw site above. Its changelog entry quotes this
    error string verbatim.
  • Not this PR's doing. Over 30 days the signature has 30 rows across 27 distinct pull
    requests plus 4 rows whose head_ref is the literal master, with onset
    2026-08-07 09:01:51Z, sixteen days before this PR existed. A control on the same pattern
    without the status filter returns the same 30 rows, so the breadth figure is measured rather
    than an artifact of the filter.
  • This diff is two test files (04545_streaming_queries_row_policy_multi_partition.sh and
    streaming.lib) and contains 0 occurrences of patch part, mutation or MergeTree,
    against positive controls of 16 for streaming and 3 for analyzer. No master merge was made
    to pick anything up: the owner is still open, so there is nothing to import.
  • The sibling shape #113998 ("Do not merge patch parts across a pending mutation version") is
    deliberately not linked here. It touches ReplicatedMergeTreeQueue.cpp only and has 0
    occurrences of PatchPartsUtils or patchHasHigherDataVersion, so it does not own this
    throw site.

Finish Workflow and Config Workflow both completed successfully and Style check passed, so
this is a real verdict rather than a dropped run. Of 174 praktika nodes the only non-OK,
non-SKIPPED entries are the parent PR node, the stress lane and that single logical error.

Session id: cron:our-pr-ci-monitor:20260823-050000

Comment thread tests/queries/0_stateless/streaming.lib Resolved
@Michicosun
Michicosun enabled auto-merge August 23, 2026 10:20

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@groeneai rewrite this test to streaming.lib

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 7510f0f. It now sources streaming.lib and runs every statement through $STREAMING_CLIENT, with the table created from $STREAMING_TABLE_SETTINGS.

Two details worth flagging, since the two flag sets were not supersets of each other:

  • query_plan_remove_unused_columns, max_threads, max_threads_min_free_memory_per_thread and max_execution_time were only on this test's own client, so they moved into a SETTINGS clause on the streaming query rather than being dropped.
  • $STREAMING_CLIENT adds use_skip_indexes_on_data_read=0, and $STREAMING_TABLE_SETTINGS adds the two add_minmax_index_for_block_* settings plus part_minmax_index_columns, which this table did not set before. The row-policy assertion holds with them.

Verified on a server carrying users.d/analyzer.xml (allow_experimental_analyzer = 0 in the default profile, as the old-analyzer jobs install it): passes there and on a default-profile server, 10 of 10 runs, and 4 concurrent copies pass so it stays parallel-safe without a tag. All 26 streaming tests pass. Removing the pin from streaming.lib makes it fail with NOT_IMPLEMENTED again, so the test is genuinely relying on the shared pin rather than passing for another reason.

Description updated to describe the rewrite instead of the direct pin.

04545_streaming_queries_row_policy_multi_partition built its own client
invocation instead of sourcing streaming.lib, so it did not inherit the
streaming defaults the other ten shell streaming tests share and needed a
separate analyzer pin of its own. It now sources the library and runs every
statement through $STREAMING_CLIENT, with its three query-level settings
moved into a SETTINGS clause on the streaming query and the table created
with $STREAMING_TABLE_SETTINGS.

Verified on a server carrying tests/config/users.d/analyzer.xml, which sets
allow_experimental_analyzer = 0 in the default profile the way the old
analyzer CI lanes do: the test passes there and on a default-profile server,
10 out of 10 runs on the old-analyzer profile, and 4 concurrent copies pass
so no no-parallel tag is needed. Removing the pin from streaming.lib makes
it fail with NOT_IMPLEMENTED again, so the pin is what the test depends on.
All 26 streaming tests pass.
auto-merge was automatically disabled August 23, 2026 14:12

Head branch was pushed to by a user without write access

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 7510f0f

CI is fully finished at this commit and no check failed, so no ledger row is owed.

Evidence: no check queued or in progress; Config Workflow, Style check and Finish Workflow all
green; 51 praktika nodes with every node in {OK, SKIPPED} and none dropped. A CIDB query at this
commit, filtered against the measured healthy-token set, returns zero non-green rows against a
control of 85,318 rows at the same commit, so that zero is a real filtered subset rather than an
empty query.

Session id: cron:our-pr-ci-monitor:20260823-183000

@Michicosun
Michicosun enabled auto-merge August 25, 2026 09:19
@Michicosun
Michicosun added this pull request to the merge queue Aug 25, 2026
Merged via the queue into ClickHouse:master with commit ed4df18 Aug 25, 2026
178 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 25, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Aug 26, 2026
04545_streaming_queries_row_policy_multi_partition.sh moved onto streaming.lib
in ClickHouse#115957 after this branch was cut, so the loop body conflicted. Took
master's form, $STREAMING_CLIENT with the query settings in a SETTINGS clause,
and dropped only max_execution_time from that clause. The rest of the file is
master's verbatim, and the branch still changes exactly one file.
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 groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants