Bug 5419: Persist log entries asycnhronously
Modified RaftActor#persistData to persist the ReplicatedLogEntry
using akka's persistAsync method. This is similar to the persist method
except subsequent messages are delivered prior to persistence completion.
This avoids blocking the RaftActor so it can process AppendEntriesReply
and other messages while persistence is in progress.
In addition, AbstractLeader was modified to only count itself for consensus
when persistence is complete. This required communicating the persistence
complete state to the AbstractLeader. A transient persistencePending flag was
added to the ReplicatedLogImplEntry that is set by RaftActor#persistData
prior to the persist call and is cleared when the persist callback executes.
AbstractLeader checks the flag when counting consensus. It's possible that
the persistence complete event arrives after AppendEntriesReply messages
from replicated followers so a new message, CheckConsensusReached, is sent
by the RaftActor on persistence complete to check if consensus is reached.
Change-Id: If34a5f395d52e17b2737464a2e2403f56a520c43
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
14 files changed: