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

feat(split): add update_child_group_partition_count #645

Merged
merged 4 commits into from
Oct 28, 2020

Conversation

hycdong
Copy link
Contributor

@hycdong hycdong commented Oct 21, 2020

Simple partition split process

  1. meta receives client partition split request, and change partition count split: meta start partition split #286
  2. replica notices partition count changed during on_config_sync
  3. parent partition create child partition split: parent replica create child replica #291
  4. parent prepare states for child to learn feat(split): parent replica prepare states #299
  5. child partition async learn states from parent feat(split): child replica learn parent prepare list and checkpoint #309 feat(split): child replica apply private logs, in-memory mutations and catch up parent #319
  6. child notify parent catch up feat(split): child notify parent catch up #390
  7. update child group partition count
  8. register child partition feat(split): register child partition #391
  9. update parent group partition count

More partition split discussion in issue #69 and partition split design doc
This pr solves the part of seventh step of partition split, which is bold in process description.

What this pr solve

When all children have caught up its parent's state, parent will send rpc to child to let them update partition count, child will update its partition count in memory and update .app_info file on disk. If all children update partition_count succeed, it will send register child rpc to meta server. Besides, this pr also adds related unit tests.

@hycdong hycdong marked this pull request as ready for review October 21, 2020 04:42
Comment on lines +656 to +663
_stub->split_replica_error_handler(
_child_gpid,
std::bind(&replica_split_manager::child_handle_split_error,
std::placeholders::_1,
"update_child_group_partition_count failed, "
"wrong partition status or split status"));
_replica->_primary_states.sync_send_write_request = false;
parent_cleanup_split_context();
Copy link
Member

Choose a reason for hiding this comment

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

Seems there are some similar code on error handling paths, could you do some refactor?

Copy link
Contributor Author

@hycdong hycdong Oct 21, 2020

Choose a reason for hiding this comment

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

Yes, split error handling has little difference in different error cases, I will refactor it after I merge split core implementation.

acelyc111
acelyc111 previously approved these changes Oct 27, 2020
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