Repository navigation
clickhouse local: respect --logger.level and stop progress packets from starving the result pull - #121053
clickhouse local: respect --logger.level and stop progress packets from starving the result pull#121053qoega wants to merge 4 commits into
Conversation
`clickhouse local` accepts `--logger.level` on the command line (and from a config file) but `processConfig` computed the console log level only from `--log-level` and `send_logs_level`, defaulting to `trace`, and overwrote `logger.level` with it. So `clickhouse local --logger.console=1 --logger.level=fatal` printed every trace message. Found while running `json_ast_sql_execution_fuzzer`, whose logs grew to 300 MB per worker in two hours. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Workflow [PR], commit [44fbdbc] Summary: ❌
|
|
I had the same one-line change queued from your issue, with the same precedence order, so I am not opening a competing PR. Yours is the one to land. Two measured things about the source change that this PR does not carry yet. This change makes The remedy is one element in local_opts=(
"--config-file=$SAFE_DIR/config.xml"
+ "--log-level=none"
"--send_logs_level=none")It restores the reference on an unpatched binary as well as a patched one, so it is safe to carry here and does not depend on the fix landing with it. 50/50 clean.
Coverage. |
…es not spam the console Before the previous commit, LocalServer overwrote logger.level with the fallback default, so `<level>trace</level>` in the config file was silently ignored and the test's `--send_logs_level=none` was the only thing keeping the console clean. Now that logger.level is honored, the config-level trace setting starts printing every server startup log to the console. The test is about the `--config-file` option; drop the accidental trace level and use `fatal` so the fix does not fight the test's intent. Co-Authored-By: Claude Opus 4.7 <[email protected]>
| echo "<clickhouse> | ||
| <logger> | ||
| <level>trace</level> | ||
| <level>fatal</level> |
There was a problem hiding this comment.
This fixes 02360, but it also means the suite still never proves the config-file carrier that the PR body and the linked issue call out explicitly. With <logger><level>fatal</level> here and --send_logs_level=none below, both the buggy and fixed binaries stay silent, so this test no longer distinguishes whether LocalServer::processConfig actually consults logger.level from the config file. 05235 only exercises the CLI --logger.level path.
Please add a case where the config file sets <logger><level> to the opposite of send_logs_level (for example fatal vs trace) so the old code fails and the new code passes.
…interactive_delay is tiny `LocalConnection::poll` returned a `Progress` packet whenever more than `interactive_delay` microseconds had passed since the previous one, before trying to pull a block. With `interactive_delay` shorter than a poll cycle (0 or 1) that was always the case, so `SELECT 1 SETTINGS interactive_delay = 0` spun at 100% CPU forever in `clickhouse local`. Progress and profile-event packets are now sent at most once per pull attempt. Found by `json_ast_sql_execution_fuzzer`. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Verified commit 3 against master, and one thing it leaves open. Both directions. Master The pull timeout still truncates to zero. Measured on this branch with
The discontinuity between 999 and 1000 is the truncation. Log delivery collapses the same way: with The TCP half comes from Your call whether that belongs in this PR or separately. I am not opening a competing PR for the starvation fix, yours is the one to land; I can send the floor as its own PR if you would rather keep this one narrow. |
…lisecond `interactive_delay` is in microseconds and the executors take milliseconds; a value below 1000 truncated to a blocking pull in `LocalConnection` and `TCPHandler`, so the first cancel was noticed only after the query. Test 02360 passes `--log-level=none` now that the configured `logger.level` is honoured, and 05235 covers the config-file level and the `--log-level` override order. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Review follow-up landed as
|
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Two
clickhouse localfixes:--logger.level(and the config file's<logger><level>) is now honored; previously it was accepted but ignored, and the process always logged attrace, producing hundreds of MB of log output for long-running workloads.interactive_delayset to 0 or a value below the poll cycle no longer hangs at 100% CPU: progress and profile-event packets are now sent at most once per pull attempt, so the pull cannot be starved.Documentation entry for user-facing changes
No documentation change needed.
Detailed description / Documentation
Commit 1 —
--logger.levelhonored (e2d59fc1231).LocalServer::processConfigcomputed the console log level only from--log-levelandsend_logs_level, defaulting totrace, and overwrotelogger.levelwith it.clickhouse local --logger.console=1 --logger.level=fatalprinted every trace message. Test05235.Commit 2 —
02360reference adjustment (58d6434f622).The old code's confused lookup chain let
02360_clickhouse_local_config-optionpass with<level>trace</level>in the config plus--send_logs_level=noneon the command line. Now thatlogger.levelis honored, use<level>fatal</level>in that test's inline config; the test is about the--config-fileoption and does not need trace logging.Commit 3 —
interactive_delaystarvation fix (00802165e78).LocalConnection::pollsent a progress packet wheneverinteractive_delaymicroseconds had passed since the previous one, before trying to pull a block. Withinteractive_delayshorter than a poll cycle (0 or 1) that was always the case, soSELECT 1 SETTINGS interactive_delay = 0spun at 100% CPU forever. Progress and profile-event packets are now sent at most once per pull attempt. Test05246(renumbered from the branch's05243to avoid collision with the JSON-AST hardening PR's05243).Both fixes surfaced from the
json_ast_sql_execution_fuzzercampaign; without commit 1, worker logs grew to ~300 MB per hour, and finding 20 (commit 3) hung a worker for 73 s before the libFuzzer alarm.Closes: #121022
Closes: #121076
cc @groeneai — fuzz-lab find (JSON AST fuzzer)
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/121053]