You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #254 we added a prepare stage in the command executor to assign each command with a revision. However, in current logic the prepare method is called inside the conflict_checked_mpmc, this present the following behaviour:
the commands is executed in the conflict order
the leader may call send_sp_exe on a command and the follower always calls send_after_sync
These may result in revision is assigned in different order between leader and followers.
Refactor
I plan to move the calls of prepare to raw_curp. As soon as a server gets a new valid log, it assign a prepare result to it.
This include the following changes:
move command executor from conflict_checked_mpmc to raw_curp
add a prepare_board to raw_curp context to temporarily store the prepare result
On the leader calls prepare in handle_propose
On the follower calls prepare in handle_append_entries
In apply, before the call of send_after_sync, remove the prepare result and send it to the conflict_checked_mpmc.
This guarantees the revisions is assigned in the order of log index and consistency among servers.
The text was updated successfully, but these errors were encountered:
In handle_propose the leader need to generate the prepare result(revision) for the execution stage(beacuse the revision need to return to user in speculative execute), but this prepare result may get reverted if the leadership changes. So the command executor need to introdue another method called prepare_commit. This method is called after the leader knows that the log is commited.
After this change, the prepare stage should not increment the revision generator, but pre-assign a revsion(use another counter to store this), and the revision is actually incremented after prepare_commit is called. If the leader steps down, it need to clear the pre-assign counter.
bsbds
added
bug
Something isn't working
and removed
Improvement
Refactor or optimization, including process, performance or something like that
labels
Nov 22, 2023
Why
In #254 we added a
prepare
stage in the command executor to assign each command with a revision. However, in current logic theprepare
method is called inside theconflict_checked_mpmc
, this present the following behaviour:send_sp_exe
on a command and the follower always callssend_after_sync
These may result in revision is assigned in different order between leader and followers.
Refactor
I plan to move the calls of
prepare
toraw_curp
. As soon as a server gets a new valid log, it assign a prepare result to it.This include the following changes:
conflict_checked_mpmc
toraw_curp
prepare_board
toraw_curp
context to temporarily store the prepare resultprepare
inhandle_propose
prepare
inhandle_append_entries
apply
, before the call ofsend_after_sync
, remove the prepare result and send it to theconflict_checked_mpmc
.This guarantees the revisions is assigned in the order of log index and consistency among servers.
The text was updated successfully, but these errors were encountered: