Raise EOS unsuccessful request reporting to error 90/82990/3
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 10 Jul 2019 09:54:38 +0000 (11:54 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 16 Jul 2019 09:14:06 +0000 (09:14 +0000)
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 <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java

index 8eb69daf096321af6672b43264972a928eed55f8..42ac5a4e396971f49ee25f92cd91792f42f8f8b1 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.cluster.datastore.entityownership;
 
  */
 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;
 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 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;
 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) {
     private volatile DataTree localEntityOwnershipShardDataTree;
 
     DistributedEntityOwnershipService(final ActorUtils context) {
-        this.context = Preconditions.checkNotNull(context);
+        this.context = requireNonNull(context);
     }
 
     public static DistributedEntityOwnershipService start(final ActorUtils 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);
 
                 "entity-owners", ENTITY_OWNERSHIP_SHARD_NAME, ModuleShardStrategy.NAME, entityOwnersMemberNames),
                         newShardBuilder(context, strategyConfig), null);
 
-        Future<Object> createFuture = context.executeOperationAsync(shardManagerActor,
-                createShard, MESSAGE_TIMEOUT);
-
+        Future<Object> createFuture = context.executeOperationAsync(shardManagerActor, createShard, MESSAGE_TIMEOUT);
         createFuture.onComplete(new OnComplete<Object>() {
             @Override
             public void onComplete(final Throwable failure, final Object response) {
         createFuture.onComplete(new OnComplete<Object>() {
             @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) {
             @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);
                 }
                 } 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) {
                 @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;
                         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 {
     @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);
 
         if (registeredEntities.putIfAbsent(entity, entity) != null) {
             throw new CandidateAlreadyRegisteredException(entity);
@@ -176,7 +176,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ
 
     @Override
     public Optional<EntityOwnershipState> getOwnershipState(final DOMEntity forEntity) {
 
     @Override
     public Optional<EntityOwnershipState> getOwnershipState(final DOMEntity forEntity) {
-        Preconditions.checkNotNull(forEntity, "forEntity cannot be null");
+        requireNonNull(forEntity, "forEntity cannot be null");
 
         DataTree dataTree = getLocalEntityOwnershipShardDataTree();
         if (dataTree == null) {
 
         DataTree dataTree = getLocalEntityOwnershipShardDataTree();
         if (dataTree == null) {