Skip to content

fix: wait for keeper followers to sync before updating the next replica - #402

Merged
GrigoryPervakov merged 1 commit into
mainfrom
fix/keeper-rollout-synced-followers
Dec 4, 2026
Merged

GrigoryPervakov merged 1 commit into
mainfrom
fix/keeper-rollout-synced-followers

Conversation

@GrigoryPervakov

@GrigoryPervakov GrigoryPervakov commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Why

A rolling upgrade of the keeper cluster can restart the next replica while the just-restarted one is not yet up to date.

What

The leader reports NotReadyUpToDate while zk_synced_followers < zk_followers


Workflow [PR]


Note

Medium Risk
Changes keeper rolling-update gating logic; misreading or strict parsing of zk_synced_followers could stall upgrades or allow unsafe progression.

Overview
Fixes keeper rolling upgrades advancing to the next replica while a restarted peer is still catching up on the leader.

Leader health probing now reads zk_synced_followers from the mntr response and stores it on serverStatus. UpdateStage treats a leader with SyncedFollowers < Followers as StageNotReadyUpToDate, evaluated before spec/revision diff, so an outdated leader also blocks further restarts until followers sync.

The reconcile loop handles StageNotReadyUpToDate with an immediate requeue (probe poll) instead of continuing into replica update selection, avoiding pending leader changes while quorum sync is incomplete. Tests cover mntr parsing, update-stage classification, and that reconcileReplicaResources does not roll the leader when followers are unsynced.

Reviewed by Cursor Bugbot for commit 2f91c0e. Bugbot is set up for automated code reviews on this repo. Configure here.

@clickhouse-operator

clickhouse-operator Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [2f91c0e]

Summary: ✅


Code Review

Result: ✅ No issues found

What changed: Adds parsing of the Keeper leader’s zk_synced_followers metric and uses it to pause rolling updates while any connected follower is still catching up. The reconciler now requeues without updating replicas when this synchronization gate is active, with unit coverage for parsing and rollout behavior.

No issues found. The synchronization check is evaluated before revision differences, and the dedicated StageNotReadyUpToDate handling correctly prevents an outdated leader or the next replica from being updated until connected followers are synchronized.

Investigation: 8/13 rounds, 43 tool calls.

Comment thread internal/controller/keeper/sync.go Resolved
@GrigoryPervakov
GrigoryPervakov force-pushed the fix/keeper-rollout-synced-followers branch from 7911e17 to 1fd7066 Compare December 1, 2026 16:38

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread internal/controller/keeper/sync.go Resolved
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

AI review gate — AI review findings accepted by a maintainer

The reviewer reported findings on this commit. Each of the 2 on the current code was answered and resolved by a maintainer: @GrigoryPervakov.

The leader reports NotReadyUpToDate while zk_synced_followers < zk_followers,
so the rollout does not restart the next replica while a restarted follower
is still catching up with the leader log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GrigoryPervakov
GrigoryPervakov force-pushed the fix/keeper-rollout-synced-followers branch from 1fd7066 to 2f91c0e Compare December 4, 2026 14:05

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread internal/controller/keeper/sync.go Resolved
@GrigoryPervakov

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2f91c0e. Configure here.

@security-ai-gate-reviewer

security-ai-gate-reviewer Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

AI review gate — auto-approved

2f91c0e62927 is approved by security-ai-gate-reviewer[bot], an automated identity, not a human. The approval stands on the required AI review: Cursor Bugbot concluded green on this commit and the AI review gate is SUCCESS (its own comment has the verdict), and the change touches no path that requires a human reviewer. It covers this diff only: after a push that changes it, the approver evaluates the new head and approves it only if it is green.

History (latest 5 heads, newest first)

  • 2f91c0e62927 approved — green: Cursor Bugbot

@GrigoryPervakov

Copy link
Copy Markdown
Member Author

/ai-gate check

@GrigoryPervakov
GrigoryPervakov merged commit f670d5a into main Dec 4, 2026
33 of 38 checks passed
@GrigoryPervakov
GrigoryPervakov deleted the fix/keeper-rollout-synced-followers branch December 4, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants