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

feat(split): add query_child_state rpc #762

Merged
merged 5 commits into from
Mar 10, 2021

Conversation

hycdong
Copy link
Contributor

@hycdong hycdong commented Feb 22, 2021

When partition split starts, meta server will transfer split_status and partition_count through on_config_sync to replica server.
When meta partition_count = replica paritition_count * 2, primary parent replica will do different things according to meta_split_status:

  • meta_split_status = SPLITTING: start split
  • meta_split_status = PAUSING or meta_split_status = CANCELING: pause or cancel split
  • meta_split_status = PAUSING: split has been paused
  • meta_split_status = NOT_SPLIT: this pr solved

This pull request is solve lastest case (meta partition_count = replica paritition_count * 2 && meta_split_status = NOT_SPLIT), there will be two cases:

  1. when primary replica register child succeed, but replica server crashed, meta server will consider this parent partition not splitting, in this case, child has been registered on meta server
  2. when this parent partition is canceled, but other partitions is still canceling, in this case, child partition ballot is invalid_ballot

As above cases show, primary parent partition can not distinguish different cases, it should send a query request to meta server called query_child_state

  • If child partition is ready, meta server return ERR_OK to primary, primary will make child active and update parent group partition_count
  • If is not splitting, meta server return ERR_INVALID_STATE to primary, primary will ignore this case, it split has already canceled, just waiting for other paritions.

@hycdong hycdong marked this pull request as ready for review March 2, 2021 06:56
@neverchanje neverchanje changed the title feat(split): add query_child_stat rpc feat(split): add query_child_state rpc Mar 8, 2021
src/meta/meta_service.cpp Outdated Show resolved Hide resolved
src/meta/meta_split_service.cpp Outdated Show resolved Hide resolved
std::placeholders::_1,
response.child_config));
update_local_partition_count(response.partition_count);
_replica->_primary_states.cleanup_split_states();
Copy link
Contributor

Choose a reason for hiding this comment

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

What about move _replica->_primary_states.cleanup_split_states(); into parent_cleanup_split_context();

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 is a good recommend~ Actually, I will refactor it after I merge all function pull requests.

@foreverneverer foreverneverer merged commit c62e592 into XiaoMi:master Mar 10, 2021
@hycdong hycdong deleted the replica_failover_2_query_child branch March 10, 2021 08:53
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