Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat: add function to get cluster migration info #866

Merged
merged 8 commits into from
Aug 2, 2021

Conversation

levy5307
Copy link
Contributor

@levy5307 levy5307 commented Jul 27, 2021

add a function to get info used for cluster load balance

@levy5307 levy5307 merged commit 4bddefe into XiaoMi:master Aug 2, 2021
src/meta/greedy_load_balancer.cpp Show resolved Hide resolved
if (app_id > 0) {
count = ns.partition_count(app_id) - ns.primary_count(app_id);
} else {
count = ns.partition_count() - ns.primary_count();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
count = ns.partition_count() - ns.primary_count();
count = app_id > 0 : ns.partition_count(app_id) - ns.primary_count(app_id) : ns.partition_count() - ns.primary_count();

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 too complex to use ternary expression. I don't think it's a good idea

return (uint32_t)count;
}

uint32_t get_skew(const std::map<rpc_address, uint32_t> &count_map)
Copy link
Contributor

Choose a reason for hiding this comment

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

get_diff or get_range?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

skew is more accurate

{
int32_t app_id;
std::string app_name;
std::vector<std::map<rpc_address, partition_status::type>> partitions;
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

src/meta/greedy_load_balancer.h Show resolved Hide resolved
src/meta/greedy_load_balancer.h Show resolved Hide resolved
src/meta/greedy_load_balancer.cpp Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants