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

feat(bulk-load): group bulk load request in replica group #460

Merged
merged 11 commits into from
May 15, 2020

Conversation

hycdong
Copy link
Contributor

@hycdong hycdong commented May 13, 2020

This pull request is about primary broadcast group_bulk_load_request to secondaries.

  • primary replica receive bulk_load_request (on_bulk_load feat(bulk-load): meta server send bulk load request #457)
  • primary replica broadcast group_bulk_load_request (broadcast_group_bulk_load)
  • secondary replica calls on_group_bulk_load when receive group_bulk_load_request
    • validate replica status and ballot
    • execute actual bulk load process (do_bulk_load - not implemented in this pr )
    • report bulk load states to primary (report_bulk_load_states_to_primary - not implemented in this pr)
  • primary replica calls on_group_bulk_load_reply when receive group_bulk_load_response, part-implemented in this pr

Whole bulk load process document can be found in official website: bulk_load_design

@hycdong hycdong marked this pull request as ready for review May 13, 2020 06:30
src/dist/replication/lib/replica_bulk_load.cpp Outdated Show resolved Hide resolved
src/dist/replication/lib/replica_bulk_load.cpp Outdated Show resolved Hide resolved
src/dist/replication/lib/replica_bulk_load.cpp Outdated Show resolved Hide resolved
src/dist/replication/lib/replica_context.cpp Outdated Show resolved Hide resolved
for (const auto &kv : _primary_states.group_bulk_load_pending_replies) {
kv.second->cancel(true);
}
_primary_states.group_bulk_load_pending_replies.clear();
Copy link
Member

Choose a reason for hiding this comment

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

Does it mean we will resend group_bulk_load_request to sendaries? How does secondary replica deal with duplicate bulk load request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • meta -> primary: send bulk _load_request
  • primary -> secondary: send group_bulk_load_request (request 1)
  • secondary -> primary : report bulk load state
  • primary -> meta: report group bulk load states
  • if bulk load not finished, meta send bulk_load_request again
  • primary -> secondary: send group_bulk_load_request (request 2)

Primary will not resend group_bulk_load_request, request 1 and request 2 are different.
When primary tries to send request 2, primary will check if there are request 1 pending firstly, if there are pending request 1, primary will cancel tasks and send request 2.
Meta server will not send bulk_load_request too soon, the interval is longer than 5 seconds (will be shown in further pull request), it is safe to cancel the long-time, pending request.

acelyc111
acelyc111 previously approved these changes May 14, 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