Repository navigation
Conversation
|
Workflow [PR], commit [971683f] Summary: ❌
AI ReviewSummaryThis PR flips the default of Findings❌ Blockers
Final Verdict
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 18/18 (100.00%) · Uncovered code |
…regation` description
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 18/18 (100.00%) · Uncovered code |
|
I'm trying to implement a complete fix in #112794 |
…r-buckets-in-aggregation
…kets_out_of_order_in_aggregation` Address review: verify that fresh sessions see `0` and that `SET compatibility = '26.7'` restores the previous default `1` via the `SettingsChangesHistory` entry under 26.8. Co-Authored-By: Claude Fable 5 <[email protected]>
| DECLARE(Float, min_os_cpu_wait_time_ratio_to_throw, 0.0, "Min ratio between OS CPU wait (OSCPUWaitMicroseconds metric) and busy (OSCPUVirtualTimeMicroseconds metric) times to consider rejecting queries. Linear interpolation between min and max ratio is used to calculate the probability, the probability is 0 at this point.", 0) \ | ||
| DECLARE(Float, max_os_cpu_wait_time_ratio_to_throw, 0.0, "Max ratio between OS CPU wait (OSCPUWaitMicroseconds metric) and busy (OSCPUVirtualTimeMicroseconds metric) times to consider rejecting queries. Linear interpolation between min and max ratio is used to calculate the probability, the probability is 1 at this point.", 0) \ | ||
| DECLARE(Bool, enable_producing_buckets_out_of_order_in_aggregation, true, R"( | ||
| DECLARE(Bool, enable_producing_buckets_out_of_order_in_aggregation, false, R"( |
There was a problem hiding this comment.
Flipping the compiled default here does not actually disable this optimization on the default secondary-query path. BaseSettings only serializes changed settings to remote servers, and MultiplexedConnections::sendQuery / HedgedConnections::sendQuery currently force-add only enable_packed_string_keys_in_aggregation, not this setting. On a mixed 26.8/25.9 cluster, an initiator that leaves enable_producing_buckets_out_of_order_in_aggregation at its new default 0 will therefore send nothing to older shards when serialize_query_plan = 0; those shards keep their own default 1, can still emit out-of-order buckets, and the distributed GROUP BY is still exposed to the wrong-result bug during rolling upgrades. This needs the same force-send treatment as enable_packed_string_keys_in_aggregation (or another cross-version fence) before the default flip is actually safe cluster-wide.
There was a problem hiding this comment.
The test, added by AI, is kind of pointless.
We can remove it and no bad things will happen.
|
Closing in favor of #112794 |
Caused by: #80179
Related: #108727
Related: #111441
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The setting
enable_producing_buckets_out_of_order_in_aggregation(introduced in 25.9) is now disabled by default. When enabled, distributed queries using memory-efficient two-level aggregation (distributed_aggregation_memory_efficient, on by default) could return incorrect results: the initiator could finalize an aggregation bucket before all its out-of-order pieces arrived, producing duplicate rows for someGROUP BYkeys. Setenable_producing_buckets_out_of_order_in_aggregation = 1to restore the previous behavior.With this setting enabled (the default since 25.9), a
GROUP BYover aDistributedtable can non-deterministically return several rows for the same key.GroupingAggregatedTransformon the initiator does not fully track buckets that arrive out of order: it can push a bucket with partial data and push the late remainder of the same bucket again, and in plans where noSortingAggregatedTransformfollows (which would instead throw the logical errorSortingAggregatedTransform already got bucketseen in #111441), the duplicate reaches the result silently.Reproducer: https://fiddle.clickhouse.com/3833ebc5-f659-4162-b8a3-369dc51011dc
This disables the optimization by default until the underlying bug is fixed (an attempt in #108727). Only the session setting's default is flipped; the
QueryPlanSerializationSettingsdefault is intentionally left as is, because serialized plans omit values equal to the default, and changing it would make older readers of new plans assume the buggy behavior is on. ASettingsChangesHistoryentry is added under 26.8 socompatibilityhandles the flip. The change should be backported to every release that has the setting (25.9+).cc: @alexey-milovidov @rschu1ze @mlex @nickitat