Skip to content

[fix] Reconcile legacy-owned native resources and BE replica drift - #538

Merged
morningman merged 1 commit into
apache:masterfrom
Al-assad:fix/native-resource-reconcile
Nov 4, 2026
Merged

morningman merged 1 commit into
apache:masterfrom
Al-assad:fix/native-resource-reconcile

Conversation

@Al-assad

@Al-assad Al-assad commented Nov 3, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Native DorisCluster Services and StatefulSets have non-controller owner references, so the default Owns handlers miss their resource events. A deleted FE Service can remain absent. Separately, a manually changed BE replica count can be hidden by an unchanged cached hash annotation.

Accept matching non-controller owners without changing existing resource metadata. In the native BE controller, verify the observed replica count after the existing hash and legacy-environment comparison. The shared comparator, CN autoscaling and DDC comparison paths remain unchanged.

Release note

Restore event-driven reconciliation of legacy-owned native Doris resources and correction of BE replica drift.

Check List (For Author)

  • Test
    • Regression test
    • Unit Test
    • Manual test
  • Behavior changed:
    • Yes. Matching legacy-owned Service/StatefulSet events now enqueue their DorisCluster; native BE replicas are restored to the CR value.
  • Does this need documentation?
    • No.

Validation:

  • go test ./... -count=1 with Kubernetes 1.31 envtest assets.
  • go vet ./...; generated manifests/deepcopy check.
  • Real API-server watch regression starts with pre-existing non-controller-owned resources, then verifies Service deletion and StatefulSet update events. Unowned resources do not enqueue a CR.
  • BE fake-client regression covers upward/downward replica drift with an unchanged hash, normal scaling, creation, repeated comparisons, and legacy environment compatibility. Replica-only updates preserve the Pod template.

Manual Kubernetes upgrade regression (master fix):

  • Start with an existing native DorisCluster created by a prior operator, preserving non-controller owners. The old operator leaves a deleted FE Service absent for 30 seconds and a BE replica drift uncorrected for 31 seconds.
  • Upgrade to the fixed operator: inherited drift is corrected; a subsequent Service deletion is recovered in about 0.8 seconds and a subsequent BE replica drift in about 0.9 seconds, with the cached hash unchanged.
  • Original FE/BE Pod UIDs and restart counts, StatefulSet Pod templates, and original PVC identities remain unchanged. A seeded table remains queryable through the recovered Service.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

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