Skip to content

Always run access cache batch-finished handlers, even on empty batch - #108124

Merged
azat merged 1 commit into
ClickHouse:masterfrom
azat:fix-access-cache-batch-retry
Jun 22, 2026
Merged

azat merged 1 commit into
ClickHouse:masterfrom
azat:fix-access-cache-batch-retry

Conversation

@azat

@azat azat commented Jun 22, 2026 •

Copy link
Copy Markdown
Member

After PR #107672 a coalesced rebuild that threw left its need_* flag set, but the retry was gated on sent_any, so sendNotifications re-ran batch handlers only on batches that delivered an event. Stale quota/role/row-policy/ settings state then persisted until an unrelated change queued a notification (an up-to-date SYSTEM RELOAD USERS diffs to zero and never retried). Run the handlers unconditionally; they early-return when idle.

Refs: #107672

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

Always run access cache batch-finished handlers, even on empty batch

Version info

  • Merged into: 26.6.1.1127
  • Backported to: 26.5.4.11, 26.4.5.72, 26.3.16.12

After PR ClickHouse#107672 a coalesced rebuild that threw left its need_* flag set,
but the retry was gated on `sent_any`, so sendNotifications re-ran batch
handlers only on batches that delivered an event. Stale quota/role/row-policy/
settings state then persisted until an unrelated change queued a notification
(an up-to-date `SYSTEM RELOAD USERS` diffs to zero and never retried). Run the
handlers unconditionally; they early-return when idle.

Refs: ClickHouse#107672

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

clickhouse-gh Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [cc61bc1]

Summary: ✅


AI Review

Summary

The PR makes AccessChangesNotifier run batch-finished handlers on every sendNotifications call, including empty batches, so pending access-cache recomputations left by a previous exception can be retried by a no-op SYSTEM RELOAD USERS. The code and focused notifier regression test match that contract; I found no code-level blocker.

PR Metadata
  • Bug Fix is the right category for stale access state after a failed cache rebuild.
  • A changelog entry is required and present, but it describes the internal handler policy rather than the user-visible behavior. Suggested replacement:

Fixes stale access caches after a failed rebuild: a later SYSTEM RELOAD USERS that detects no entity changes now retries pending role, row-policy, quota, and settings-profile recomputation instead of leaving old access state in effect until another access change.

Findings

💡 Nits

  • [PR description] The changelog entry should describe the stale access-state fix visible to users, not the internal AccessChangesNotifier batch-finished handler policy. Use the replacement text above or equivalent user-facing wording.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Jun 22, 2026
@azat azat added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Jun 22, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.30% 85.40% +0.10%
Functions 92.60% 92.60% +0.00%
Branches 77.50% 77.60% +0.10%

Changed lines: Changed C/C++ lines covered by tests: 36/36 (100.00%) | Lost baseline coverage: none · Uncovered code

Full report · Diff report

@azat
azat added this pull request to the merge queue Jun 22, 2026
Merged via the queue into ClickHouse:master with commit c323312 Jun 22, 2026
167 checks passed
@azat
azat deleted the fix-access-cache-batch-retry branch June 22, 2026 16:45
robot-ch-test-poll added a commit that referenced this pull request Jun 22, 2026
Cherry pick #108124 to 26.3: Always run access cache batch-finished handlers, even on empty batch
robot-clickhouse added a commit that referenced this pull request Jun 22, 2026
robot-ch-test-poll added a commit that referenced this pull request Jun 22, 2026
Cherry pick #108124 to 26.4: Always run access cache batch-finished handlers, even on empty batch
robot-clickhouse added a commit that referenced this pull request Jun 22, 2026
robot-ch-test-poll added a commit that referenced this pull request Jun 22, 2026
Cherry pick #108124 to 26.5: Always run access cache batch-finished handlers, even on empty batch
robot-clickhouse added a commit that referenced this pull request Jun 22, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Jun 22, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 22, 2026
alexey-milovidov added a commit that referenced this pull request Jun 24, 2026
Backport #108124 to 26.5: Always run access cache batch-finished handlers, even on empty batch
azat added a commit that referenced this pull request Jun 26, 2026
Backport #108124 to 26.4: Always run access cache batch-finished handlers, even on empty batch
azat added a commit that referenced this pull request Jun 26, 2026
Backport #108124 to 26.3: Always run access cache batch-finished handlers, even on empty batch
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jun 26, 2026
@azat azat removed the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jun 26, 2026
@robot-ch-test-poll robot-ch-test-poll added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jun 26, 2026
@azat azat removed the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jun 29, 2026
@robot-ch-test-poll robot-ch-test-poll added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jun 29, 2026
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-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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.

6 participants