Skip to content

Improve scaling UX: even replicas, safe scale-down, sequential non write blocking scale-up #843

Description

@elderapo

MOCO works well for initial cluster creation and steady-state operation. However, changing replication settings on an existing cluster—especially adjusting the replica count—has rough edges, as outlined below. The proposals that follow aim to significantly improve this experience.

1) Allow scaling replicas down

  • Support decreasing spec.replicas.
  • Optional: allow scale to 0; delete all Pods but retain the primary’s PVC so data persists and the cluster can be restarted later. - This can be achieved by scaling down the cluster to 1 instance/replica and then setting offline: true.

2) Allow even replica counts

  • Allow even values for spec.replicas.
  • Maintain safety with a true majority for semi-sync: ceil((replicas - 1) / 2) required ACKs.
  • Rationale: does not increase fault tolerance vs the previous odd size, but enables controlled scaling under resource constraints or over time.

3) Prevent write stall during scale-up

When scaling up (e.g., 1 → 3), the controller immediately sets rpl_semi_sync_master_enabled=ON and rpl_semi_sync_master_wait_for_slave_count=floor(replicas / 2). While new replicas are being provisioned (PVC provisioning, initial clone & replication), writes do not get processed until rpl_semi_sync_master_wait_for_slave_count is satisfied. Ideally, during transitions, these replication settings should be enabled/set only when replicas are ready to satisfy them (ACK commits).

4) Sequential replica adds on scale-up

When scaling up, add replicas sequentially rather than all at once. Create a single new secondary, wait until it is ready, then create the next. The MySQL Clone plugin doesn’t support concurrent clone provisioning from a single donor anyway.

5) Rename spec.replicasspec.instances

Rename spec.replicas to spec.instances to better reflect that the field represents the total number of MySQL instances (one primary plus N secondaries), not just replicas. This change clarifies intent and avoids confusion.


I am happy to hear your thoughts. If there’s a green light from the maintainers, I’m willing to implement items 1, 2, 4, and 5; item 3 is probably best handled by someone more familiar with MOCO internals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions