8000 fix(chi): defer force restart while ClickHouse is starting by alex-zaitsev · Pull Request #2186 · Altinity/clickhouse-operator · GitHub
[go: up one dir, main page]

Skip to content

fix(chi): defer force restart while ClickHouse is starting - #2186

Draft
alex-zaitsev wants to merge 1 commit into
0.28.0from
fix/2053-defer-restart-during-startup
Draft

alex-zaitsev wants to merge 1 commit into
0.28.0from
fix/2053-defer-restart-during-startup

Conversation

@alex-zaitsev
Copy link
Copy Markdown
Member

Fixes #2053.

Problem

A configuration-driven force restart can run SYSTEM SHUTDOWN before ClickHouse has passed its startup probe. The failed shutdown falls back to scaling down the StatefulSet, interrupting metadata loading and repeating on later reconciles.

Changes

  • Inspect the live ClickHouse container (including custom names) and its startup probe before a force restart and again before its scale-down fallback. Missing status is not successful startup; transient Pod GET failures defer rather than authorize a restart. Preserve intentional stops, missing-pod recovery, known failed-container recovery, and the existing intentional StatefulSet rollout path.
  • Propagate ErrCRUDDeferred rather than silently dropping the restart requirement. Preserve the ancestor and retry after one minute using a fresh CHI read, coalesced per UID/generation; the existing PodReady recovery remains available.
  • Exclude startup from sustained-NotReady recovery, and schedule recovery when startup finishes while readiness is still false.
  • Add unit tests for the predicate, actual restart entry point, API errors, sidecar/custom names, and sustained-NotReady behavior.

Validation / remaining work

  • Compile, gofmt and run Go race/unit tests (not executed locally).
  • Add/run a replicated CHI e2e regression: delay startup, trigger a config-only restart, verify no premature pod recreation or ancestor advancement, and verify eventual completion.
  • Exercise timeout after a successful SYSTEM SHUTDOWN and verify the retry does not repeatedly restart a host when startup exceeds the operator timeout; durable per-host restart progress may be needed in that case.
  • Verify retry behavior when auto-recovery is disabled, on controller restart, and when CHI generation changes.

The default startup-probe budget and shared PodHasAllContainersStarted predicate are deliberately out of scope. This is a draft for review and CI, not a merge-ready change.

Preserve restart intent and do not scale down a pod protected by its startup probe. Retry deferred reconciliation and exclude startup from sustained NotReady recovery. Refs #2053.

This branch has not been deployed

No deployments
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.

1 participant

0