Skip to content

Refuse a disabled stateless worker client before validating the worker cluster - #126660

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/stateless-worker-disabled-client-refusal
Nov 1, 2026
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/stateless-worker-disabled-client-refusal

Conversation

@groeneai

@groeneai groeneai commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

A query with make_distributed_plan = 1 on a server that configures no stateless workers is refused with SUPPORT_IS_DISABLED again, instead of NO_ELEMENTS_IN_CONFIG with an empty cluster list.

Description

Related: #124938

Since #124938, a server without a stateless_worker_client block (the stock config, and the NightlySQLancer server) answers make_distributed_plan = 1 with Code: 139 ... No default stateless worker cluster is configured; set `distributed_plan_worker_cluster` to one of: . (NO_ELEMENTS_IN_CONFIG). StatelessWorkersProviderRegistry::getProvider validated the cluster selection first, and the "client is not enabled" check (SUPPORT_IS_DISABLED) sat in buildProvider, after it. #124938 moved that check out of fillWorkerAddresses saying that resolving a new provider is refused by the registry with SUPPORT_IS_DISABLED, but the registry did so only when a disabled client still named a worker source.

The SQLancer DistributedPlanEquivalence oracle expects SUPPORT_IS_DISABLED but not the new message, so the 2026-10-19 nightly (SQLancer (arm_asan_ubsan)) got one finding per database, hit the 2000-finding cap and stopped after 299k queries (arm_release too). The 2026-10-16 run, before #124938, ran 969k queries with no findings.

getProvider now checks stateless_worker_client.enabled before the selection and throws SUPPORT_IS_DISABLED; the duplicate check in buildProvider is removed. A disabled client never got a provider before either, so only the error changes. A query that already resolved its provider still drains on it.

Validation: the new gtest Context.RefusesProviderWhenClientIsNotConfigured fails without the fix (139 vs 344) and passes with it. A server started as the SQLancer job starts it gives Code 139 for the failing CI query on master and 344 with the fix. Distributed-plan tests on real workers pass unchanged. The oracle's make_distributed_plan profile is skipped on that server both before #124938 and after this fix; running it for real is a job-config choice.


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

Version info

  • Merged into: 26.11.1.1029-master (included in 26.11 and later)

On a server without a `stateless_worker_client` block (the stock config,
and the NightlySQLancer server) `make_distributed_plan = 1` failed with
NO_ELEMENTS_IN_CONFIG "No default stateless worker cluster is configured;
set `distributed_plan_worker_cluster` to one of: ." (an empty list).

`StatelessWorkersProviderRegistry::getProvider` canonicalized the cluster
selection first, and the `enabled` check lived in `buildProvider`, after
it. ClickHouse#124938 removed the check from `fillWorkerAddresses` because "resolving
a new provider is refused by the registry (SUPPORT_IS_DISABLED)", but that
held only when a disabled client still named a worker source.

Check `enabled` at the start of `getProvider` and drop the duplicate in
`buildProvider` (its only caller, same configuration object). A disabled
client never resolved a provider before either: a cached entry's signature
never matches the empty signature of a disabled client, so only the error
changes. A query that already resolved its provider still drains on it,
since `Context::getStatelessWorkersProvider` never re-enters the registry.

The SQLancer DistributedPlanEquivalence oracle expects SUPPORT_IS_DISABLED
but not the new message, so every database was a finding and the
2026-10-19 nightly stopped at the 2000-finding cap.

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

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review: my own cold review plus an independent model (engine: codex). 0 findings from either.

# Sev Finding Verdict Evidence / action
- - none - Both reviews covered every caller of StatelessWorkersProviderRegistry::getProvider, the per-query provider cache, getCascadesPlanningNodeCount, reloadConfig and the existing gtests.

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-10:20261019-092600

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. A server started as ci/jobs/sqlancer_job.sh starts it (provider config.d from ClickHouse/sqlancer@b82d56d, no --config-file, no stateless worker config) returns Code 139 NO_ELEMENTS_IN_CONFIG for the CI's failing query on every run; the new gtest fails on the unfixed source every run.
b Root cause explained? StatelessWorkersProviderRegistry::getProvider ran canonicalizeClusterName before any enabled check; with no stateless_worker_client block the default selection has no worker source, so it threw "No default stateless worker cluster is configured ... one of: ." The SUPPORT_IS_DISABLED gate in buildProvider was never reached.
c Fix matches root cause? Yes. The refusal moves to the start of provider resolution in the registry, as #124938's own commit describes; no CI-side whitelisting or job-config change.
d Test intent preserved / new tests added? New gtest Context.RefusesProviderWhenClientIsNotConfigured (stock config shape). All existing stateless-worker registry, context and plan-sizing gtests pass (26/26).
e Both directions demonstrated? gtest: FAIL (e.code() 139 vs 344) without the fix, PASS with it. Server: master snapshot 139, fix 344 for the CI query and 4 other oracle shapes. Both on Build-ID-checked binaries.
f Fix is general across code paths? Yes. The only other enabled gate, getCascadesPlanningNodeCount, already checks first; fillWorkerAddresses defers to the registry by design; tryGetProvider/getBuiltProviders are non-throwing introspection; buildProvider has one caller.
g Fix generalizes across inputs (params/datatypes/wrappers)? Empty, unknown and named distributed_plan_worker_cluster on a disabled server all give 344; distributed_plan_execute_locally = 1 still returns rows; enabled path unchanged (gtests, 3 distributed-plan functional tests on real workers). Datatypes N/A.
h Backward compatible? (maintainer-approved exception only) Yes. Error code only, on a master-only path (#124938 is in no release); it restores the pre-#124938 error. No setting or format change.
i Invariants and contracts preserved? getProvider never returned a provider for a disabled client before (a cached entry's signature never matched the empty disabled signature) and still never does. A query that already resolved its provider keeps draining on it (KeepsResolvedProviderAfterClientIsDisabled passes). The new check reads only the config, before the registry lock.

Session id: cron:clickhouse-impl-slot-4:20261019-090000

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @serxa @davenger, could you review this and add the can be tested label so CI runs? It moves the stateless_worker_client.enabled check in StatelessWorkersProviderRegistry::getProvider ahead of the cluster selection, so a server with no worker config refuses make_distributed_plan = 1 with SUPPORT_IS_DISABLED again instead of NO_ELEMENTS_IN_CONFIG (which flooded the NightlySQLancer run after #124938).

@clickhouse-gh

clickhouse-gh Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9731b22]

Summary: ✅


AI Review

Summary

PR #126660 restores SUPPORT_IS_DISABLED when make_distributed_plan = 1 requests workers on a server without an enabled stateless worker client. It moves the enabled check before cluster validation and adds focused regression coverage. No actionable findings at commit 9731b227fbe47690549f6a073bf6fb54068d6e6a.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... labels Oct 19, 2026
@serxa serxa self-assigned this Oct 19, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Oct 21, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - acf8e02

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. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel) / 05339_decimal_wide_comparison_scale_overflow flaky, not from this PR (it changes only the stateless worker provider registry): ARGUMENT_OUT_OF_BOUND on the remote _CAST('1', 'Decimal(18, 18)') that parallel replicas send; all 122 reruns passed #126652 (ours, open)
Stateless tests (arm_asan_ubsan, targeted) / job-level, no test ran infra, not from this PR: test selection got HTTP 500 (total) memory limit exceeded from CIDB and the job errored before running any test #125613 (ours, open)
Mergeable Check, PR praktika rollups of the rows above #126652 and #125613 (ours, open)
Sync - CH Inc sync (private, not actionable by me)

The other 3 tests counted as failed in the ParallelReplicas job are NOT_FAILED (they passed while listed in parallel_replicas_blacklist.txt) and did not fail it. CIDB has no other FAIL or ERROR row on this head.

Session id: cron:our-pr-ci-monitor:20261021-090014

@serxa

serxa commented Oct 23, 2026

Copy link
Copy Markdown
Member

@groeneai ping me when its ready to be merged

@groeneai

Copy link
Copy Markdown
Collaborator Author

@serxa it is ready from my side. CI on acf8e02 has finished, and none of the failures come from this diff:

If you want a green Mergeable Check first, the ParallelReplicas job needs a re-run, which I can't trigger. Merging this also stops the NightlySQLancer failures: both 2026-10-22 runs stopped early on this error again.

@alexey-milovidov alexey-milovidov self-assigned this Nov 1, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 9731b227f with master 2898c5432 (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

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

Job report

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 1, 2026
Merged via the queue into ClickHouse:master with commit cc000c5 Nov 1, 2026
179 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 1, 2026
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... pr-not-for-changelog This PR should not be mentioned in the changelog 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.

4 participants