Remove PeerUp/Down messages 15/97315/2
authorTomas Cere <tomas.cere@pantheon.tech>
Tue, 24 Aug 2021 11:42:20 +0000 (13:42 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 24 Aug 2021 20:45:59 +0000 (20:45 +0000)
These were used only in EntityOwnershipShard and thus
can be removed.

JIRA: CONTROLLER-1993
Change-Id: I49873bf7e379c996719d6ec1b3bfc88395b3f3fd
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PeerDown.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PeerUp.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardInformation.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerTest.java

diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PeerDown.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PeerDown.java
deleted file mode 100644 (file)
index bfe7230..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.cluster.datastore.messages;
-
-import org.opendaylight.controller.cluster.access.concepts.MemberName;
-
-/**
- * Message sent to a shard actor indicating one of its peers is down.
- *
- * @author Thomas Pantelis
- */
-public class PeerDown {
-    private final MemberName memberName;
-    private final String peerId;
-
-    public PeerDown(MemberName memberName, String peerId) {
-        this.memberName = memberName;
-        this.peerId = peerId;
-    }
-
-    public MemberName getMemberName() {
-        return memberName;
-    }
-
-
-    public String getPeerId() {
-        return peerId;
-    }
-
-    @Override
-    public String toString() {
-        return "PeerDown [memberName=" + memberName.getName() + ", peerId=" + peerId + "]";
-    }
-}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PeerUp.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PeerUp.java
deleted file mode 100644 (file)
index 053e515..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.cluster.datastore.messages;
-
-import org.opendaylight.controller.cluster.access.concepts.MemberName;
-
-/**
- * Message sent to a shard actor indicating one of its peers is up.
- *
- * @author Thomas Pantelis
- */
-public class PeerUp {
-    private final MemberName memberName;
-    private final String peerId;
-
-    public PeerUp(MemberName memberName, String peerId) {
-        this.memberName = memberName;
-        this.peerId = peerId;
-    }
-
-    public MemberName getMemberName() {
-        return memberName;
-    }
-
-    public String getPeerId() {
-        return peerId;
-    }
-
-    @Override
-    public String toString() {
-        return "PeerUp [memberName=" + memberName.getName() + ", peerId=" + peerId + "]";
-    }
-}
\ No newline at end of file
index 8ebb7e0..ea882dc 100644 (file)
@@ -21,13 +21,10 @@ import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
 import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.Shard;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
 import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolved;
-import org.opendaylight.controller.cluster.datastore.messages.PeerDown;
-import org.opendaylight.controller.cluster.datastore.messages.PeerUp;
 import org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager.OnShardInitialized;
 import org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager.OnShardReady;
 import org.opendaylight.controller.cluster.raft.RaftState;
@@ -136,18 +133,6 @@ public final class ShardInformation {
         notifyOnShardInitializedCallbacks();
     }
 
-    void peerDown(final MemberName memberName, final String peerId, final ActorRef sender) {
-        if (actor != null) {
-            actor.tell(new PeerDown(memberName, peerId), sender);
-        }
-    }
-
-    void peerUp(final MemberName memberName, final String peerId, final ActorRef sender) {
-        if (actor != null) {
-            actor.tell(new PeerUp(memberName, peerId), sender);
-        }
-    }
-
     boolean isShardReady() {
         return !RaftState.Candidate.name().equals(role) && !Strings.isNullOrEmpty(role);
     }
index e866400..85469b2 100644 (file)
@@ -841,10 +841,6 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                 message.member().address());
 
         peerAddressResolver.removePeerAddress(memberName);
-
-        for (ShardInformation info : localShards.values()) {
-            info.peerDown(memberName, getShardIdentifier(memberName, info.getShardName()).toString(), getSelf());
-        }
     }
 
     private void memberExited(final ClusterEvent.MemberExited message) {
@@ -854,10 +850,6 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                 message.member().address());
 
         peerAddressResolver.removePeerAddress(memberName);
-
-        for (ShardInformation info : localShards.values()) {
-            info.peerDown(memberName, getShardIdentifier(memberName, info.getShardName()).toString(), getSelf());
-        }
     }
 
     private void memberUp(final ClusterEvent.MemberUp message) {
@@ -890,8 +882,6 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             String shardName = info.getShardName();
             String peerId = getShardIdentifier(memberName, shardName).toString();
             info.updatePeerAddress(peerId, peerAddressResolver.getShardActorAddress(shardName, memberName), getSelf());
-
-            info.peerUp(memberName, peerId, getSelf());
         }
     }
 
@@ -922,8 +912,6 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
                 notifyShardAvailabilityCallbacks(info);
             }
-
-            info.peerDown(memberName, getShardIdentifier(memberName, info.getShardName()).toString(), getSelf());
         }
     }
 
@@ -934,8 +922,6 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                 LOG.debug("Marking Leader {} as available.", leaderId);
                 info.setLeaderAvailable(true);
             }
-
-            info.peerUp(memberName, getShardIdentifier(memberName, info.getShardName()).toString(), getSelf());
         }
     }
 
@@ -1010,7 +996,6 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                     String peerId = getShardIdentifier(memberName, shardName).toString() ;
                     String peerAddress = peerAddressResolver.getShardActorAddress(shardName, memberName);
                     info.updatePeerAddress(peerId, peerAddress, getSelf());
-                    info.peerUp(memberName, peerId, getSelf());
                     LOG.debug("{}: updated peer {} on member {} with address {} on shard {} whose actor address is {}",
                             persistenceId(), peerId, memberName, peerAddress, info.getShardId(), info.getActor());
                 }
index 762108f..f6bc45d 100644 (file)
@@ -91,8 +91,6 @@ import org.opendaylight.controller.cluster.datastore.messages.FindPrimary;
 import org.opendaylight.controller.cluster.datastore.messages.LocalPrimaryShardFound;
 import org.opendaylight.controller.cluster.datastore.messages.LocalShardFound;
 import org.opendaylight.controller.cluster.datastore.messages.LocalShardNotFound;
-import org.opendaylight.controller.cluster.datastore.messages.PeerDown;
-import org.opendaylight.controller.cluster.datastore.messages.PeerUp;
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo;
 import org.opendaylight.controller.cluster.datastore.messages.RemotePrimaryShardFound;
 import org.opendaylight.controller.cluster.datastore.messages.RemoveShardReplica;
@@ -737,16 +735,11 @@ public class ShardManagerTest extends AbstractShardManagerTest {
             kit.getRef());
 
         shardManager1.underlyingActor().waitForUnreachableMember();
-
-        PeerDown peerDown = MessageCollectorActor.expectFirstMatching(mockShardActor1, PeerDown.class);
-        assertEquals("getMemberName", MEMBER_2, peerDown.getMemberName());
         MessageCollectorActor.clearMessages(mockShardActor1);
 
         shardManager1.tell(MockClusterWrapper.createMemberRemoved("member-2", "akka://cluster-test@127.0.0.1:2558"),
             kit.getRef());
 
-        MessageCollectorActor.expectFirstMatching(mockShardActor1, PeerDown.class);
-
         shardManager1.tell(new FindPrimary("default", true), kit.getRef());
 
         kit.expectMsgClass(Duration.ofSeconds(5), NoShardLeaderException.class);
@@ -756,10 +749,6 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
         shardManager1.underlyingActor().waitForReachableMember();
 
-        PeerUp peerUp = MessageCollectorActor.expectFirstMatching(mockShardActor1, PeerUp.class);
-        assertEquals("getMemberName", MEMBER_2, peerUp.getMemberName());
-        MessageCollectorActor.clearMessages(mockShardActor1);
-
         shardManager1.tell(new FindPrimary("default", true), kit.getRef());
 
         RemotePrimaryShardFound found1 = kit.expectMsgClass(Duration.ofSeconds(5), RemotePrimaryShardFound.class);
@@ -769,8 +758,6 @@ public class ShardManagerTest extends AbstractShardManagerTest {
         shardManager1.tell(MockClusterWrapper.createMemberUp("member-2", "akka://cluster-test@127.0.0.1:2558"),
             kit.getRef());
 
-        MessageCollectorActor.expectFirstMatching(mockShardActor1, PeerUp.class);
-
         // Test FindPrimary wait succeeds after reachable member event.
 
         shardManager1.tell(MockClusterWrapper.createUnreachableMember("member-2",