Bug 5329: Add factory akka.conf 53/34553/5
authorTom Pantelis <tpanteli@brocade.com>
Fri, 12 Feb 2016 14:08:15 +0000 (09:08 -0500)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 23 Feb 2016 20:47:46 +0000 (20:47 +0000)
Added a factory akka.conf file that is shipped to
configuration/factory/akka.conf. This file contains all the necessary
akka settings. Modified the FileAkkaConfigurationReader to load the
existing configuration/initial/akka.conf file with the factory file as
the fallback. In this manner akka will overlay/merge the initial file
with the factory file. I pared down the initial file to only contain the
settings that users would normally set or configure to setup a cluster,
ie hostname, port, seed-nodes, roles.

In the features.xml, the factory file is configured to always overwrite
so changes are picked up on upgrade. We still preserve the initial file.

Change-Id: I8e80161e21d0ad0e26f1efa1023c670b3a5ef6bc
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
features/mdsal/src/main/features/features.xml
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/FileAkkaConfigurationReader.java
opendaylight/md-sal/sal-clustering-config/pom.xml
opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf
opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf [new file with mode: 0644]

index e8821f232a0ebcf03363b24921715188d1642bf1..489f174bec442ae6eff0d935c88ac85c9ce43060 100644 (file)
@@ -93,6 +93,7 @@
         <configfile finalname="${config.configfile.directory}/${config.clustering.configfile}">mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/config</configfile>
         <configfile finalname="${config.configfile.directory}/${config.clustered-entity-ownership.configfile}">mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/entityownershipconfig</configfile>
         <configfile finalname="configuration/initial/akka.conf">mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/akkaconf</configfile>
+        <configfile finalname="configuration/factory/akka.conf" override="true">mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/factoryakkaconf</configfile>
         <configfile finalname="configuration/initial/module-shards.conf">mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/moduleshardconf</configfile>
         <configfile finalname="configuration/initial/modules.conf">mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/moduleconf</configfile>
         <configfile finalname="etc/org.opendaylight.controller.cluster.datastore.cfg">mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/cfg/datastore</configfile>
index 384ba81526329748b98e82e3287c7ade905c5ecb..1e3adf9d391051ef2173de187004c3c6edaa6e40 100644 (file)
@@ -14,12 +14,19 @@ import com.typesafe.config.ConfigFactory;
 import java.io.File;
 
 public class FileAkkaConfigurationReader implements AkkaConfigurationReader {
-    private static final String DEFAULT_AKKA_CONF_PATH = "./configuration/initial/akka.conf";
+    private static final String CUSTOM_AKKA_CONF_PATH = "./configuration/initial/akka.conf";
+    private static final String FACTORY_AKKA_CONF_PATH = "./configuration/factory/akka.conf";
 
-    @Override public Config read() {
-        File configFile = new File(DEFAULT_AKKA_CONF_PATH);
-        Preconditions.checkState(configFile.exists(), "%s is missing", configFile);
-        return ConfigFactory.parseFile(configFile);
+    @Override
+    public Config read() {
+        File customConfigFile = new File(CUSTOM_AKKA_CONF_PATH);
+        Preconditions.checkState(customConfigFile.exists(), "%s is missing", customConfigFile);
 
+        File factoryConfigFile = new File(FACTORY_AKKA_CONF_PATH);
+        if(factoryConfigFile.exists()) {
+            return ConfigFactory.parseFile(customConfigFile).withFallback(ConfigFactory.parseFile(factoryConfigFile));
+        }
+
+        return ConfigFactory.parseFile(customConfigFile);
     }
 }
index 48cd1c6ed0d251794034f8884c583764bd1e70b4..2fd000b6fa4b66ef5734bc78504e777f3c6f5bb2 100644 (file)
                   <type>xml</type>
                   <classifier>akkaconf</classifier>
                 </artifact>
+                <artifact>
+                  <file>${project.build.directory}/classes/initial/factory-akka.conf</file>
+                  <type>xml</type>
+                  <classifier>factoryakkaconf</classifier>
+                </artifact>
                 <artifact>
                   <file>${project.build.directory}/classes/initial/module-shards.conf</file>
                   <type>xml</type>
index b15b5bc30cec2dc9be6d6488da3e8a6f75a60e05..852171285ce63124c62225b8c5fb9f36341d62d7 100644 (file)
@@ -1,87 +1,22 @@
 
 odl-cluster-data {
-  bounded-mailbox {
-    mailbox-type = "org.opendaylight.controller.cluster.common.actor.MeteredBoundedMailbox"
-    mailbox-capacity = 1000
-    mailbox-push-timeout-time = 100ms
-  }
-
-  metric-capture-enabled = true
-
-  notification-dispatcher {
-    # Dispatcher is the name of the event-based dispatcher
-    type = Dispatcher
-    # What kind of ExecutionService to use
-    executor = "fork-join-executor"
-    # Configuration for the fork join pool
-    fork-join-executor {
-      # Min number of threads to cap factor-based parallelism number to
-      parallelism-min = 2
-      # Parallelism (threads) ... ceil(available processors * factor)
-      parallelism-factor = 3.0
-      # Max number of threads to cap factor-based parallelism number to
-      parallelism-max = 15
-    }
-    # Throughput defines the maximum number of messages to be
-    # processed per actor before the thread jumps to the next actor.
-    # Set to 1 for as fair as possible.
-    throughput = 1
-  }
-
   akka {
-    loglevel = "INFO"
-    loggers = ["akka.event.slf4j.Slf4jLogger"]
-    logger-startup-timeout = 300s
-
-    actor {
-      provider = "akka.cluster.ClusterActorRefProvider"
-      serializers {
-        java = "akka.serialization.JavaSerializer"
-        proto = "akka.remote.serialization.ProtobufSerializer"
-        readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
-      }
-
-      serialization-bindings {
-        "com.google.protobuf.Message" = proto
-        "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
-      }
-
-      default-dispatcher {
-        # Setting throughput to 1 makes the dispatcher fair. It processes 1 message from
-        # the mailbox before moving on to the next mailbox
-        throughput = 1
-      }
-
-      default-mailbox {
-        # When not using a BalancingDispatcher it is recommended that we use the SingleConsumerOnlyUnboundedMailbox
-        # as it is the most efficient for multiple producer/single consumer use cases
-        mailbox-type="akka.dispatch.SingleConsumerOnlyUnboundedMailbox"
-      }
-    }
     remote {
-      log-remote-lifecycle-events = off
       netty.tcp {
         hostname = "127.0.0.1"
         port = 2550
-        maximum-frame-size = 419430400
-        send-buffer-size = 52428800
-        receive-buffer-size = 52428800
       }
     }
 
     cluster {
       seed-nodes = ["akka.tcp://opendaylight-cluster-data@127.0.0.1:2550"]
-      
-      seed-node-timeout = 12s
-
-      auto-down-unreachable-after = 30s
 
       roles = [
         "member-1"
       ]
 
     }
-
+    
     persistence {
       # By default the snapshots/journal directories live in KARAF_HOME. You can choose to put it somewhere else by
       # modifying the following two properties. The directory location specified may be a relative or absolute path. 
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
new file mode 100644 (file)
index 0000000..eb4903e
--- /dev/null
@@ -0,0 +1,85 @@
+
+odl-cluster-data {
+  bounded-mailbox {
+    mailbox-type = "org.opendaylight.controller.cluster.common.actor.MeteredBoundedMailbox"
+    mailbox-capacity = 1000
+    mailbox-push-timeout-time = 100ms
+  }
+
+  metric-capture-enabled = true
+
+  notification-dispatcher {
+    # Dispatcher is the name of the event-based dispatcher
+    type = Dispatcher
+    # What kind of ExecutionService to use
+    executor = "fork-join-executor"
+    # Configuration for the fork join pool
+    fork-join-executor {
+      # Min number of threads to cap factor-based parallelism number to
+      parallelism-min = 2
+      # Parallelism (threads) ... ceil(available processors * factor)
+      parallelism-factor = 3.0
+      # Max number of threads to cap factor-based parallelism number to
+      parallelism-max = 15
+    }
+    # Throughput defines the maximum number of messages to be
+    # processed per actor before the thread jumps to the next actor.
+    # Set to 1 for as fair as possible.
+    throughput = 1
+  }
+
+  akka {
+    loglevel = "INFO"
+    loggers = ["akka.event.slf4j.Slf4jLogger"]
+    logger-startup-timeout = 300s
+
+    actor {
+      provider = "akka.cluster.ClusterActorRefProvider"
+      serializers {
+        java = "akka.serialization.JavaSerializer"
+        proto = "akka.remote.serialization.ProtobufSerializer"
+        readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer"
+      }
+
+      serialization-bindings {
+        "com.google.protobuf.Message" = proto
+        "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal
+      }
+
+      default-dispatcher {
+        # Setting throughput to 1 makes the dispatcher fair. It processes 1 message from
+        # the mailbox before moving on to the next mailbox
+        throughput = 1
+      }
+
+      default-mailbox {
+        # When not using a BalancingDispatcher it is recommended that we use the SingleConsumerOnlyUnboundedMailbox
+        # as it is the most efficient for multiple producer/single consumer use cases
+        mailbox-type="akka.dispatch.SingleConsumerOnlyUnboundedMailbox"
+      }
+    }
+    remote {
+      log-remote-lifecycle-events = off
+      netty.tcp {
+        hostname = "127.0.0.1"
+        port = 2550
+        maximum-frame-size = 419430400
+        send-buffer-size = 52428800
+        receive-buffer-size = 52428800
+      }
+    }
+
+    cluster {
+      seed-nodes = ["akka.tcp://opendaylight-cluster-data@127.0.0.1:2550"]
+
+      seed-node-timeout = 12s
+
+      auto-down-unreachable-after = 30s
+
+      roles = [
+        "member-1"
+      ]
+
+    }
+  }
+}