Skip to content

Conversation

@vagetablechicken
Copy link
Contributor

@vagetablechicken vagetablechicken commented Dec 2, 2020

Proposed changes

RebalancerType could be configured via Config.rebalancer_type(BeLoad, Partition).
PartitionRebalancer is based on TwoDimensionalGreedyAlgo.
Two dims of Doris should be cluster & partition. And we only consider about the replica count, do not consider replica size.
#4845 for further details.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

@morningman morningman added area/catalog Issues or PRs related to catalog management kind/improvement labels Dec 5, 2020
kangkaisen
kangkaisen previously approved these changes Dec 25, 2020
Copy link
Contributor

@kangkaisen kangkaisen left a comment

Choose a reason for hiding this comment

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

+1

@kangkaisen kangkaisen added the approved Indicates a PR has been approved by one committer. label Dec 25, 2020
@killxdcj
Copy link
Contributor

Will there be any balance-related modifications in the future? The new balance strategy also needs to be considered when create new partition or restore data, but I don't see the relevant changes.

@vagetablechicken
Copy link
Contributor Author

Will there be any balance-related modifications in the future? The new balance strategy also needs to be considered when create new partition or restore data, but I don't see the relevant changes.

It's only a rebalacer strategy, not include the creation or some else.

@killxdcj
Copy link
Contributor

Will there be any balance-related modifications in the future? The new balance strategy also needs to be considered when create new partition or restore data, but I don't see the relevant changes.

It's only a rebalacer strategy, not include the creation or some else.

If partition create / restore does not consider the balance strategy of the cluster, then there will be such a situation: Tablets have just been created, and then balancer finds the cluster is imbalance, and then it will do a balance on the newly created tablets.

@killxdcj
Copy link
Contributor

Will there be any balance-related modifications in the future? The new balance strategy also needs to be considered when create new partition or restore data, but I don't see the relevant changes.

It's only a rebalacer strategy, not include the creation or some else.

If partition create / restore does not consider the balance strategy of the cluster, then there will be such a situation: Tablets have just been created, and then balancer finds the cluster is imbalance, and then it will do a balance on the newly created tablets.

Another question is has the new balance strategy been verified by the production environment? We also have similar requirements and we have implemented a similar balance strategy, but now we want to switch to this community implementation.

@vagetablechicken
Copy link
Contributor Author

Another question is has the new balance strategy been verified by the production environment? We also have similar requirements and we have implemented a similar balance strategy, but now we want to switch to this community implementation.

Haven't yet, only in test env. And the production envs may have some differences. If you like, plz help me to test it. BTW, our team plans to use it in production env next month.

// 1. Every partition is balanced(maxPartitionSkew<=1) and any move will unbalance a partition, so there
// is no potential for the greedy algorithm to balance the cluster.
// 2. Every partition is balanced(maxPartitionSkew<=1) and the cluster as a whole is balanced(maxBeSkew<=1).
if (maxPartitionSkew == 0L || (maxPartitionSkew <= 1L && maxBeSkew <= 1L)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is 1 too strict here?

Copy link
Contributor Author

@vagetablechicken vagetablechicken Dec 29, 2020

Choose a reason for hiding this comment

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

The algo should get accurate calculation results. And I think there is no reason yet to relax the condition.

}

// Move completed: fromBe doesn't have a replica and toBe has a replica
private boolean checkMoveCompleted(TabletMove move) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The new replica will be added to the tablet at the beginning of clone task with state CLONE.
And the "fromBE" replica may be dropped for other reason such as "data broken on BE".

So are you sure !bes.contains(move.fromBe) && bes.contains(move.toBe) can be treated as move complete?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's hard to define, but when !bes.contains(move.fromBe) && bes.contains(move.toBe), the move is useless. So why not to treat it as completed.

}

LOG.debug("min_loaded_be: {}, max_loaded_be: {}", minLoadedBe, maxLoadedBe);
if (minLoadedBe.equals(maxLoadedBe)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use PICK_FIRST, in the case of fewer candidate sets, will there be a high probability of the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now, we only use PICK_FIRST in UTs, to get the results that can be expected.

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

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

LGTM

@morningman morningman merged commit d7a584a into apache:master Dec 31, 2020
EmmyMiao87 pushed a commit to EmmyMiao87/incubator-doris that referenced this pull request Jan 26, 2021
RebalancerType could be configured via Config.rebalancer_type(BeLoad, Partition).
PartitionRebalancer is based on TwoDimensionalGreedyAlgo.
Two dims of Doris should be cluster & partition. And we only consider about the replica count, 
do not consider replica size.
apache#4845 for further details.
@yangzhg yangzhg mentioned this pull request Feb 9, 2021
w41ter pushed a commit to w41ter/incubator-doris that referenced this pull request Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/catalog Issues or PRs related to catalog management kind/improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] suppoort PartitionRebalancer by using TwoDimensionalGreedyAlgo

5 participants