Repository navigation
Verify settings possible range at the right place - #113787
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Workflow [PR], commit [5438acb] Summary: ❌
AI ReviewSummaryThis PR moves the upper-bound checks for Findings❌ Blockers
Suggested fix: keep the stored setting type backward-compatible ( Tests
Final VerdictNeeds changes before merge: the session-bricking fix is good, but the current LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 89/95 (93.68%) · Uncovered code |
|
@antaljanosbenjamin maybe you can review this? It should be easy |
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 sizes20 object files changed (+24.77 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 units26 translation units recompiled, 145 s compile time in total, 26 of them have a recent master baseline. |
| /// `doSettingsSanityCheckClamp` bounds these at apply time, but it does not run for | ||
| /// `ApplicationType::CLIENT`, which builds format settings of its own for every statement and | ||
| /// reaches the registry when it parses `INSERT ... FROM INFILE`. Clamp here to cover it too. | ||
| format_settings.avro.schema_registry_timeouts.connection_timeout | ||
| = std::min<UInt64>(settings[Setting::format_avro_schema_registry_connection_timeout], MAX_SCHEMA_REGISTRY_TIMEOUT_SECONDS); | ||
| format_settings.avro.schema_registry_timeouts.send_timeout | ||
| = std::min<UInt64>(settings[Setting::format_avro_schema_registry_send_timeout], MAX_SCHEMA_REGISTRY_TIMEOUT_SECONDS); | ||
| format_settings.avro.schema_registry_timeouts.receive_timeout | ||
| = std::min<UInt64>(settings[Setting::format_avro_schema_registry_receive_timeout], MAX_SCHEMA_REGISTRY_TIMEOUT_SECONDS); |
There was a problem hiding this comment.
I don't like the special handling of these settings, but I don't see a better way to fix this.
There was a problem hiding this comment.
Then what should we do?
There was a problem hiding this comment.
The apply-time clamp looks like the right place for the upper bound, because the failure only becomes user-visible after these values have been stored in session state and later reused by unrelated statements.
What I would still avoid is changing the existing settings to NonZeroUInt64: Context::setCurrentProfilesWithLock applies profile / users.xml values before any clamp runs, so a historical 0 now turns into a profile-load failure. Keeping the stored type compatible and enforcing the bounds at the same application boundary would preserve the fix without breaking persisted configs.
There was a problem hiding this comment.
I asked Pavel, who is the most experienced in formats to take a look at it. We can merge it as is if he also cannot find a better way to handle it.
|
@antaljanosbenjamin all the CI failures seem unrelated, so you can continue the review |
antaljanosbenjamin
left a comment
There was a problem hiding this comment.
Some minor things to change @groeneai:
- [src/Client/BuzzHouse/Generator/SessionSettings.cpp:2247] The BuzzHouse generator still picks 0 from the choices for format_avro_schema_registry_retry_initial_backoff_ms. With the type now NonZeroUInt64, that value is guaranteed to fail at SET time, producing pure noise in fuzz runs. The file already has a nonzero_bytes_values list for exactly this reason (line 1930). Suggested fix: drop 0 from {0, 1, 10, 100, 1000}.
- [PR description] Changelog entry quality: setting names and SET should be wrapped in inline code blocks per the changelog guidelines. Suggested replacement: "Fix SET temporary_files_buffer_size or format_avro_schema_registry_* to an out-of-range value making every subsequent query in the session fail, with no way to recover; the values are now bounded when they are set."
Some notes that worth to mention but I agree with AI that it doesn't need to be addressed:
- The UInt64 → NonZeroUInt64 type change means a server config profile containing format_avro_schema_registry_*_timeout = 0 or ..._retry_initial_backoff_ms = 0 now fails at profile load (server startup) instead of at query time. I consider this acceptable: such a configuration previously made every format-touching query fail, the settings are recent (26.5/26.6), failing fast is the fail-close behavior, and the same semantics already apply to established NonZeroUInt64 settings like max_block_size and max_read_buffer_size. No compatibility gate needed, but worth being aware of.
- The upper bounds changed from reject to silent clamp. This is a deliberate part of the fix (a rejection at read time is exactly what bricked sessions), it follows the established MAX_SANE_READ_BUFFER_SIZE clamp pattern, logs a warning, and the new behavior is documented in every setting description and doc page. No versioning concern: settings travel as name=value strings.
|
@groeneai please also change the changelog category to backward incompatible change |
The PR is from me? 😄 |
|
The BuzzHouse setting should already be fixed on master. Running CI one more time |
Wupsy, sorry Pedro, I was reviewing quite some groene AI PRs and probably got confused. Sorry. I was surprised it is quite good PR compared to a groene ai PR, but this explains why 😄 |
|
@antaljanosbenjamin both CI failures are unrelated and address the review comments. You give the final word |
| /// is clamped to it by `doSettingsSanityCheckClamp`. | ||
| inline constexpr UInt64 MAX_TEMPORARY_FILES_BUFFER_SIZE = 1_GiB; | ||
|
|
||
| /// Bounds for the Confluent Schema Registry client. `doSettingsSanityCheckClamp` applies them to |
There was a problem hiding this comment.
This very central setting header is definitely not the right place for schema registry defines.
There was a problem hiding this comment.
Open a PR to change this?
There was a problem hiding this comment.
@groeneai Open a PR which moves constants MAX_SCHEMA_REGISTRY_TIMEOUT_SECONDS, MAX_SCHEMA_REGISTRY_RETRIES, and MAX_SCHEMA_REGISTRY_INITIAL_BACKOFF_MS to src/Core/Defines.h. Make no mistakes.
There was a problem hiding this comment.
Acknowledged. I will open a PR moving the three constants to src/Core/Defines.h and link it here.
There was a problem hiding this comment.
Opened #118953: a pure move of the three constants, comment included, with the values and the explicit UInt64 type unchanged. The one adapted token is inline constexpr -> static constexpr, matching the rest of Defines.h; happy to switch it back.
There was a problem hiding this comment.
Thanks Robert, good find!
`MAX_SCHEMA_REGISTRY_TIMEOUT_SECONDS`, `MAX_SCHEMA_REGISTRY_RETRIES` and `MAX_SCHEMA_REGISTRY_INITIAL_BACKOFF_MS` were added to `src/Core/SettingsQuirks.h` by ClickHouse#113787. As @ rschu1ze pointed out while reviewing that PR, "this very central setting header is definitely not the right place for schema registry defines", and he asked for them to be moved to `src/Core/Defines.h`, which is where this project keeps its named magnitude constants. Requested in ClickHouse#113787 (comment) The three definitions move together with the comment block that explains why the same bounds are applied at two sites. Values (599, 20, 60000), the explicit `UInt64` type and the enclosing `namespace DB` are unchanged, so both consumers see exactly what they saw before. The storage-class specifier is the one adapted token: `inline constexpr` becomes `static constexpr`, matching the destination file, which uses `static constexpr` for all 103 of its existing constants and has never contained an `inline constexpr` one. It is semantically inert here because nothing takes the address of these constants; both consumers read them by value. The explicit `UInt64` is deliberately kept rather than switching to the `auto` most of `Defines.h` uses, because `auto` on `599` would deduce `int` and change the type at the `std::min<UInt64>` and `CHECK_SETTING_MAX_VALUE` sites. `SettingsQuirks.cpp` needs no change; it already includes `<Core/Defines.h>`. `FormatFactory.cpp` had been reaching the constants through its `<Core/SettingsQuirks.h>` include and uses nothing else from that header, so the include is replaced by `<Core/Defines.h>`. Co-Authored-By: Claude Opus 5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix setting
temporary_files_buffer_sizeorformat_avro_schema_registry_*to an out-of-range value making every subsequent query in the session fail, with no way to recover; the values are now bounded when they are set.Closes: #113782
Workflow [PR]
Sync PR [sync-upstream/pr/113787]