Skip to content

Fix incorrect usage of shared locks. - #100796

Merged
CheSema merged 6 commits into
ClickHouse:masterfrom
sourcelliu:master
Mar 30, 2026
Merged

CheSema merged 6 commits into
ClickHouse:masterfrom
sourcelliu:master

Conversation

@sourcelliu

@sourcelliu sourcelliu commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • Improvement

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

Cache dictionaries no longer take an exclusive lock in hasKeys; this reduces lock contention by using a shared lock for cache reads.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.413

@CLAassistant

CLAassistant commented Mar 26, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CheSema CheSema self-assigned this Mar 26, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8a52a27]

Summary: ❌

job_name test_name status info comment
Stress test (amd_tsan) failure
Hung check failed, possible deadlock found FAIL cidb

AI Review

Summary

This PR updates CacheDictionary::hasKeys to use ProfiledSharedLock instead of ProfiledExclusiveLock around cache reads, aligning it with the existing read path in getColumnsImpl and reducing unnecessary lock contention. I did not find correctness, safety, or compatibility issues in the changed code path.

Missing context
  • ⚠️ Full CI results are not available yet (checks are still pending), so this review is based on code inspection only.
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Mar 26, 2026
@CheSema CheSema added the can be tested Allows running workflows for external contributors label Mar 26, 2026
@CheSema

CheSema commented Mar 27, 2026

Copy link
Copy Markdown
Member

It is OK, but I will update the branch to rerun the CI. The failed tests are expected to be fixed already.

@clickhouse-gh

clickhouse-gh Bot commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 0.00% 84.10% +84.10%
Functions 0.00% 24.50% +24.50%
Branches 0.00% 76.70% +76.70%

Full report

@CheSema
CheSema added this pull request to the merge queue Mar 30, 2026
Merged via the queue into ClickHouse:master with commit b914a15 Mar 30, 2026
148 of 149 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 30, 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 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.

4 participants