Repository navigation
Fix LOGICAL_ERROR on invalidate_query of a remote ClickHouse dictionary source - #129336
Conversation
…ry source The remote branch of `ClickHouseDictionarySource::doInvalidateQuery` ran the query through a `RemoteSource` with an empty header, because the result structure is not known in advance. The received columns cannot be pushed through such a port, so every periodic check failed with "Invalid number of columns in chunk pushed to OutputPort. Expected 0, found N" and the dictionary was reloaded on every check. Read the result directly from `RemoteQueryExecutor` instead, as `clickhouse-benchmark` does for a result of unknown structure. ClickHouse/clickhouse-core-incidents#2212 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Workflow [PR], commit [12caa85] Summary: ✅
AI ReviewSummaryFixes remote Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes4 object files changed (+18.77 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units11 translation units recompiled, 31 s compile time in total, 11 of them have a recent master baseline. |
|
Backport labels have been automatically added based on https://github.com/clickhouse/clickhouse-core-incidents/issues/2212 Labels added:
These labels ensure backport PRs are properly created for each affected release version. The release automation will create backport PRs as needed based on these labels. |
Backport #129336 to 26.8: Fix LOGICAL_ERROR on invalidate_query of a remote ClickHouse dictionary source
Backport #129336 to 26.9: Fix LOGICAL_ERROR on invalidate_query of a remote ClickHouse dictionary source
Backport #129336 to 26.10: Fix LOGICAL_ERROR on invalidate_query of a remote ClickHouse dictionary source
…remote ClickHouse dictionary source
…remote ClickHouse dictionary source
… remote ClickHouse dictionary source
A dictionary with
LIFETIMEis reloaded from its source on a timer. To avoid a full reload when nothing changed, the source can have aninvalidate_query: a cheap query returning a single value, for exampleSELECT max(updated_at) FROM src. On every check the result is compared with the previous one, and the dictionary is reloaded only when it differs.For a
ClickHousesource on a remote server, the invalidate query was run through aRemoteSourcewith an empty header, because the structure of the result is not known in advance: the user may write anySELECTthere. An output port validates that the number of columns in a chunk matches its header, so the received column could never be pushed through, and every check failed withSince the check never produced a value to compare, the dictionary was fully reloaded on every tick, and the logical error was written to
last_exceptionand the server log. The local case, where the source is the same server, was not affected: there the pipeline is built from the query itself and knows the result structure.The fix reads the result directly from
RemoteQueryExecutor, which passes blocks through unchanged when its header is empty, the same wayclickhouse-benchmarkreads a result of unknown structure.readInvalidateQueryis split into a shared implementation with a "next block" callback and two thin wrappers: one over aQueryPipelinefor the local, MySQL and ODBC sources, one over aRemoteQueryExecutor. The logic itself is unchanged: take the first non-empty block, require exactly one row, serialize the value to text.The new stateless test points the source at
127.0.0.2, which is not treated as a local address, so the remote path is exercised against the same server. It checks that two periodic checks after an insert that does not changemax(upd)do not reload the dictionary, that an insert with a newerupdis picked up, and thatlast_exceptionstays empty.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
invalidate_queryfor a dictionary with aClickHousesource on a remote server. Every periodic check failed with a logical errorInvalid number of columns in chunk pushed to OutputPort, so the dictionary was fully reloaded on every check instead of only when the result ofinvalidate_querychanged.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/129336]
Version info
26.11.1.1569-master(included in26.11and later)