Skip to content

fix: auto member join for mongodb#12

Merged
zijiren233 merged 2 commits into
labring:fix/v0.9.3from
wallyxjh:fix-mongodb-ops-leader-fallback
Feb 5, 2026
Merged

fix: auto member join for mongodb#12
zijiren233 merged 2 commits into
labring:fix/v0.9.3from
wallyxjh:fix-mongodb-ops-leader-fallback

Conversation

@wallyxjh

@wallyxjh wallyxjh commented Feb 3, 2026

Copy link
Copy Markdown
Collaborator

Issue:
After directly updating Cluster replicas, MongoDB keeps only the primary; secondaries never join. Pods are Running but have no role label and the component stays Updating.

Root Cause:
memberJoin is triggered only via annotation; when scale-out is bypassed and ClusterDefinition doesn’t define memberJoin, join never runs. The detection was also too strict (Ready-only), creating a deadlock.

Fix:

  1. Auto-detect pods that should join when the annotation is empty
  2. For MongoDB, allow join even if lifecycleActions.memberJoin is not defined
  3. Relax detection to include Running pods
  4. Allow doMemberJoin to execute without explicit memberJoin config for MongoDB

Impact:
Limited to MongoDB components (CharacterType=mongodb with roleProbe builtinHandler=mongodb). Other engines are unaffected.

Code:
controllers/apps/transformer_component_workload.go

Verification:
Trigger reconcile, confirm controller logs show “detected pods to member join”, and validate pod role labels + rs.status members are complete.

Tests:
Not run (manual verification via reconcile + role labels + rs.status).

If you want, I can also provide a shorter “summary + test plan” version.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes a critical issue where MongoDB secondary pods fail to join the cluster after direct replica updates, leaving them in a Running state without role labels while the component remains in Updating status.

Changes:

  • Introduced auto-detection of pods that should join the cluster when the annotation is empty
  • Added special handling for MongoDB to enable member join operations without explicit MemberJoin lifecycle action configuration
  • Relaxed pod detection criteria to include Running pods (not just Ready pods)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread controllers/apps/transformer_component_workload.go Outdated
Comment thread controllers/apps/transformer_component_workload.go
Comment thread controllers/apps/transformer_component_workload.go
Comment thread controllers/apps/transformer_component_workload.go
Comment thread controllers/apps/transformer_component_workload.go
Comment thread controllers/apps/transformer_component_workload.go
Comment thread controllers/apps/transformer_component_workload.go Outdated
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Feb 5, 2026
@zijiren233 zijiren233 merged commit 37890fd into labring:fix/v0.9.3 Feb 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants