private LeaderInstallSnapshotState installSnapshotState;
+ private long slicedLogEntryIndex = NO_INDEX;
+
/**
* Constructs an instance.
*
@Override
public boolean setMatchIndex(long matchIndex) {
+ // If the new match index is the index of the entry currently being sliced, then we know slicing is complete
+ // and the follower received the entry and responded so clear the slicedLogEntryIndex
+ if (isLogEntrySlicingInProgress() && slicedLogEntryIndex == matchIndex) {
+ slicedLogEntryIndex = NO_INDEX;
+ }
+
if (this.matchIndex != matchIndex) {
this.matchIndex = matchIndex;
return true;
installSnapshotState = null;
}
+ @Override
+ public void setSlicedLogEntryIndex(long index) {
+ slicedLogEntryIndex = index;
+ }
+
+ @Override
+ public boolean isLogEntrySlicingInProgress() {
+ return slicedLogEntryIndex != NO_INDEX;
+ }
+
@Override
public String toString() {
return "FollowerLogInformationImpl [id=" + getId() + ", nextIndex=" + nextIndex + ", matchIndex=" + matchIndex