Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A RaftAcotor(Leader) could mis-deliver a ReplicationSucceeded message to a different entity #156

Closed
xirc opened this issue Jul 6, 2022 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@xirc
Copy link
Contributor

xirc commented Jul 6, 2022

Situation

  1. RaftActor on node A starts a replication for entity X with index=5 (for example).
  2. RaftActor on node A becomes a follower before the replication completes for some reason.
    • RaftActor on node B is the leader now.
    • The new leader has a Raft log with lastLogIndex=3 (for example).
  3. RaftActor on node B starts a new replication.
    • This replication contains a log entry (index=5, but an event is for entity Y), for example.
  4. RaftActor on node A receives AppendEntries from RaftActor on node B
    • This receiving truncates the log entry (index=5, an event for entity X) because the entry is conflicted.
  5. RaftActor on node B becomes a follower before the replication completes for some reason.
    • RaftActor on node A is the leader again.
  6. RaftActor on node A completes the ongoing replication
  7. RaftActor on node A will send a ReplicationSucceeded message containing the log entry (index=5, the event is for entity Y) to entity X.
    • It is because LeaderData.clients associates a ClientContext for entity X with index=5.

Possible Solution

Similar to #155

@xirc xirc added this to the v2.1.1 milestone Jul 15, 2022
@xirc xirc closed this as completed Jul 27, 2022
@xirc xirc added the bug Something isn't working label Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant