Add voting state to shard mbean FollowerInfo
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / FollowerLogInformationImpl.java
index 1c8d5e6e10647bcbac9ad7f55dd247e6f51f94c6..89884462128b10147383350429f979bd1f8744ca 100644 (file)
@@ -27,6 +27,12 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
 
     private short payloadVersion = -1;
 
+    // Assume the HELIUM_VERSION version initially for backwards compatibility until we obtain the follower's
+    // actual version via AppendEntriesReply. Although we no longer support the Helium version, a pre-Boron
+    // follower will not have the version field in AppendEntriesReply so it will be set to 0 which is
+    // HELIUM_VERSION.
+    private short raftVersion = RaftVersions.HELIUM_VERSION;
+
     private final PeerInfo peerInfo;
 
     public FollowerLogInformationImpl(PeerInfo peerInfo, long matchIndex, RaftActorContext context) {
@@ -153,6 +159,16 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
         this.payloadVersion = payloadVersion;
     }
 
+    @Override
+    public short getRaftVersion() {
+        return raftVersion;
+    }
+
+    @Override
+    public void setRaftVersion(short raftVersion) {
+        this.raftVersion = raftVersion;
+    }
+
     @Override
     public String toString() {
         return "FollowerLogInformationImpl [id=" + getId() + ", nextIndex=" + nextIndex + ", matchIndex=" + matchIndex