From: Robert Varga Date: Mon, 17 Jul 2017 15:11:48 +0000 (+0200) Subject: BUG-8618: refresh transaction access when isolated X-Git-Tag: release/nitrogen~29 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=cc4d0505cacbca16f1a8a751a794c4091329db0d BUG-8618: refresh transaction access when isolated 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 (cherry picked from commit 1529bb8bdd4c30a782cf1574b0127833da5831b7) --- diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index 715358b514..c003d901af 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -397,9 +397,20 @@ public class Shard extends RaftActor { private Optional 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() {