Skip to content

[BugFix] Drop FE nodes removed by a scale-in from the FE cluster - #809

Closed
Mohith26 wants to merge 1 commit into
StarRocks:mainfrom
Mohith26:fe-scale-in-drop-frontends
Closed

Mohith26 wants to merge 1 commit into
StarRocks:mainfrom
Mohith26:fe-scale-in-drop-frontends

Conversation

@Mohith26

@Mohith26 Mohith26 commented Nov 4, 2026

Copy link
Copy Markdown

Description

Fixes #789. Lowering starRocksFeSpec.replicas only shrinks the FE StatefulSet. The removed FE stays in SHOW FRONTENDS as a dead BDBJE group member, which blocks BDBJE journal cleanup, so fe-meta grows until FE runs out of disk (4.8 GB of .jdb files and a CrashLoopBackOff in the issue).

This does for FE what #663/#714 do for CN. At the end of SyncCluster (skipped in disaster recovery mode), once the scale-in has settled (the StatefulSet matches the expected one and runs exactly replicas pods, all ready, on the update revision, with ordinals 0..replicas-1), the FE controller runs SHOW FRONTENDS and drops every frontend that:

  • has a host that is the FQDN of a pod of this StatefulSet (<sts>-<n>.<search svc>.<ns>.) with n >= replicas,
  • is reported as not alive,
  • is not the leader.

It uses ALTER SYSTEM DROP FOLLOWER or DROP OBSERVER based on the role. If the in-range pods do not all show up by FQDN, it does nothing, so FEs added by hand, other StatefulSets and non-FQDN setups are never touched. Like the CN cleanup, failures are logged and retried on the next reconcile.

One extra step: before the DROP it deletes the removed pod's FE meta PVC (the volume claim template mounted at the FE meta dir). StatefulSets keep PVCs on scale-in, and a dropped FE cannot rejoin with its old meta (StarRocks requires an empty meta dir plus --helper). Without this, scaling 3 to 2 and later back to 3 would leave fe-2 crash looping. With an empty meta volume, fe_entrypoint.sh takes the start_fe_no_meta path and runs ALTER SYSTEM ADD FOLLOWER itself. Deleting first keeps both steps retryable: a NotFound PVC is ignored, and the frontend stays listed until the DROP succeeds. This needs delete on persistentvolumeclaims, added to the ClusterRole, Role, config/rbac and deploy/operator.yaml. Only delete is needed because the PVC is deleted by name, not listed through the cache. I'm happy to put the PVC part behind a flag if you'd rather keep it opt-in.

The SSL helpers (cn_mysql_ssl.go) moved unchanged to the fe package, since cn already imports fe and the FE controller needs the same --fe-ssl-mode handling. doc/scale_in_fe_nodes_howto.md now describes the automatic step and keeps the manual procedure.

How I tested: unit tests with sqlmock and the fake client for the parsing, selection rules, PVC cleanup, retry after a failed DROP, and every not-settled case (no SQL is sent and nothing is deleted). I also ran the full make test package list with envtest 1.25, golangci-lint v2.2.2 (0 issues) and helm template on the chart. I haven't run it against a live StarRocks cluster.

Related Issue(s)

#789

Checklist

For operator, please complete the following checklist:

  • run make generate to generate the code. (no API changes)
  • run make lint to check the code style.
  • run make test to run UT.
  • run make manifests to update the yaml files of CRD. (no CRD changes; RBAC files updated by hand)

For helm chart, please complete the following checklist:

  • make sure you have updated the values.yaml
    file of starrocks chart. (no values changes)
  • In scripts directory, run bash create-parent-chart-values.sh to update the values.yaml file of the parent
    chart( kube-starrocks chart). (not needed)

@CLAassistant

CLAassistant commented Nov 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Lowering starRocksFeSpec.replicas only shrinks the StatefulSet. The removed
FE stays in SHOW FRONTENDS as a dead BDBJE group member, which blocks BDBJE
journal cleanup until fe-meta runs out of disk (#789).

Once the scale-in has settled, the FE controller now drops each frontend
that belonged to a removed pod, is not alive and is not the leader, and
deletes that pod's FE meta PVC first so a later scale-out can rejoin with
an empty meta dir. The FE SSL helpers move from cn to fe (cn imports fe).

Signed-off-by: Mohith26 <109003762+Mohith26@users.noreply.github.com>
@Mohith26
Mohith26 force-pushed the fe-scale-in-drop-frontends branch from 12e5b4b to 83820d3 Compare November 4, 2026 03:52
@Mohith26 Mohith26 closed this by deleting the head repository Nov 17, 2026
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.

FE nodes not deregistered from BDBJE replication group when scaling down replicas

2 participants