Skip to content

Fix distributed queries failing when Native binary type encoding is enabled - #123649

Merged
murphy-4o merged 15 commits into
ClickHouse:masterfrom
groeneai:groeneai/native-binary-types-between-servers
Oct 9, 2026
Merged

murphy-4o merged 15 commits into
ClickHouse:masterfrom
groeneai:groeneai/native-binary-types-between-servers

Conversation

@groeneai

@groeneai groeneai commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Closes: #123991
Related: #116341

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fixed queries that go through another server (remote, Distributed, parallel replicas, GLOBAL IN) failing with SYNTAX_ERROR, UNKNOWN_CODEC or CORRUPTED_DATA when output_format_native_encode_types_in_binary_format or input_format_native_decode_types_in_binary_format is enabled. The blocks of these queries now carry type names on the wire, and a shard with this change also works with an initiator without it. clickhouse-client --query_kind secondary_query follows the same rule.

Description

On 26.8.10.6 and 25.3.14.14, SELECT * FROM remote('127.0.0.2', system.one) with output_format_native_encode_types_in_binary_format = 1 fails with Code: 62 (Syntax error (data type)); the decode flag alone gives Code: 246 CORRUPTED_DATA from the shard.

TCPHandler builds its wire NativeWriter/NativeReader from the query's format settings. The initiator's server-side Connection never takes format settings and always uses type names, but a secondary query carries the initiator's settings, so the shard writes and parses binary-encoded types. Now one function, used by TCPHandler and by the client's Connection, clears both flags for the wire of a SECONDARY_QUERY. It is not gated on the protocol revision, so a new shard also works with an old initiator during a rolling upgrade; the cost is that clickhouse-client --query_kind secondary_query with these settings no longer works between different client and server versions. A shard still applies them to formats it reads itself. The client now also configures its Connection after a reconnect. Data the server skips after an error is decoded by the same rule, so a client query with external data no longer gets Connection reset by peer instead of its error.

This causes the 04819_dynamic_aggregate_function_state_version failures in the ParallelReplicas jobs, e.g. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=68493&sha=580775c4b5032d7f02cb49cf35c8c48419cb4b4d&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29 .

Validation: new test 05317_native_binary_types_between_servers covers remote read/insert/logs, parallel replicas, shard-side file(), a client secondary query and skipped external data; it fails on master. test_native_type_names_secondary_query runs a 25.3 initiator against a new shard. 04819: 50/50 in the ParallelReplicas profile.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.10.1.1890-master (included in 26.10 and later)
  • Backported to: 26.9.18.12, 26.8.26.11

groeneai and others added 7 commits October 2, 2026 21:04
The initiator's server-side `Connection` (RemoteQueryExecutor,
RemoteInserter, the Distributed async queue) never takes format settings,
so it always reads and writes `Native` blocks with textual type names.
Since fa40b43 `TCPHandler` builds its wire `NativeWriter` and
`NativeReader` from the query's format settings, and a secondary query
carries the initiator's settings. With
`output_format_native_encode_types_in_binary_format = 1` the shard wrote
binary-encoded types that the initiator parsed as names (`SYNTAX_ERROR`,
or `UNKNOWN_CODEC` for `Dynamic`, whose type index is read as a 43-byte
length); with `input_format_native_decode_types_in_binary_format = 1` the
shard parsed the initiator's blocks, including the empty external-tables
block of every remote SELECT, as binary types (`CORRUPTED_DATA`).

`TCPHandler` now clears both flags in the wire format settings of a
`SECONDARY_QUERY`, at all six sites. The query context is unchanged, so
a shard still applies the settings to formats it reads or writes itself
(`remote(..., file(..., Native))`); stripping them on the sender side in
`ClusterProxy::stripInitiatorOnlySettings` would break exactly that.

This is the cause of the `04819_dynamic_aggregate_function_state_version`
failures in the ParallelReplicas coverage lane (issue ClickHouse#116341 read it as a
teardown race): the 4th fetch is the only one with the encode flag, and it
fails whenever a remote replica's packet is read before the local plan
finishes.

The Native format and protocol specs are updated, and the new test
05317_native_binary_types_between_servers covers remote read, parallel
replicas, remote insert and a shard-side file() read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous commit made `TCPHandler` ignore both binary type encoding
flags for the wire of a `SECONDARY_QUERY`, but `clickhouse-client
--query_kind secondary_query` still configured its own `Connection` from
them. With both flags set that query worked before (both ends binary)
and desynchronized after (server names, client binary): `CORRUPTED_DATA`
on INSERT and SELECT.

The rule now lives in one function, `getNativeWireFormatSettings`, used
by the six `TCPHandler` wire sites and by both places where the client
configures its `Connection`. The client's own input and output formats
keep honouring the flags. The spec text states the symmetric rule.

05317 becomes a shell test so it can send a secondary query from the
client; that part is green on master and red on the server-only fix,
while the server-to-server parts stay red on master. The parallel
replicas leg now pins `automatic_parallel_replicas_mode = 0`, which the
runner randomizes to 2 (statistics only, no parallel read) in a quarter
of the runs, and checks `ParallelReplicasUsedCount`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A secondary query's `Native` blocks carry type names only when both peers
are at `DBMS_MIN_REVISION_WITH_TYPE_NAMES_FOR_SECONDARY_QUERY` (54493).
`getNativeWireFormatSettings` takes the peer's revision: `TCPHandler`
passes the client revision from the hello, `clickhouse-client` the server
revision it got from `getServerVersion`. A peer built before this change
honours both binary type encoding settings for a secondary query, so the
unfenced rule broke `clickhouse-client --query_kind secondary_query` with
both flags between an old and a new binary in either direction. With the
fence every pairing with an older peer behaves as on master; an old
initiator with a new shard keeps the master error.

Bump `DBMS_TCP_PROTOCOL_VERSION` to 54493 and document the revision in the
native protocol and format specs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`processParsedSingleQuery` set the Native wire format settings on the
client `Connection` before the reconnect check. A reconnect replaces the
object, and the replacement starts with no format settings and with the
server revision it has only just learned, so the first query on it
ignored both binary type encoding flags: the result failed with
`SYNTAX_ERROR` (same order on master for any query kind). The call now
runs after the check; nothing in between reads the format settings.

The parallel replicas leg of 05317 pins
`enable_parallel_blocks_marshalling = 1`, which the runner disables in 5%
of the runs, so the step that reaches the two block-marshalling callbacks
is always planned.

New `test_backward_compatibility/test_native_type_names_secondary_query`
runs `clickhouse-client --query_kind secondary_query` with both flags
from a 25.3 client against this server and the reverse; it fails in both
directions when the revision check in `getNativeWireFormatSettings` is
removed. The Native format spec lists the revision in its gate table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The parallel replicas leg of 05317 read through
`test_cluster_one_shard_three_replicas_localhost`, whose 127.0.0.1 replica
is a local address and so gets an uncompressed connection
(`Cluster.cpp`, `compression` defaults to `!is_local`). Without a codec
`convertColumnsToBLOBs` returns the block unchanged, so when the
coordinator gave the granule to that replica no BLOB was made and the
block-marshalling callback was not checked. The leg now uses the
`parallel_replicas` cluster with `max_parallel_replicas = 2` and
`load_balancing = 'in_order'`: that cluster lists 127.0.0.2 and 127.0.0.3
first, with fewer replicas than the cluster has the pools are ordered by
`load_balancing` on `(error_count, priority, ...)`, and
`distributed_replica_max_ignored_errors = 1000` keeps an error count left
by another test from moving 127.0.0.1 ahead. Both used replicas are
non-local, so whichever reads the granule compresses and marshals it.

Shell tests run with `--send_logs_level=warning` and no query of 05317
made the shard log a warning, so no Log block crossed the shard wire. A
new part runs the `remote()` read with `send_logs_level = 'trace'` and
`--server_logs_file`, so the shard's Log blocks travel to the initiator.

The protocol spec row for revision 54493 also names Totals and Extremes
blocks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The server sends the user's profile settings in Hello, and the client
applies the ones it did not change itself to its context in
`applySettingsFromServerIfNeeded`. That ran one line after the client
configured its `Connection` from the same context, and the per-query
snapshot is restored afterwards, so the Native wire flags of a profile
never reached the `Connection`: with both binary type encoding flags in
the profile, the server wrote and read binary-encoded types while the
client used type names, and every `clickhouse-client` query failed with
`Code: 62` (same order on master). Swap the two calls.

05317 gains a part with both flags set on a user; it fails on master and
on the previous head, passes now, and fails again with
`--apply_settings_from_server 0`.

The revision-table rows in protocol.mdx and format.mdx now say that
below 54493 a server never applies these settings to its own connection,
so between servers the shard and the initiator disagree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ction

Configure the client's Connection with the Native wire settings before the
settings sent by the server are applied, as on master. The server writes type
fields with output_format_native_encode_types_in_binary_format and the client
reads them with input_format_native_decode_types_in_binary_format, so the two
flags of a user profile must not reach the Connection one by one: a profile
with only the input flag would make the client read every server block as
binary types while the server sends type names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Oct 3, 2026
@groeneai

groeneai commented Oct 3, 2026 •

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

Pre-publication review by an independent model (engine: codex; 15 findings over 8 rounds) plus my own cold review (nits).

Bounce cap reached: published as is after the final fix round, with no gate run on this head; residual findings are listed below as not blocking. The final round restored the round 4 client and test files, which the gate reviewed (#11, #12), and kept the spec wording of #12. After publication, a gated round fixed #13 (raised again by the automated review) and #18.

# Sev Finding Verdict Evidence / action
1 ❌ clickhouse-client --query_kind secondary_query with both binary type flags desyncs: the client Connection still uses them while the server ignores them (ClientBase.cpp:2961,2968) AGREE, fixed one wire rule used by both TCPHandler and the client Connection; client secondary-query leg added to the test
2 ⚠️ The parallel replicas leg can read locally when the runner draws automatic_parallel_replicas_mode = 2 AGREE, fixed the mode is pinned and the test asserts ParallelReplicasUsedCount > 0
3 ❌ The secondary-query rule is unversioned, so a pre-change peer paired with a post-change peer desyncs (reproduced: old client -> new server Code: 246, new client -> old server Code: 62) AGREE, fixed the rule is fenced on protocol revision 54493 on both ends; spec revision tables updated
4 ⚠️ After a transparent reconnect the client's new Connection has no format settings, because they are set before the reconnect check AGREE, fixed the call moves after the reconnect check (same ordering on master for every query kind); manual repro through a connection-dropping proxy, no CI trigger for it
5 ⚠️ The runner disables enable_parallel_blocks_marshalling in 5% of runs, so the parallel replicas leg can skip the two block-marshalling callbacks AGREE, fixed the setting is pinned in that leg
6 ⚠️ No automated test reaches the below-54493 branch of the fence AGREE, fixed test_backward_compatibility test: older client with a new server and the reverse; fails when the revision check is removed
7 💡 The Native-format revision gate table lacks 54493 AGREE, fixed row added
8 ⚠️ The parallel replicas leg can be served by the replica at the local address, whose connection is uncompressed, so no block is marshalled AGREE, fixed the leg uses two non-local replicas (parallel_replicas cluster, in_order)
9 ⚠️ No test sends a Log block from the shard, so the logs writer is not covered AGREE, fixed a remote() query with send_logs_level = 'trace' and a non-empty server-logs file
10 💡 The protocol row omits Totals and Extremes AGREE, fixed listed
11 ⚠️ The client configures its Connection before applying the settings sent by the server, so both binary type flags set in a user profile make the server write binary types while the client reads type names not fixed here, residual the reorder that fixed it broke one-flag profiles (#14) and was reverted; with master's ordering this case fails on master and on this head alike (Code: 62, measured); #14 describes the full fix
12 ⚠️ The spec rows say both peers follow the settings below revision 54493, but a server's own connection never applies them AGREE, fixed both revision-table rows describe the server-pair mismatch below the gate
13 ⚠️ StorageQueryRunner cluster mode sends INITIAL_QUERY over a server-side Connection, so a job with the output flag fails on the initiator (Code: 62, on master too) AGREE, fixed the connection takes the job's settings with the two flags swapped; 05317 runs both, output-only and input-only jobs; unswapped, input-only jobs fail (Code: 246)
14 ❌ The reorder of #11 breaks a one-flag profile: the server writes types per the output flag and the client reads them per the input flag, so a profile with only input_format_native_decode_types_in_binary_format, which works on master, fails every client query AGREE, fixed reorder and its test part reverted; every profile combination now gives master's results. The full fix (client reads with the output flag, writes with the input flag) changes what both settings mean for clickhouse-client, so it is not in this PR
15 💡 The server-logs check of the test is also satisfied by the initiator's own logs noted, not blocking the part still fails when the shard's logs writer is reverted (the query fails)
16 💡 The test leaves its Native file in user_files noted, not blocking the file name is database-scoped and truncated on every insert
17 ❌ A JWT refresh inside Connection::sendQuery reconnects without updating the client's cached server revision DISAGREE it desyncs only if the same endpoint changes protocol revision across 54493 between two connects, with the undocumented --query_kind secondary_query and both flags
18 💡 The protocol row omits Scalar blocks AGREE, fixed listed

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding. Findings on hunks unchanged by the fix round are auto-dropped.

Session id: cron:clickhouse-review-slot-8:20261003-040700, post-publication round: cron:clickhouse-maint-slot-13:20261003-060200

@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. curl '...?output_format_native_encode_types_in_binary_format=1' -d "SELECT * FROM remote('127.0.0.2', system.one) FORMAT Native" fails 3/3 on master (Code: 62); the 04819 fetch with parallel_replicas_local_plan=0 fails 10/10 with the CI signature Unknown codec family code: 0 ... While executing Remote.
b Root cause explained? A secondary query carries the initiator's Native format settings, so the shard's TCPHandler writes and reads binary-encoded types, while the initiator's server-side Connection (no format settings) always uses type names.
c Fix matches root cause? Yes. One function, getNativeWireFormatSettings, clears the two binary type encoding flags for the wire of a SECONDARY_QUERY when the peer is at protocol revision 54493+; TCPHandler and the client's Connection both use it. No test-side change.
d Test intent preserved / new tests added? New 05317_native_binary_types_between_servers (remote read/insert, parallel replicas over two non-local replicas with a ParallelReplicasUsedCount check, shard-side file(), shard trace logs, client secondary query) and test_backward_compatibility/test_native_type_names_secondary_query (25.3 client against the new server and the reverse). Mutants that turn a leg red: helper no-op, decode line removed, sender-side strip, client call reverted, revision check removed (integration test fails both ways), runImpl marshalling callback, logs writer, profile-events writer; automatic_parallel_replicas_mode = 2 makes the check print 0. The processQuery callback is replaced by the runImpl one, so reverting it alone stays green.
e Both directions demonstrated? Yes: 05317 fails on master (server legs) and on the server-only fix (client leg), passes on the fix (50 randomized + 50 plain); 04819 and 05317 50/50 in the ParallelReplicas profile. Integration test passes on the fix, fails both ways without the revision check. Reconnect through a dropping proxy: Code: 62 before, 42 after. Profiles with one or both flags give master's client results.
f Fix is general across code paths? All six wire sites in TCPHandler (result/totals/extremes, both block-marshalling callbacks, input blocks, logs, profile events) and both places where clickhouse-client configures its Connection (the per-query one now runs after any reconnect). Every server-side sender (remote, Distributed sync/async, hedged, parallel replicas) reaches these sites.
g Fix generalizes across inputs (params/datatypes/wrappers)? Checked Dynamic, UInt64, String, LowCardinality(String), JSON; encode only, decode only, both flags; remote, Distributed with async insert, parallel replicas, GLOBAL IN, totals and extremes.
h Backward compatible? (maintainer-approved exception only) Yes. No setting; the rule is behind protocol revision 54493 on both ends, so a pair with an older peer behaves as on master (measured both ways with both flags). Trade-off: an old initiator with a new shard keeps the master error. Initial-query clients are unchanged, except that the first query after a reconnect now follows both flags.
i Invariants and contracts preserved? A Native block on a server-to-server connection is framed with type names in both directions. Only a copy of FormatSettings changes, so the shard's own format I/O still honours both settings.

Session id: cron:clickhouse-impl-slot-5:20261003-032400

@groeneai
groeneai requested review from CheSema and vitlibar October 3, 2026 04:22
@clickhouse-gh

clickhouse-gh Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [46f121b]

Summary: ✅


AI Review

Summary

Reviewed the current PR diff, the prior discussion, and the resulting code paths for client/server NativeReader and NativeWriter setup. The change now consistently routes secondary-query native blocks through getNativeWireFormatSettings on both TCPHandler and clickhouse-client, including the previously missed drain path and the log/profile/result marshalling hooks, and the added tests/spec updates line up with that behavior. I did not find any new correctness, compatibility, or coverage issues in the current revision beyond the already-discussed scoping decisions.

Final Verdict

✅ No new blocking or major findings.

LLVM Coverage Report

Measured on commit 46f121b.

Metric Baseline Current Δ
Lines 88.30% 88.30% +0.00%
Functions 92.10% 91.80% -0.30%
Branches 79.70% 79.70% +0.00%

Changed lines: Changed C/C++ lines covered: 52/58 (89.66%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Oct 3, 2026
Comment thread src/Formats/FormatFactory.cpp Resolved
@clickhouse-gh clickhouse-gh Bot added the comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... label Oct 3, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit 46f121b89ada0fa657543bf68a6b1dcaa8de8864 was not compared: the CI logs cluster did not answer (every POST attempt failed with an exception; stopped retrying after the 1250 s read budget).

See the job log for details.

groeneai and others added 2 commits October 3, 2026 06:54
…g settings

In cluster mode `QueryRunner` sends each job as an initial query over a
server-side `Connection`, which never takes format settings and so always
reads and writes type names. The remote server runs the job as an ordinary
initial query, so it applies `output_format_native_encode_types_in_binary_format`
and `input_format_native_decode_types_in_binary_format` from the job's
settings to the wire. A job with the output flag set was therefore logged on
the initiator as failed with `Code: 62` (`Syntax error (data type)`) while the
remote finished it, on master as well.

The connection now takes the job's format settings with the two flags
swapped: it reads with the flag the remote writes with, and writes with the
flag the remote reads with. Taking them unswapped, as `clickhouse-client`
does, would break a job that sets only the input flag, which works today
(measured: `Code: 246` for it). The remote side is unchanged, so this also
works against servers without this change.

05317 gains a part with three jobs (both flags, output only, input only) on a
`QueryRunner` table over `test_shard_localhost`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Scalars go through the same writer as Data blocks (`Connection::sendData`)
and are read by `TCPHandler::initBlockInput`, so the revision 54493 rule
covers them too.

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

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 6f44aac

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) / 05213_timeseries_metric_families_target flaky: the time series table function resolves its target as default.ts_new on a parallel replica (Code: 60 UNKNOWN_TABLE); 18 PRs in the last 24 hours on this new job #118518 (external, open)
Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel) / 05257_sql_security_view_sealed flaky (reruns pass): a parallel replica reads the row-policy table of a SQL SECURITY DEFINER view as user default instead of the definer (Code: 497 ACCESS_DENIED); 19 PRs in the last 24 hours on this new job a fix task is created (fix in progress, fixing-PR link to follow here)
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 1/2) / 05237_with_expression_alias_scope_descendant deterministic under a Replicated database (the rerun does not use one, so it passes there): the replicated CREATE VIEW stores a nested WITH alias qualified with the database, so the view reads the same-named table; 52 PRs in the last 24 hours on this new job a fix task is created (fix in progress, fixing-PR link to follow here)
Mergeable Check, PR rollups, red only because of the rows above #118518 and the two fix tasks above

All 157 check runs completed and Finish Workflow is green; CIDB has no other FAIL or ERROR row on this head.

Session id: cron:our-pr-ci-monitor:20261003-143124

@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

Fixing PR for 05257_sql_security_view_sealed (parallel replicas) created: #123729

@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

Fixing PR for 05237_with_expression_alias_scope_descendant (DBReplicated): #123774

…ad path

`TCPHandler::processUnexpectedData` read the blocks it discards with default
format settings, while the main read path (`initBlockInput`) decodes them with
`getNativeWireFormatSettings`. A peer encodes its `Data` packets the same way
whether the server reads or skips them, so with
`output_format_native_encode_types_in_binary_format` and
`input_format_native_decode_types_in_binary_format` both set, a query that
failed before its external data was read made the skip reader take a binary
type code for a type name. The server then closed the connection, and the
client reported `Connection reset by peer` instead of the query's error.

Route the skip reader through the same helper, so it decodes exactly what
the main reader would. 05317 gets a part that sends external data with both
flags and fails the query server-side with `max_ast_elements`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-query rule

The FLATTENED Dynamic layout snippet still said its per-type names switch to
a binary type encoding whenever output_format_native_encode_types_in_binary_format = 1.
At revision 54494+ a secondary query writes them as textual names, like the
column type field (SerializationDynamic reads the same wire format settings).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@murphy-4o murphy-4o self-assigned this Oct 8, 2026
Comment thread src/Core/ProtocolDefines.h Resolved
Comment thread src/Storages/StorageQueryRunner.cpp Resolved
… out QueryRunner

Review on ClickHouse#123649: with the revision check an old initiator talking to a
new shard keeps the old error; without it a new shard also works with an
old initiator, because a server-side Connection never takes format
settings and always reads and writes type names. This fixes rolling
upgrades. The cost is `clickhouse-client --query_kind secondary_query`
with these settings between an old client and a new server.

The integration test now runs a 25.3 initiator against a new shard with
both settings (fails on master with Code 62).

The QueryRunner cluster connection change goes to a separate PR.

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

groeneai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Fixing PR for the arm_release 5/6 perf red (sum_map #0): #124676

@murphy-4o
murphy-4o added this pull request to the merge queue Oct 9, 2026
Merged via the queue into ClickHouse:master with commit 76eed28 Oct 9, 2026
152 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 9, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Oct 10, 2026
murphy-4o added a commit that referenced this pull request Oct 13, 2026
Cherry pick #123649 to 26.9: Fix distributed queries failing when Native binary type encoding is enabled
murphy-4o added a commit that referenced this pull request Oct 13, 2026
Cherry pick #123649 to 26.8: Fix distributed queries failing when Native binary type encoding is enabled
robot-clickhouse added a commit that referenced this pull request Oct 13, 2026
robot-clickhouse added a commit that referenced this pull request Oct 13, 2026
@robot-ch-test-poll robot-ch-test-poll added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Oct 13, 2026
murphy-4o added a commit that referenced this pull request Oct 13, 2026
Backport #123649 to 26.9: Fix distributed queries failing when Native binary type encoding is enabled
murphy-4o added a commit that referenced this pull request Oct 13, 2026
Backport #123649 to 26.8: Fix distributed queries failing when Native binary type encoding is enabled
JTCunning pushed a commit to JTCunning/ClickHouse that referenced this pull request Nov 3, 2026
The bugs behind their `no-parallel-replicas` / `no-replicated-database` tags are fixed on master:
- `01660_join_or_any`: ClickHouse#123683
- `04653_bloom_filter_fixed_string_constant_scalar`: ClickHouse#118988
- `04819_dynamic_aggregate_function_state_version`: ClickHouse#123649
- `04825_quantile_deterministic_alter_add_modify_column`: ClickHouse#115393, ClickHouse#123070
- `04494_atomic_populate_materialized_view_parallel_replicas`: ClickHouse#124477
- `04266_text_index_tokens_cardinality_order`: ClickHouse#124500 already disables parallel replicas for the log-checked query

Related: ClickHouse#124015
vdimir added a commit that referenced this pull request Nov 18, 2026
The change is taken as in the original (1a44640, #130895), with the adaptations below.

Adapted:
- `src/Formats/NativeReader.h`, `src/Formats/NativeReader.cpp`: the new `allowed_kinds_` parameter and the
  `allowed_kinds(allowed_kinds_)` initializer go after `block_missing_values_`, without the master-only
  `type_cache_` (`NativeReaderTypeCache`, #129831). The branch keeps its own
  `format_settings_ = std::nullopt` default.
- `src/Processors/Formats/Impl/NativeFormat.cpp` (`makeReader`): the `/*type_cache_=*/ nullptr,` argument is
  dropped. The file merged without a conflict, but would not compile as merged.
- `src/Server/TCPHandler.cpp`: the original only adds the `ISerialization::KindSet{ISerialization::Kind::DEFAULT}`
  argument; `getNativeWireFormatSettings` (#123649) is on its context lines and is not on the branch.
  `skipDataPacket` passes no format settings here, so an explicit `std::nullopt` stands in that position.
  `initBlockInput` keeps `getFormatSettings(state.query_context)`, with an explicit `nullptr` for
  `block_missing_values_` and without `type_cache_`. Both comments of the original are kept.
- `src/Interpreters/AsynchronousInsertQueue.cpp`: `IColumn::convertToFullIfWrapped` (#107773) is not on the
  branch, and `convertToFullIfNeeded` also strips `LowCardinality`. The check uses a file-local
  `hasWrappedColumn` instead: a `ColumnBLOB`, `ColumnConst`, `ColumnReplicated` or `ColumnSparse` at any
  nesting depth, `LowCardinality` left alone, nothing converted. The exception and its message are as in the
  original. The only producers of `pushQueryWithBlock` on the branch are the two calls in
  `TCPHandler::processAsyncInsertQuery`: a header without columns, and the squashed blocks that
  `initBlockInput` reads, which now accepts only the default kind.

Left out:
- `tests/queries/0_stateless/04616_replicated_serialization_oob_index_native_protocol.python` and `.reference`:
  the scenarios the branch does not have: invalid index type size, index row count mismatch, sparse over
  replicated (#114186) and huge element count (#129932). The rewrite of the two existing scenarios and the new
  `replicatedTupleElementScenario` and `replicatedOnInsertScenario` are kept, with their reference lines.
- `tests/queries/0_stateless/05473_sparse_truncated_values_native_protocol.python`, `.reference`, `.sh`: the
  original only edits this test, and it comes from #128363, which is not on the branch (modify/delete
  conflict).
- `docs/resources/develop-contribute/native-protocol/format.mdx`: the branch has no English specification of
  the `Native` format, so the hunks have nowhere to go (modify/delete conflict).

`tests/queries/0_stateless/helpers/fake_native_server.py` is as in the original here. It does not work with
the client of this branch, which sends a `Ping` before each query; the next commit adapts it.

Everything else merged without conflicts and has the same changed lines as the original.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
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... groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.8-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

output_format_native_encode_types_in_binary_format breaks the interserver Native stream for Dynamic with parallel replicas

5 participants