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

Commit

Permalink
feat(split): ignore splitting partition during load balance (#763)
Browse files Browse the repository at this point in the history
  • Loading branch information
hycdong authored Mar 2, 2021
1 parent ded2abd commit c53d84e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/meta/greedy_load_balancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ void greedy_load_balancer::greedy_balancer(const bool balance_checker)
ddebug_f("skip to do primary balance for the ignored app[{}]", app->get_logname());
continue;
}
if (app->status != app_status::AS_AVAILABLE || app->is_bulk_loading)
if (app->status != app_status::AS_AVAILABLE || app->is_bulk_loading || app->splitting())
continue;

bool enough_information = primary_balancer_per_app(app);
Expand Down Expand Up @@ -880,7 +880,7 @@ void greedy_load_balancer::greedy_balancer(const bool balance_checker)
continue;
}

if (app->status != app_status::AS_AVAILABLE || app->is_bulk_loading)
if (app->status != app_status::AS_AVAILABLE || app->is_bulk_loading || app->splitting())
continue;

bool enough_information = copy_secondary_per_app(app);
Expand Down
3 changes: 3 additions & 0 deletions src/meta/server_load_balancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,9 @@ bool simple_load_balancer::collect_replica(meta_view view,
const replica_info &info)
{
partition_configuration &pc = *get_config(*view.apps, info.pid);
// current partition is during partition split
if (pc.ballot == invalid_ballot)
return false;
config_context &cc = *get_config_context(*view.apps, info.pid);
if (is_member(pc, node)) {
cc.collect_serving_replica(node, info);
Expand Down
4 changes: 2 additions & 2 deletions src/meta/server_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2364,8 +2364,8 @@ bool server_state::check_all_partitions()
for (unsigned int i = 0; i != app->partition_count; ++i) {
partition_configuration &pc = app->partitions[i];
config_context &cc = app->helpers->contexts[i];

if (cc.stage != config_status::pending_remote_sync) {
// partition is under re-configuration or is child partition
if (cc.stage != config_status::pending_remote_sync && pc.ballot != invalid_ballot) {
configuration_proposal_action action;
pc_status s =
_meta_svc->get_balancer()->cure({&_all_apps, &_nodes}, pc.pid, action);
Expand Down

0 comments on commit c53d84e

Please sign in to comment.