RaftActor will track a log index (named eventSourcingIndex). This index indicates that CommitLogStoreActor (which is responsible for Event Sourcing) already persisted events with indices lower than or equal to that index. This index enables RaftActor to know the progress of Event Sourcing. This index is periodically exchanged by the new messages ( CommitLogStore.AppendCommittedEntries and CommitLogStore.AppendCommittedEntriesResponse) between RaftActor and CommitLogStoreActor.
RaftActor (only the leader) checks new committed entries (which index should > eventSourcingIndex and <= commitIndex) at a certain period (named committed-log-entries-check-interval or EventSourcingTick) and will send those entries (included to CommitLogStore.AppendCommittedEntries) if available. This periodically checking mechanism prevents halting Event Sourcing. It also allows RaftActor to retry committed entries persisting (the previous persisting failed for some reason like journal failures).
Using eventSourcingIndexRaftActor can know what entry can be removed safely on compaction. More precisely, committed entries that are persisted to the event-sourcing store can be removed safely. By this PR, compaction won't delete entries that are not persisted to the event-sourcing store yet.
By introducing event soucing progress tracking, followers and candidates don't have to send committed entries to the event-sourcing store. This PR removes such sending, which might reduce the required network resource.
Closes #136
Overview
RaftActor
will track a log index (namedeventSourcingIndex
). This index indicates thatCommitLogStoreActor
(which is responsible for Event Sourcing) already persisted events with indices lower than or equal to that index. This index enablesRaftActor
to know the progress of Event Sourcing. This index is periodically exchanged by the new messages (CommitLogStore.AppendCommittedEntries
andCommitLogStore.AppendCommittedEntriesResponse
) betweenRaftActor
andCommitLogStoreActor
.RaftActor
(only the leader) checks new committed entries (which index should >eventSourcingIndex
and <=commitIndex
) at a certain period (namedcommitted-log-entries-check-interval
orEventSourcingTick
) and will send those entries (included toCommitLogStore.AppendCommittedEntries
) if available. This periodically checking mechanism prevents halting Event Sourcing. It also allowsRaftActor
to retry committed entries persisting (the previous persisting failed for some reason like journal failures).Using
eventSourcingIndex
RaftActor
can know what entry can be removed safely on compaction. More precisely, committed entries that are persisted to the event-sourcing store can be removed safely. By this PR, compaction won't delete entries that are not persisted to the event-sourcing store yet.By introducing event soucing progress tracking, followers and candidates don't have to send committed entries to the event-sourcing store. This PR removes such sending, which might reduce the required network resource.