Repository navigation
[Feature] Leader-aware FE upgrade behind --enable-fe-leader-aware-upgrade - #811
Open
AdheipSingh wants to merge 2 commits into
Open
AdheipSingh wants to merge 2 commits into
AdheipSingh wants to merge 2 commits into
Conversation
…rade With the default RollingUpdate strategy the StatefulSet controller replaces FE pods from the highest ordinal down and knows nothing about BDBJE roles. If the leader is not the lowest ordinal, the election its restart triggers can hand leadership to a pod that is replaced a moment later, so one upgrade causes two leader failovers. When the operator runs with --enable-fe-leader-aware-upgrade=true (Helm: starrocksOperator.enableFeLeaderAwareUpgrade), the FE StatefulSet is forced to the OnDelete strategy and the operator orders the rollout itself: on every reconcile it finds the FE pods still on the old revision, runs SHOW FRONTENDS through the FE service, and deletes exactly one pod, followers first (highest ordinal first) and the leader last. The leader is re-read on every pass, so a leadership change mid-rollout still leaves the then-current leader for the end. Nothing is deleted when SHOW FRONTENDS fails, any FE is not alive, or no single leader is reported. The flag is off by default and leaves behaviour unchanged. Also: - statefulset.Status and fe.CheckFEFullyRolledOut understand OnDelete, where the StatefulSet controller never advances CurrentRevision, by counting pods on the update revision instead. Previously an OnDelete FE StatefulSet made the status update fail on every reconcile. - A StatefulSet created by an older operator has no last-applied annotation, so the three-way merge cannot clear rollingUpdate; an explicit merge patch converts it to OnDelete first. - The MySQL SSL-mode helpers move to pkg/common/mysqlutil so the FE controller can share them with the CN controller without an import cycle; the cn package keeps its names as aliases. - RBAC gains the delete verb on pods (kubebuilder marker, config/rbac, Helm clusterrole/role, deploy/operator.yaml). - doc/fe_leader_aware_upgrade_howto.md describes the behaviour and how to turn it on. Signed-off-by: adheip <adheip@deep.bi>
…grade Right after ApplyStatefulSet creates the StatefulSet, the cached client can still report NotFound. The kind run showed this as a spurious SyncFeFailed warning on the first reconcile. The StatefulSet watch retriggers the reconcile once the cache catches up, so NotFound is now treated as nothing to do yet. Signed-off-by: adheip <adheip@deep.bi>
|
Tick the box to add this pull request to the merge queue (same as
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With the default
RollingUpdatestrategy the StatefulSet controller replaces FE pods from the highest ordinal down and knows nothing about BDBJE roles. If the leader is not the lowest ordinal, the election its restart triggers can hand leadership to a pod that is replaced a moment later, so one upgrade causes two leader failovers.This PR adds an opt-in, operator-ordered FE rollout behind
--enable-fe-leader-aware-upgrade(Helm:starrocksOperator.enableFeLeaderAwareUpgrade). It is off by default and leaves existing behaviour unchanged.When enabled:
OnDeleteupdate strategy.SHOW FRONTENDSthrough the FE service, and deletes exactly one pod: followers first (highest ordinal first), the leader last.SHOW FRONTENDSfails, any FE is not alive, or no single leader is reported.Also in this PR:
statefulset.Statusandfe.CheckFEFullyRolledOutunderstandOnDelete, where the StatefulSet controller never advancesCurrentRevision, by counting pods on the update revision instead.OnDeletefirst.pkg/common/mysqlutilso the FE controller can share them with the CN controller; thecnpackage keeps its names as aliases.deleteverb on pods (kubebuilder marker,config/rbac, Helm clusterrole/role,deploy/operator.yaml).doc/fe_leader_aware_upgrade_howto.mddescribes the behaviour and how to turn it on.Checklist
For operator, please complete the following checklist:
make generateto generate the code.make lintto check the code style.make testto run UT.make manifeststo update the yaml files of CRD.For helm chart, please complete the following checklist:
scriptsdirectory, runbash create-parent-chart-values.shto update the values.yaml file of the parent chart (kube-starrocks chart).