Repository navigation
Conversation
Adding a plan setting has meant bumping `DBMS_QUERY_PLAN_SERIALIZATION_VERSION` and gating the write on it, twice already (versions 5 and 7), because the settings of a step were written as a name and a typed binary value: a reader that met a name it did not know could not tell where the value ended, so `readBinary` threw `UNKNOWN_SETTING` on it. That fenced off far more than the feature - the name is written into every plan that touches the step, so a setting the plan cannot even use made the plan unreadable to the previous release. Write them the way query settings have always travelled between client and server instead: name, flags, and the value as a string of its own length. A reader can then step over a name it does not know and keep its own default for it, and rejects the plan only when the name carries `IMPORTANT` - the flag that says ignoring the setting would change what the query returns. Both directions are chosen by the version the stream is written with, which `Serialization.cpp` already negotiates as the minimum of ours and the peer's, so a peer below version 10 keeps receiving the old form. The plan settings that decide a result rather than a way of producing it are marked `IMPORTANT` accordingly: the row and byte limits of `DISTINCT`, `ORDER BY`, `GROUP BY` and `JOIN` with their overflow modes, the two-level aggregation thresholds, `empty_result_for_aggregation_by_empty_set`, `join_any_take_last_row`, `totals_auto_threshold`, and the two settings that decide how aggregation states are laid out. The existing per-setting gates stay: they are what peers below version 10 need. A new setting after this needs a gate of its own only when it belongs in that first group. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1f1fafe to
01c704f
Compare
|
Workflow [PR], commit [9d113a9] Summary: ❌
AI ReviewSummaryThis PR switches query-plan setting serialization to the string-and-flags format used by query settings so newer plans can skip unknown non-semantic settings instead of failing on Missing context / blind spots
Findings
Final VerdictChanges requested. The mixed-version compatibility contract is not fully documented yet, and the new deserialization path will warn on the very skips it is supposed to treat as routine. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 143/143 (100.00%) · Uncovered code |
| /// Version 10 changes how the plan settings of a step are written: as name, flags and a length-prefixed | ||
| /// value, the format query settings have always used between client and server, instead of a name and a | ||
| /// typed binary value. A reader can then step over a setting it does not know, so a setting introduced | ||
| /// after this version needs a gate of its own only when the receiver ignoring it would change the |
There was a problem hiding this comment.
The new wire format only solves the UNKNOWN_SETTING problem once the negotiated plan version is already >= DBMS_MIN_QUERY_PLAN_SERIALIZATION_VERSION_WITH_SKIPPABLE_SETTINGS. If a future release adds a new “performance-only” plan setting and follows this comment literally, talking to a 25.8 peer will still negotiate version == 9, writeChangedBinary will fall back to the legacy named-binary form, and that peer will throw on the new name before it has any chance to skip it.
So post-10 settings still need a < DBMS_MIN_QUERY_PLAN_SERIALIZATION_VERSION_WITH_SKIPPABLE_SETTINGS guard for pre-10 peers; only peers that already negotiated the skippable format can rely on IMPORTANT to choose skip vs reject. Please keep that part of the contract explicit here (and in the new test comment), otherwise the next setting added under this rule will regress mixed-version distributed queries.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
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. Object file sizes6 object files changed (+19.70 KiB total), 0 added.
737 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 units262 translation units recompiled, 2353 s compile time in total, 262 of them have a recent master baseline. |
| { | ||
| impl->readBinary(in); | ||
| if (version >= DBMS_MIN_QUERY_PLAN_SERIALIZATION_VERSION_WITH_SKIPPABLE_SETTINGS) | ||
| impl->read(in, SettingsWriteFormat::STRINGS_WITH_FLAGS); |
There was a problem hiding this comment.
The new STRINGS_WITH_FLAGS path inherits BaseSettings::read, which treats every skipped unknown name as a warning via BaseSettingsHelpers::warningSettingNotFound. After this PR, though, unknown non-IMPORTANT plan settings are the expected mixed-version path. As soon as a later release adds a performance-only plan setting, every older worker will start logging Unknown settings: ... once per deserialized step/query even though the plan is supposed to be accepted silently. This needs a QueryPlanSerializationSettings-specific reader, or a suppression mode in BaseSettings::read, that still rejects unknown IMPORTANT settings but skips ignorable ones without warning-level log spam.
|
📊 Cloud Performance Report ✅ AI verdict: This PR changes how query-plan settings are serialized between nodes to a skippable string-and-flags wire format (a protocol/compatibility change). That code runs once per distributed query at plan setup and does not touch the join, aggregation, or sort operators that TPC-H Q7 and Q17 actually execute, so it cannot plausibly move their per-query timings by tens of milliseconds. Q17's flagged +57.8% is downgraded to not_sure: the change is off the query's execution path and its underlying measurements were noisy (borderline right at the top of master's variance band). Q7 stays not_sure inside master's variance band with flat CPU. No real per-query regression is attributable to this PR. clickbench🟢 No significant changes tpch_adapted_1_officialFlagged queries (2 of 22)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. Debug info
|
|
Dear @vdimir, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
Related: #114184
Adding a plan setting has meant bumping
DBMS_QUERY_PLAN_SERIALIZATION_VERSIONand gating the write on it — twice already, for versions 5 and 7 — because the settings of a step were written as a name and a typed binary value. A reader that met a name it did not know could not tell where the value ended, soQueryPlanSerializationSettings::readBinarythrewUNKNOWN_SETTING. That fenced off far more than the feature being added: the name goes into every plan that touches the step, so a setting a given plan cannot even use made that plan unreadable to the previous release. Fencing a feature is what the step registry does, by rejecting an unknown step.Plan settings are now written the way query settings have always travelled between client and server (
SettingsWriteFormat::STRINGS_WITH_FLAGS): name, flags, and the value as a string of its own length. A reader steps over a name it does not know and keeps its own default for it, and rejects the plan only when the name carriesIMPORTANT— the flag that already means "affects query results, cannot be ignored by older versions". Which form is written is decided by the version of the stream, whichQueryPlan::serializealready negotiates as the minimum of ours and the peer's, so a peer below version 9 keeps receiving the old form and nothing changes for it.The plan settings that decide a result rather than a way of producing it are marked
IMPORTANTaccordingly: the row and byte limits ofDISTINCT,ORDER BY,GROUP BYandJOINwith their overflow modes, the two-level aggregation thresholds,empty_result_for_aggregation_by_empty_set,join_any_take_last_row,totals_auto_threshold, and the two settings that decide how aggregation states are laid out. The existing per-setting gates stay — peers below version 9 still need them — but a setting added from now on needs one only when it belongs in that group.gtest_query_plan_settings_skippablecovers the round trip of every declared setting type through its string form, the old form at the previous version, an unknown setting being skipped, and an unknownIMPORTANTsetting being rejected. The 58 stateless tests that setserialize_query_planwere run against the new format locally (56 pass; two fail only for want ofs3_diskandhttps_portin the local server config).Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
A query plan serialized with
serialize_query_plan = 1no longer becomes unreadable to a peer that does not know one of the plan's settings: a setting the peer can ignore is skipped, and only one whose absence would change the query result is rejected.Workflow [PR]
Sync PR [sync-upstream/pr/115627]