BUG-8618: refresh transaction access when isolated 02/60702/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 17 Jul 2017 15:11:48 +0000 (17:11 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 24 Jul 2017 20:47:53 +0000 (22:47 +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>
(cherry picked from commit 1529bb8bdd4c30a782cf1574b0127833da5831b7)


index 715358b..c003d90 100644 (file)
@@ -397,9 +397,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() {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.