Skip to content

Make text_log.level reloadable - #127718

Merged
alexey-milovidov merged 6 commits into
ClickHouse:masterfrom
nikita-vanyasin:text-log-level-reloadable
Nov 1, 2026
Merged

alexey-milovidov merged 6 commits into
ClickHouse:masterfrom
nikita-vanyasin:text-log-level-reloadable

Conversation

@nikita-vanyasin

@nikita-vanyasin nikita-vanyasin commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

text_log.level can now be changed without a server restart; it is re-applied on configuration reload like the other logger levels.

Documentation entry for user-facing changes

An explicitly configured text_log.level is applied on SYSTEM RELOAD CONFIG. Enabling or disabling text_log itself still requires a restart.

Details

Follow-up to #127717, which made Loggers::updateLevels include an explicitly configured text_log.level in the root logger level. Until now the level was read only at startup in Loggers::buildLoggers, so operators had to restart the server to change how much reaches system.text_log, while logger.level, console_log_level, errorlog_level and syslog_level are all reloadable.

This adds OwnSplitChannelBase::setTextLogLevel(int) (implemented for both the synchronous and the asynchronous split channel by updating the atomic text_log_max_priority) and calls it from updateLevels when text_log.level is set in the configuration. The asynchronous channel only applies the new level when its text_log consumer thread exists, which is the case whenever text_log was configured at startup with a level other than none.

The integration test test_text_log_level_after_reload keeps the file log at trace and checks, on both an asynchronous and a synchronous node, that the text_log sink filters messages on reload (information, trace, none, and a removed level), and that messages accepted before a reload to none are still flushed.

Removing text_log.level from the configuration reapplies the default trace threshold to the sink, as after a restart. For the asynchronous channel, the text_log consumer keeps running after a reload to none, so SYSTEM FLUSH LOGS and shutdown still drain messages accepted before the reload.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/127718]

Version info

  • Merged into: 26.11.1.1017-master (included in 26.11 and later)

text_log.level was read only in Loggers::buildLoggers, so changing it
required a server restart, unlike logger.level, console_log_level,
errorlog_level and syslog_level, which are re-applied by
Loggers::updateLevels on every configuration reload.

Add OwnSplitChannelBase::setTextLogLevel and call it from updateLevels, so
that a changed text_log.level takes effect on SYSTEM RELOAD CONFIG. The
text_log channel itself (queue and background thread) is still created at
startup; turning text_log on or off at runtime is not covered.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [334804c]

Summary: ✅


AI Review

Summary

PR #127718 makes text_log.level reloadable for sinks enabled at startup, restores the default threshold when the explicit level is removed, and preserves flushing after a reload to none. Reviewed revision 334804c629108c979c7278fab19683abc78f1e4c, including all prior discussion. The earlier findings are addressed; no new actionable findings remain.

Missing context / blind spots
  • ⚠️ CI is still running for the reviewed revision. The updated integration tests were inspected but were not run locally because this checkout has no built server binary. Successful execution of test_text_log_level_after_reload would close this validation gap.
Final Verdict

Status: ✅ Approve. No code changes requested; the current revision still needs its CI results.

@clickhouse-gh clickhouse-gh Bot added pr-improvement Pull request with some product improvements comp-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). labels Oct 24, 2026
@nikita-vanyasin

Copy link
Copy Markdown
Member Author

@nerve-bot WDYT?

Comment thread src/Loggers/Loggers.cpp Resolved
Comment thread src/Loggers/OwnSplitChannel.cpp Resolved
@nikitamikhaylov nikitamikhaylov added the can be tested Allows running workflows for external contributors label Oct 24, 2026
Comment thread src/Loggers/Loggers.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 334804c62 with master c189bd99f (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 1ee49128d; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

18 translation units recompiled, 96 s compile time in total, 17 of them have a recent master baseline.

Translation units without a recent master baseline:

  • programs/keeper/Keeper.cpp (clickhouse-keeper): 6.9 s

Job report

@azat azat self-assigned this Oct 26, 2026
@alexey-milovidov
alexey-milovidov marked this pull request as ready for review October 31, 2026 18:11

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexey-milovidov alexey-milovidov self-assigned this Oct 31, 2026
alexey-milovidov and others added 2 commits November 1, 2026 10:06
… after reload to `none`

- When `text_log.level` is removed from an existing `text_log` section, `updateLevels`
  now reapplies the default `trace` threshold to the sink (as after a restart), while
  the root logger level is still raised only for an explicit value.
- `OwnAsyncSplitChannel` remembers that its `text_log` consumer was started. A later
  reload to `none` keeps serving the `flushTextLogs` handshake, so messages accepted
  before the reload are still persisted by `SYSTEM FLUSH LOGS` and on shutdown, and
  `open` restarts the consumer after `remapExecutable` so the level can be raised again.
- The integration test now keeps the file log at `trace` so the sink threshold is tested
  independently of the root logger, covers both the synchronous and the asynchronous
  channel, the removal of the explicit level, and draining across a reload to `none`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…adable

# Conflicts:
#	src/Loggers/Loggers.cpp
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 1, 2026
Merged via the queue into ClickHouse:master with commit 8ea88c9 Nov 1, 2026
179 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants