Ignore DataTreeChangeReply message 75/96875/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 13 Jul 2021 11:31:26 +0000 (13:31 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 13 Jul 2021 11:34:18 +0000 (13:34 +0200)
DataTreeChangeListenerActor is sending replies towards shard on each
processed datatree change. This is not handled by Shard, which ends up
flooding dead letters.

Make sure we ignore these messages, so that the logs are cleaner. Also
speed up the non-null check in DTCLActor.

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

index 9a2afc9..9384a84 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.cluster.datastore;
 
 import static java.util.Objects.requireNonNull;
 
+import akka.actor.ActorRef;
 import akka.actor.Props;
 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
 import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
@@ -88,8 +89,9 @@ class DataTreeChangeListenerActor extends AbstractUntypedActor {
         // TODO: do we really need this?
         // It seems the sender is never null but it doesn't hurt to check. If the caller passes in
         // a null sender (ActorRef.noSender()), akka translates that to the deadLetters actor.
-        if (getSender() != null && !getContext().system().deadLetters().equals(getSender())) {
-            getSender().tell(DataTreeChangedReply.getInstance(), getSelf());
+        final ActorRef sender = getSender();
+        if (sender != null && !sender.equals(getContext().system().deadLetters())) {
+            sender.tell(DataTreeChangedReply.getInstance(), getSelf());
         }
     }
 
index 030ef16..357df4a 100644 (file)
@@ -77,6 +77,7 @@ import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionCh
 import org.opendaylight.controller.cluster.datastore.messages.CommitTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.DataTreeChangedReply;
 import org.opendaylight.controller.cluster.datastore.messages.ForwardedReadyTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.GetKnownClients;
 import org.opendaylight.controller.cluster.datastore.messages.GetKnownClientsReply;
@@ -388,6 +389,8 @@ public class Shard extends RaftActor {
                 handleAbortTransaction(AbortTransaction.fromSerializable(message));
             } else if (CloseTransactionChain.isSerializedType(message)) {
                 closeTransactionChain(CloseTransactionChain.fromSerializable(message));
+            } else if (message instanceof DataTreeChangedReply) {
+                // Ignore reply
             } else if (message instanceof RegisterDataTreeChangeListener) {
                 treeChangeSupport.onMessage((RegisterDataTreeChangeListener) message, isLeader(), hasLeader());
             } else if (message instanceof UpdateSchemaContext) {