X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FFollowerLogInformationImpl.java;h=8bd0cf3d34f4639a1e053cc6c17158e469a4422f;hb=8d90cf04be86f872f7eeb892d37517d5ee087157;hp=883bfbb4e4184f0cbf0843002dfa3498ca13f622;hpb=29bebec0bb224893a163cb5df9336c37d41c350f;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java index 883bfbb4e4..8bd0cf3d34 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java @@ -46,6 +46,8 @@ public class FollowerLogInformationImpl implements FollowerLogInformation { private LeaderInstallSnapshotState installSnapshotState; + private long slicedLogEntryIndex = NO_INDEX; + /** * Constructs an instance. * @@ -92,6 +94,12 @@ public class FollowerLogInformationImpl implements FollowerLogInformation { @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; @@ -210,6 +218,16 @@ public class FollowerLogInformationImpl implements FollowerLogInformation { 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