mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 18:23:34 +08:00
Log commit callback - needed by the main allocator class to broadcast allocation responses
This commit is contained in:
@@ -1059,6 +1059,7 @@ void RaftCore::propagateCommitIndex()
|
||||
{
|
||||
// Objective is to estimate whether we can safely increment commit index value
|
||||
UAVCAN_ASSERT(server_state_ == ServerStateLeader);
|
||||
UAVCAN_ASSERT(commit_index_ <= persistent_state_.getLog().getLastIndex());
|
||||
|
||||
if (commit_index_ == persistent_state_.getLog().getLastIndex())
|
||||
{
|
||||
@@ -1098,8 +1099,11 @@ void RaftCore::propagateCommitIndex()
|
||||
if (num_nodes_with_next_log_entry_available >= cluster_.getQuorumSize())
|
||||
{
|
||||
commit_index_++;
|
||||
UAVCAN_ASSERT(commit_index_ > 0); // Index 0 is always committed
|
||||
trace(TraceRaftNewEntryCommitted, commit_index_);
|
||||
|
||||
// AT THIS POINT ALLOCATION IS COMPLETE
|
||||
log_commit_handler_.onEntryCommitted(*persistent_state_.getLog().getEntryAtIndex(commit_index_));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user