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

feat(split): add child copy mutation synchronously #727

Merged
merged 7 commits into from
Feb 26, 2021

Conversation

hycdong
Copy link
Contributor

@hycdong hycdong commented Jan 14, 2021

What this pull request solves

During partition split, parent partition should send mutation to child partition, child will copy this mutation and prepare it. This pull request is about child partition copying mutations synchronously.(async-learn: #676)
When all child partitions caught up its parent, primary parent will set sync_send_write_request=true(#390), then each mutation parent received should wait for child prepare it succeed until this value is false.

Difference between normal 2pc and 2pc in sync-learn

  • In normal write 2pc:
    • secondary: reply ack to primary when prepare succeed
    • primary: commit mutation when prepare succeed and receive all secondaries ack
  • In sync-learn 2pc:
    • secondary: reply ack to primary when both its child partition and itself prepare succeed
    • primary: commit mutation when both its child partition and itself prepare succeed and receive all secondaries ack

Other details

  • For those mutations should be copied sychronously, its _is_sync_to_child = true, will be set in init_prepare and on_prepare.
  • For child partition, after it prepared mutation, it would append it into shared log, sent ack to parent and appended it into private log
  • Add _wait_child to avoid secondary parent reply to primary parent without waiting for its child prepare succeed, also avoid primary parent commit without waiting for its child prepare succeed
  • Add _is_error_acked to avoid reply twice when secondary partition prepare failed

@hycdong hycdong marked this pull request as ready for review February 18, 2021 02:37
src/replica/mutation.h Outdated Show resolved Hide resolved
neverchanje
neverchanje previously approved these changes Feb 22, 2021
neverchanje
neverchanje previously approved these changes Feb 23, 2021
src/common/metadata.thrift Outdated Show resolved Hide resolved
src/replica/mutation.h Show resolved Hide resolved
@neverchanje neverchanje merged commit a1a6c2f into XiaoMi:master Feb 26, 2021
@hycdong hycdong deleted the child_sync_copy_mutation branch February 26, 2021 07:11
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.

3 participants