BUG-8618: refresh transaction access when isolated 92/60492/3
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 17 Jul 2017 15:11:48 +0000 (17:11 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Jul 2017 11:44:55 +0000 (13:44 +0200)
When we are isolated leader we stop accepting messages from
the frontend. If we remain in this state for more than 15 seconds
this can result in a timeout -- which is obvious, but it really
is our fault.

Since we cannot make forward progress anyway, there is no point
in purging the transaction. Update its access time with whatever
the last mark for that frontend was.

Change-Id: I9ff56c91e4fda4b68cd34c05609dc88d6d65fd32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java

index bcccce7f54839c2d872477b892d294a2cef7416c..9265bb2cc9b127e8ea0c8aff9a5bf07e40bcae62 100644 (file)
@@ -371,9 +371,20 @@ public class Shard extends RaftActor {
 
     private Optional<Long> updateAccess(final SimpleShardDataTreeCohort cohort) {
         final FrontendIdentifier frontend = cohort.getIdentifier().getHistoryId().getClientId().getFrontendId();
-        // If this frontend has freshly connected, give it some time to catch up before killing its transactions.
         final LeaderFrontendState state = knownFrontends.get(frontend);
-        return state == null ? Optional.absent() : Optional.of(state.getLastConnectTicks());
+        if (state == null) {
+            // Not tell-based protocol, do nothing
+            return Optional.absent();
+        }
+
+        if (isIsolatedLeader()) {
+            // We are isolated and no new request can come through until we emerge from it. We are still updating
+            // liveness of frontend when we see it attempting to communicate. Use the last access timer.
+            return Optional.of(state.getLastSeenTicks());
+        }
+
+        // If this frontend has freshly connected, give it some time to catch up before killing its transactions.
+        return Optional.of(state.getLastConnectTicks());
     }
 
     private void onMakeLeaderLocal() {