From: Robert Varga Date: Wed, 10 Jul 2019 09:54:38 +0000 (+0200) Subject: Raise EOS unsuccessful request reporting to error X-Git-Tag: release/sodium~20 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=bdce894fa73714aa9f68eadad3524cfc94dc71d2 Raise EOS unsuccessful request reporting to error When we fail to send a message to the backend we are entering an inconsistent state, where our users think the candidate is registered, but the backend knows nothing about it -- which warrants an ERROR level output. Also place a FIXME on operations which should be retried. JIRA: CONTROLLER-1904 Change-Id: I0799afe2e0786468cdef5f80c1064cb08d3c1af0 Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java index 8eb69daf09..42ac5a4e39 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java @@ -7,6 +7,7 @@ */ package org.opendaylight.controller.cluster.datastore.entityownership; +import static java.util.Objects.requireNonNull; import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.CANDIDATE_NODE_ID; import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNER_NODE_ID; import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath; @@ -16,7 +17,6 @@ import akka.dispatch.OnComplete; import akka.pattern.Patterns; import akka.util.Timeout; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Preconditions; import com.google.common.base.Strings; import java.util.Collection; import java.util.Optional; @@ -74,7 +74,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ private volatile DataTree localEntityOwnershipShardDataTree; DistributedEntityOwnershipService(final ActorUtils context) { - this.context = Preconditions.checkNotNull(context); + this.context = requireNonNull(context); } public static DistributedEntityOwnershipService start(final ActorUtils context, @@ -87,9 +87,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ "entity-owners", ENTITY_OWNERSHIP_SHARD_NAME, ModuleShardStrategy.NAME, entityOwnersMemberNames), newShardBuilder(context, strategyConfig), null); - Future createFuture = context.executeOperationAsync(shardManagerActor, - createShard, MESSAGE_TIMEOUT); - + Future createFuture = context.executeOperationAsync(shardManagerActor, createShard, MESSAGE_TIMEOUT); createFuture.onComplete(new OnComplete() { @Override public void onComplete(final Throwable failure, final Object response) { @@ -110,7 +108,8 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ @Override public void onComplete(final Throwable failure, final Object response) { if (failure != null) { - LOG.debug("Error sending message {} to {}", message, shardActor, failure); + // FIXME: CONTROLLER-1904: reduce the severity to info once we have a retry mechanism + LOG.error("Error sending message {} to {}", message, shardActor, failure); } else { LOG.debug("{} message to {} succeeded", message, shardActor); } @@ -126,6 +125,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ @Override public void onComplete(final Throwable failure, final ActorRef shardActor) { if (failure != null) { + // FIXME: CONTROLLER-1904: reduce the severity to info once we have a retry mechanism LOG.error("Failed to find local {} shard", ENTITY_OWNERSHIP_SHARD_NAME, failure); } else { localEntityOwnershipShard = shardActor; @@ -142,7 +142,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ @Override public DOMEntityOwnershipCandidateRegistration registerCandidate(final DOMEntity entity) throws CandidateAlreadyRegisteredException { - Preconditions.checkNotNull(entity, "entity cannot be null"); + requireNonNull(entity, "entity cannot be null"); if (registeredEntities.putIfAbsent(entity, entity) != null) { throw new CandidateAlreadyRegisteredException(entity); @@ -176,7 +176,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ @Override public Optional getOwnershipState(final DOMEntity forEntity) { - Preconditions.checkNotNull(forEntity, "forEntity cannot be null"); + requireNonNull(forEntity, "forEntity cannot be null"); DataTree dataTree = getLocalEntityOwnershipShardDataTree(); if (dataTree == null) {