Skip to content

fix: mongodb leader fallback and single-member reconfig#17

Merged
zijiren233 merged 1 commit into
labring:fix/v0.9.3from
wallyxjh:fix-old-mongo-scale
Apr 8, 2026
Merged

fix: mongodb leader fallback and single-member reconfig#17
zijiren233 merged 1 commit into
labring:fix/v0.9.3from
wallyxjh:fix-old-mongo-scale

Conversation

@wallyxjh

@wallyxjh wallyxjh commented Mar 6, 2026

Copy link
Copy Markdown
Collaborator

Summary
Fix MongoDB scale-in failures (cluster has no leader) in KB 0.9.x by adding leader fallback, single-member reconfig, and join-member de-dup logic in lorry.

What changed

  • Fallback to replset client when DCS leader lease is missing/expired.
  • Force reconfig after scale-in to a single member to ensure electable primary.
  • De-duplicate hosts on join to avoid NewReplicaSetConfigurationIncompatible.

Why
In KB 0.9.x the MongoDB HA loop is disabled, so leader leases are not renewed. Scale-in operations that depend on a leader fail and can leave the cluster stuck in Updating. Single-member replicasets can also
remain SECONDARY without a forced reconfig.

Scope

  • Affects MongoDB lorry logic only.
  • No changes to MySQL/PG/Redis.

Validation

  • Scale-in from 3→1 completes without cluster has no leader.
  • Single-member replset becomes PRIMARY.
  • Scale-out/join no longer fails with duplicate host errors.

@wallyxjh wallyxjh force-pushed the fix-old-mongo-scale branch from 1b0526f to e773f9f Compare April 8, 2026 08:25
@zijiren233 zijiren233 merged commit e1a0bbb into labring:fix/v0.9.3 Apr 8, 2026
3 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.

2 participants