Skip to content

Set thread's query id for internal queries - #97303

Closed
mstetsyuk wants to merge 2 commits into
masterfrom
set-current-thread-query-id-for-internal-queries
Closed

mstetsyuk wants to merge 2 commits into
masterfrom
set-current-thread-query-id-for-internal-queries

Conversation

@mstetsyuk

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):

In #83277, we added logging of internal queries into system.query_log. The change, however, did not set TheadStatus::query_id to the internal query's id and did not initialize query profiling. This means that for internal queries, either there are no logs in system.trace_log at all (if internal queries don't have corresponding non-internal ones) or the logs have query_id equal to the corresponding non-internal query.

This change makes sure that in both cases there are logs in system.trace_log and that the logs have query_id equal to the internal query's id.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickhouse-gh

clickhouse-gh Bot commented Feb 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c92da6f]

Summary: ❌

job_name test_name status info comment
Fast test failure
Build ClickHouse failure
Build (arm_tidy) failure
Build ClickHouse failure cidb
Build (amd_debug) dropped
Build (amd_asan) dropped
Build (amd_tsan) dropped
Build (amd_msan) dropped
Build (amd_ubsan) dropped
Build (amd_binary) dropped
Build (arm_asan) dropped
Build (arm_binary) dropped

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Feb 18, 2026
@mstetsyuk mstetsyuk changed the title set thread query id for internal queries Set thread's query id for internal queries Feb 18, 2026
@mstetsyuk
mstetsyuk marked this pull request as ready for review February 18, 2026 18:36
@mstetsyuk
mstetsyuk requested a review from azat February 18, 2026 18:36
@mstetsyuk mstetsyuk mentioned this pull request Feb 18, 2026
1 task
@azat

azat commented Feb 19, 2026

Copy link
Copy Markdown
Member

@mstetsyuk CI is failing, PTAL

@mstetsyuk
mstetsyuk marked this pull request as draft February 23, 2026 10:55
@mstetsyuk mstetsyuk closed this Mar 4, 2026
@azat

azat commented Mar 5, 2026

Copy link
Copy Markdown
Member

Are you planning on continuing it?
Or it will be replaced with a PR for dictionaries only - #98784

@mstetsyuk

Copy link
Copy Markdown
Member Author

Are you planning on continuing it?

No. Having either the parent query's ID or, if no parent query, the internal query's ID in system.trace_log.query_id is arguably good enough.

#98784 was necessary because, for dictionary reloads, system.trace_log.query_id was empty. It should not be empty for other internal queries (even for background ones that also create thread groups).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants