BUG 2676 : Add diagnostic message when AppendEntriesReply comes in very late 42/15542/2
authorMoiz Raja <moraja@cisco.com>
Fri, 20 Feb 2015 11:38:18 +0000 (03:38 -0800)
committerMoiz Raja <moraja@cisco.com>
Fri, 20 Feb 2015 18:09:40 +0000 (10:09 -0800)
Log an error message when an AppendEntriesReply arrives beyond the ElectionTimeout
period. This may help detect cases where messages are not being processed
fast enough by the actor system. This particular condition can cause a Leader to
become an IsolatedLeader even if the remote Follower is receiving heartbeats.

Change-Id: Id6a797820b63cb4f18c3d1bbd2781e72674aa9d8
Signed-off-by: Moiz Raja <moraja@cisco.com>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java

index b2bb127eab525e35b5f7db5995e9bd57fcbe0746..66b8fba674161ddbc8f9f2e5a64154b62226c683 100644 (file)
@@ -171,6 +171,14 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
             return this;
         }
 
             return this;
         }
 
+        if(followerLogInformation.timeSinceLastActivity() >
+                context.getConfigParams().getElectionTimeOutInterval().toMillis()) {
+            LOG.error("{} : handleAppendEntriesReply delayed beyond election timeout, " +
+                            "appendEntriesReply : {}, timeSinceLastActivity : {}, lastApplied : {}, commitIndex : {}",
+                    logName(), appendEntriesReply, followerLogInformation.timeSinceLastActivity(),
+                    context.getLastApplied(), context.getCommitIndex());
+        }
+
         followerLogInformation.markFollowerActive();
 
         if (appendEntriesReply.isSuccess()) {
         followerLogInformation.markFollowerActive();
 
         if (appendEntriesReply.isSuccess()) {