From 229c55fbdc5907129c9c35b3e98963b5fa2528f0 Mon Sep 17 00:00:00 2001 From: Kostiantyn Nosach Date: Thu, 4 Mar 2021 13:15:32 +0200 Subject: [PATCH] Switch to Akka Artery The migration away from legacy akka remoting to artery tcp. JIRA: CONTROLLER-1968 Change-Id: Iac1a0186292eb5a303cf075e540f3f6c8c09a932 Signed-off-by: Kostiantyn Nosach Signed-off-by: Robert Varga --- .../cluster/common/actor/QuarantinedMonitorActor.java | 2 +- .../common/actor/QuarantinedMonitorActorTest.java | 7 +++++-- .../src/main/resources/initial/akka.conf | 11 ++++------- .../src/main/resources/initial/factory-akka.conf | 10 +++++++++- .../shardmanager/ShardPeerAddressResolverTest.java | 2 +- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/QuarantinedMonitorActor.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/QuarantinedMonitorActor.java index ff8bfc8ff6..dfafb82b61 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/QuarantinedMonitorActor.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/QuarantinedMonitorActor.java @@ -14,7 +14,7 @@ import akka.actor.UntypedAbstractActor; import akka.japi.Effect; import akka.remote.AssociationErrorEvent; import akka.remote.RemotingLifecycleEvent; -import akka.remote.ThisActorSystemQuarantinedEvent; +import akka.remote.artery.ThisActorSystemQuarantinedEvent; import java.util.HashSet; import java.util.Set; import org.slf4j.Logger; diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/QuarantinedMonitorActorTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/QuarantinedMonitorActorTest.java index fd223e2efe..897cb6193a 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/QuarantinedMonitorActorTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/QuarantinedMonitorActorTest.java @@ -18,7 +18,8 @@ import akka.event.Logging; import akka.japi.Effect; import akka.remote.AssociationErrorEvent; import akka.remote.InvalidAssociation; -import akka.remote.ThisActorSystemQuarantinedEvent; +import akka.remote.UniqueAddress; +import akka.remote.artery.ThisActorSystemQuarantinedEvent; import akka.testkit.javadsl.TestKit; import org.junit.After; import org.junit.Before; @@ -54,7 +55,9 @@ public class QuarantinedMonitorActorTest { public void testOnReceiveQuarantined() throws Exception { final Throwable t = new RuntimeException("Remote has quarantined this system"); final InvalidAssociation cause = InvalidAssociation.apply(LOCAL, REMOTE, t, Option.apply(null)); - final ThisActorSystemQuarantinedEvent event = new ThisActorSystemQuarantinedEvent(LOCAL, REMOTE); + final UniqueAddress localAddress = new UniqueAddress(LOCAL, 1); + final UniqueAddress remoteAddress = new UniqueAddress(REMOTE, 2); + final ThisActorSystemQuarantinedEvent event = new ThisActorSystemQuarantinedEvent(localAddress, remoteAddress); actor.tell(event, ActorRef.noSender()); verify(callback, timeout(1000)).apply(); } diff --git a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf index 79ac7b3d61..2c179d79a9 100644 --- a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf +++ b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf @@ -3,14 +3,11 @@ odl-cluster-data { akka { remote { artery { - enabled = off + enabled = on + transport = tcp canonical.hostname = "127.0.0.1" canonical.port = 2550 } - classic.netty.tcp { - hostname = "127.0.0.1" - port = 2550 - } # when under load we might trip a false positive on the failure detector # transport-failure-detector { # heartbeat-interval = 4 s @@ -19,8 +16,8 @@ odl-cluster-data { } cluster { - # Remove ".tcp" when using artery. - seed-nodes = ["akka.tcp://opendaylight-cluster-data@127.0.0.1:2550"] + # Using artery. + seed-nodes = ["akka://opendaylight-cluster-data@127.0.0.1:2550"] roles = [ "member-1" diff --git a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf index 97f8cce642..fb0afde486 100644 --- a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf +++ b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf @@ -56,6 +56,11 @@ odl-cluster-data { loggers = ["akka.event.slf4j.Slf4jLogger"] logger-startup-timeout = 300s + # JFR requires boot delegation, which we do not have by default + java-flight-recorder { + enabled = false + } + actor { warn-about-java-serializer-usage = off provider = "akka.cluster.ClusterActorRefProvider" @@ -97,8 +102,11 @@ odl-cluster-data { } artery { + enabled = on + transport = tcp + advanced { - #maximum-frame-size = 256 KiB + maximum-frame-size = 400 MiB #maximum-large-frame-size = 2 MiB } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardPeerAddressResolverTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardPeerAddressResolverTest.java index 0c18e799a5..e4482f5e25 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardPeerAddressResolverTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardPeerAddressResolverTest.java @@ -87,7 +87,7 @@ public class ShardPeerAddressResolverTest { String peerId = ShardIdentifier.create("default", MEMBER_2, type).toString(); - String address = "akka.tcp://opendaylight-cluster-data@127.0.0.1:2550/user/shardmanager-" + type + String address = "akka://opendaylight-cluster-data@127.0.0.1:2550/user/shardmanager-" + type + "/" + MEMBER_2.getName() + "-shard-default-" + type; resolver.setResolved(peerId, address); -- 2.36.6