-
Notifications
You must be signed in to change notification settings - Fork 59
feat: add function to get cluster migration info #866
Conversation
if (app_id > 0) { | ||
count = ns.partition_count(app_id) - ns.primary_count(app_id); | ||
} else { | ||
count = ns.partition_count() - ns.primary_count(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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(); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base your code, vector index
means pid
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
add a function to get info used for cluster load balance