Fix: (0.10) Ensure Respond Waits for IO Completion
This commit addresses the premature sending of Respond messages in
response to AppendEntries RPCs and similar requests. Previously,
responses could be sent before the associated IO operations were
confirmed as complete, potentially leading to inconsistencies.
Changes:
The Respond now blocks until the corresponding IO operation
is completed and properly recorded in IOProgress.
RequestVote and AppendEntries RPC handlers now include a
Condition that remains unsatisfied until operations like SaveVote
or AppendInputEntries are flushed to disk.
Add IOProgress:
accepted: Tracks the ID of the last IO operation that was accepted but not yet submitted.
submitted: The ID of the last IO operation submitted to either RaftLogStorage or RaftStateMachine.
flushed: The ID of the last IO operation successfully flushed to storage.
Remove command_seq: Instead of using command_seq to track the
completion of state machine commands, this update uses
IOState.applied and IOState.snapshot. This change accounts for the
non-sequential execution of some SM commands, such as BuildSnapshot,
which runs in a separate task.
Remove IOState.vote: The IOState.vote field has been
removed. The system now utilizes
IOState.io_progress.flushed().voted_ref() for tracking vote
operations.
Changelog
Fix: (0.10) Ensure
Respond
Waits for IO CompletionThis commit addresses the premature sending of
Respond
messages in response toAppendEntries
RPCs and similar requests. Previously, responses could be sent before the associated IO operations were confirmed as complete, potentially leading to inconsistencies.Changes:
The
Respond
now blocks until the corresponding IO operation is completed and properly recorded inIOProgress
.RequestVote
andAppendEntries
RPC handlers now include aCondition
that remains unsatisfied until operations likeSaveVote
orAppendInputEntries
are flushed to disk.Add
IOProgress
:accepted
: Tracks the ID of the last IO operation that was accepted but not yet submitted.submitted
: The ID of the last IO operation submitted to eitherRaftLogStorage
orRaftStateMachine
.flushed
: The ID of the last IO operation successfully flushed to storage.Remove
command_seq
: Instead of usingcommand_seq
to track the completion of state machine commands, this update usesIOState.applied
andIOState.snapshot
. This change accounts for the non-sequential execution of some SM commands, such asBuildSnapshot
, which runs in a separate task.Remove
IOState.vote
: TheIOState.vote
field has been removed. The system now utilizesIOState.io_progress.flushed().voted_ref()
for tracking vote operations.This change is