Skip to content

Set Coordination::setCurrentComponent in prewarmCaches - #98663

Merged
antonio2368 merged 2 commits into
masterfrom
fix-prewarm-caches-component-tracking
Mar 4, 2026
Merged

antonio2368 merged 2 commits into
masterfrom
fix-prewarm-caches-component-tracking

Conversation

@antonio2368

@antonio2368 antonio2368 commented Mar 3, 2026 •

Copy link
Copy Markdown
Member

The thread pool workers spawned by prewarmCaches can end up doing ZooKeeper operations through Keeper metadata storage (e.g. when checking file existence via MetadataStorageFromKeeper). These threads did not have the component name set, causing a logical error exception: "Current component is empty, please set it for your scope using Coordination::setCurrentComponent".

https://d1k2gkhrlfqv31.cloudfront.net/clickhouse-test-reports-private/json.html?PR=51199&sha=latest&name_0=BackportPR

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.3.1.380
  • Backported to: 26.2.4.19

…l tasks

The thread pool workers spawned by `prewarmCaches` can end up doing
ZooKeeper operations through Keeper metadata storage (e.g. when checking
file existence via `MetadataStorageFromKeeper`). These threads did not
have the component name set, causing a logical error exception:
"Current component is empty, please set it for your scope using
`Coordination::setCurrentComponent`".

Capture the component name from the calling thread and propagate it
to each worker thread via an RAII guard.

https://d1k2gkhrlfqv31.cloudfront.net/clickhouse-test-reports-private/json.html?PR=51199&sha=latest&name_0=BackportPR

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@antonio2368 antonio2368 changed the title Set Coordination::setCurrentComponent in prewarmCaches thread poo… Set Coordination::setCurrentComponent in prewarmCaches Mar 3, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [dbd0eb9]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Mar 3, 2026
@antonio2368
antonio2368 added this pull request to the merge queue Mar 4, 2026
Merged via the queue into master with commit f4a9dfb Mar 4, 2026
145 checks passed
@antonio2368
antonio2368 deleted the fix-prewarm-caches-component-tracking branch March 4, 2026 14:37
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 4, 2026
@robot-clickhouse robot-clickhouse added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Mar 4, 2026
robot-clickhouse added a commit that referenced this pull request Mar 4, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Mar 4, 2026
clickhouse-gh Bot added a commit that referenced this pull request Mar 4, 2026
Backport #98663 to 26.2: Set `Coordination::setCurrentComponent` in `prewarmCaches`
pull Bot pushed a commit to AKJUS/ClickHouse that referenced this pull request Sep 29, 2026
…ment job

Since ClickHouse#110291, when a ranges refiner is set, MergeTreePrefetchedReadPool runs
refinement, the patch-range computation, MergeTreeReadTask::createReaders and
the first prefetches as one job on the prefetch pool. The Keeper component is
a thread-local, and ThreadPoolCallbackRunnerLocal carries only the thread group
across the hop, so the job runs with an empty component, while the same work
on the inline path runs under MergeTreeSource::tryGenerate.

The job checks skip-index files through IMergeTreeIndex::getDeserializedFormat
(from the refiner, from getIndexReadTaskForReadStep and from the text-index
reader). When a file is in neither checksums.txt nor skp_idx.packed, the check
reaches the disk. On a disk whose metadata storage is Keeper that is a Keeper
request, and with enforce_keeper_component_tracking it throws LOGICAL_ERROR
"Current component is empty", which aborts debug and sanitizer servers.

Capture the enqueuing thread's component and restore it as the job's first
statement, as ClickHouse#98663 does for the prewarmCaches pool jobs, so the whole job,
including its early return and any exception, runs under the component of the
read that scheduled it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo v26.2-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants