Skip to content

Fix false LOGICAL_ERROR in filesystem cache dynamic resize - #99850

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-filecache-resize-logical-error
Mar 20, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-filecache-resize-logical-error

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Mar 18, 2026 •

Copy link
Copy Markdown
Member

During SLRU dynamic resize, concurrent tryIncreasePriority can promote entries from probationary to protected queue between eviction candidate collection and modifySizeLimits call. This causes a sub-queue to temporarily exceed its new limit, triggering a LOGICAL_ERROR exception.

Change the error code to NOT_ENOUGH_SPACE since this is an expected race condition, not a logic bug. The caller already catches exceptions and the resize will be retried on the next config reload.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=99014&sha=28ffe4d83ba90c515fa8c6cf7e4f41e6088b60b3&name_0=PR&name_1=Stress%20test%20%28amd_debug%29
#99014

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix false LOGICAL_ERROR exception during filesystem cache dynamic resize due to a race condition in SLRU sub-queue promotion.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.70

During SLRU dynamic resize, concurrent `tryIncreasePriority` can promote
entries from probationary to protected queue between eviction candidate
collection and `modifySizeLimits` call. This causes a sub-queue to
temporarily exceed its new limit, triggering a LOGICAL_ERROR exception.

Change the error code to NOT_ENOUGH_SPACE since this is an expected race
condition, not a logic bug. The caller already catches exceptions and the
resize will be retried on the next config reload.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=99014&sha=28ffe4d83ba90c515fa8c6cf7e4f41e6088b60b3&name_0=PR&name_1=Stress%20test%20%28amd_debug%29

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [90a770b]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Mar 18, 2026
@kssenii kssenii self-assigned this Mar 18, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 83.70% 83.70% +0.00%
Functions 23.90% 23.90% +0.00%
Branches 76.30% 76.20% -0.10%

PR changed lines: PR changed-lines coverage: 16.67% (1/6, 0 noise lines excluded)
Diff coverage report
Uncovered code

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This change looks very reasonable to me. How does it look to you?

@alexey-milovidov
alexey-milovidov merged commit 68ec7ae into master Mar 20, 2026
159 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-filecache-resize-logical-error branch March 20, 2026 23:38
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 21, 2026
@kssenii

kssenii commented Mar 21, 2026

Copy link
Copy Markdown
Member

This change looks very reasonable to me. How does it look to you?

Probably you forgot - I did answer about this PR in slack. I thought you'd close it yourself after that.

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

Labels

pr-bugfix Pull request with bugfix, not backported by default 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