Skip to content

Skip the expensive readLockParts() call in tryGetSerializationHints() - #100155

Merged
tiandiwonder merged 3 commits into
ClickHouse:masterfrom
tiandiwonder:opt_select_system_columns
Mar 25, 2026
Merged

tiandiwonder merged 3 commits into
ClickHouse:masterfrom
tiandiwonder:opt_select_system_columns

Conversation

@tiandiwonder

@tiandiwonder tiandiwonder commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

The regression was introduced by commit 4757219 (PR #73365) which added the
serialization_hint column to system.columns but unconditionally called
getSerializationHints regardless of which columns were queried.

Fix: guard tryGetSerializationHints with columns_mask[21], consistent with
the existing pattern used for column_sizes (indices 7–9). The expensive
readLockParts call is now skipped unless serialization_hint is explicitly
selected.

Changelog category (leave one):

  • Improvement

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

The expensive check is skipped if serialization_hint is not present in system.columns.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.245

unless serialization_hint is explicitly selected in system.columns.
@clickhouse-gh

clickhouse-gh Bot commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f4ee4cd]

Summary: ❌

job_name test_name status info comment
Stress test (amd_debug) failure
Logical error: Column identifier A is already registered (STID: 4697-369d) FAIL cidb, issue ISSUE CREATED
AST fuzzer (amd_debug) failure
Logical error: Unexpected return type from A. Expected B. Got C. Action: (STID: 1611-343c) FAIL cidb, issue ISSUE EXISTS

AI Review

Summary

This PR optimizes system.columns by guarding tryGetSerializationHints behind columns_mask[21], so expensive serialization-hint fetching is performed only when serialization_hint is requested. The change is small, targeted, and consistent with existing lazy-fetch logic for column_sizes. I did not find correctness, safety, compatibility, or performance regressions in the patch.

Missing context

  • ⚠️ Most CI checks are still pending (Style check, Code Review, Fast test, Build (arm_tidy)), so final validation is not yet complete.

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-ci label Mar 20, 2026
@Algunenano Algunenano self-assigned this Mar 20, 2026

@Algunenano Algunenano 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.

Please switch the changelog category to 'Improvement'. This isn't a CI related change.

Other than that it looks good

@clickhouse-gh clickhouse-gh Bot added pr-improvement Pull request with some product improvements and removed pr-ci labels Mar 23, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 83.90% 84.00% +0.10%
Functions 24.80% 24.70% -0.10%
Branches 76.50% 76.50% +0.00%

PR changed lines: PR changed-lines coverage: 100.00% (12/12, 0 noise lines excluded)
Diff coverage report
Uncovered code

@tiandiwonder

Copy link
Copy Markdown
Contributor Author

Please switch the changelog category to 'Improvement'. This isn't a CI related change.
Fixed.

@tiandiwonder
tiandiwonder requested a review from Algunenano March 24, 2026 00:29
@tiandiwonder
tiandiwonder added this pull request to the merge queue Mar 25, 2026
Merged via the queue into ClickHouse:master with commit dd1d677 Mar 25, 2026
146 of 148 checks passed
@tiandiwonder
tiandiwonder deleted the opt_select_system_columns branch March 25, 2026 06:17
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 25, 2026
robot-clickhouse pushed a commit that referenced this pull request Mar 25, 2026
…m_columns"

This reverts commit dd1d677, reversing
changes made to bdbb8bc.
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…lect_system_columns"

This reverts commit dd1d677, reversing
changes made to bdbb8bc.
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 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.

3 participants