Skip to content

[Proposal] refactor the LoadBalancer to support more rebalance strategies #4763

@vagetablechicken

Description

@vagetablechicken

Is your feature request related to a problem? Please describe.
We want to add more strategies for load balance, actually for rebalance. And the new strategies may want to execute a concrete move of a replica from one server to another, a move can be described as {tablet, from_be, dest_be}. Thus, the rebalance class should support to delete the specified replica(in from_be).
So we need to define a new base class for rebalance, the origin rebalance strategy could work on it as well.

Describe the solution you'd like
The new base class, named Rebalancer.
class methods:

  • selectAlternativeTablets: use a strategy to determine which tablet to rebalance.

  • createBalanceTask: try to create a clone task for rebalance.

  • getToDeleteReplicaId: needed by the new priority "replica is src replica of rebalance" in handleRedundantReplica.The origin rebalance doesn't need to override getToDeleteReplicaId. The move-based strategies should override it.

  • updateLoadStatistic: the rebalancer may have cache, so it should be stateful. Add a method to update the load statistic.

The origin LoadBalancer, which will named as BeLoadRebalancer, just need to extend from Rebalancer without any logic change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions