8000 List StatefulSets once per buildCR pass instead of a Get per host by shubhamkapoor01 · Pull Request #2134 · Altinity/clickhouse-operator · GitHub
[go: up one dir, main page]

Skip to content

List StatefulSets once per buildCR pass instead of a Get per host - #2134

Merged
alex-zaitsev merged 3 commits into
Altinity:0.28.0from
shubhamkapoor01:sts-list-per-pass
Nov 3, 2026
Merged

alex-zaitsev merged 3 commits into
Altinity:0.28.0from
shubhamkapoor01:sts-list-per-pass

Conversation

@shubhamkapoor01
Copy link
Copy Markdown

Fixes #2063

Each reconcile read every host's StatefulSet about 4 times before touching the first host: twice per pass, and the pass usually runs twice.
Now each pass does one live List and reuses it. For Keeper the List goes through apiReader, so it stays live like the Gets.
Hosts missing from the List, or all hosts if the List fails, are still read by name. Later status checks keep their fresh Get.

StatefulSet requests per reconcile, from the new unit tests:

before after
ClickHouse, 6 hosts, pods have IPs 24 GET 2 LIST
Keeper, 3 hosts, one pass 6 GET 1 LIST

The count tests fail on 0.28.0. go test -vet=off -race -count=1 ./pkg/... passes in golang:1.27.3.

  • All commits in the PR are squashed.
  • The PR is made into dedicated next-release branch, not into master branch.
  • The PR is signed.

buildCR read each host's StatefulSet twice per pass, in fillCurSTS and in
the status check, and the pass usually runs twice, so a reconcile did
about 4 live GETs per host before touching the first one.

Each pass now does one live List with the CR selector and both reads use
it: the clientset for CHI, apiReader (not the cache) for Keeper. A host the
List misses, or every host if it fails, is still read by name as before.
Other callers of the status check keep their fresh Get.

Fixes Altinity#2063

Signed-off-by: Shubham Kapoor <66124414+shubhamkapoor01@users.noreply.github.com>
@alex-zaitsev
alex-zaitsev self-requested a review November 3, 2026 07:18
@alex-zaitsev alex-zaitsev self-assigned this Nov 3, 2026
@alex-zaitsev
alex-zaitsev merged commit e394d79 into Altinity:0.28.0 Nov 3, 2026
2 of 3 checks passed
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.

buildCR issues one uncached StatefulSet GET per host (twice per reconcile) instead of a single List/cache

3 participants

0