You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/07/11 15:35:12 UTC

[02/50] [abbrv] usergrid git commit: Changes to get Akka/UV running on a local cluster, i.e. a couple of Vagrant VMs

Changes to get Akka/UV running on a local cluster, i.e. a couple of Vagrant VMs


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/bf7c3410
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/bf7c3410
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/bf7c3410

Branch: refs/heads/release-2.1.1
Commit: bf7c34100b78645b6677e174e42d828ede1e4fa2
Parents: 8c6387f
Author: Dave Johnson <sn...@apache.org>
Authored: Mon May 2 17:24:32 2016 -0400
Committer: Dave Johnson <sn...@apache.org>
Committed: Mon May 2 17:24:32 2016 -0400

----------------------------------------------------------------------
 stack/core/pom.xml                              |  6 ++++
 .../uniquevalues/UniqueValuesServiceImpl.java   | 37 ++++++++++----------
 stack/corepersistence/common/pom.xml            |  6 ++++
 stack/pom.xml                                   |  6 ----
 .../apache/usergrid/rest/UniqueValuesIT.java    |  4 +--
 .../rest/UniqueValuesPerformanceIT.java         |  6 ++--
 stack/services/pom.xml                          |  6 ++++
 7 files changed, 41 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/bf7c3410/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index 76ff694..090f46b 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -127,6 +127,10 @@
           <artifactId>antlr</artifactId>
           <groupId>org.antlr</groupId>
         </exclusion>
+          <exclusion>
+              <artifactId>netty</artifactId>
+              <groupId>io.netty</groupId>
+          </exclusion>
       </exclusions>
     </dependency>
 
@@ -306,10 +310,12 @@
       <artifactId>jline</artifactId>
     </dependency>
 
+<!--
     <dependency>
       <groupId>org.jboss.netty</groupId>
       <artifactId>netty</artifactId>
     </dependency>
+-->
 
     <!-- Test and Logging Dependencies -->
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bf7c3410/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceImpl.java
index 4d7f505..b365b2b 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesServiceImpl.java
@@ -55,7 +55,7 @@ public class UniqueValuesServiceImpl implements UniqueValuesService {
     AkkaFig akkaFig;
     UniqueValuesTable table;
     private String hostname;
-    private Integer port;
+    private Integer port = null;
     private String currentRegion;
 
     private Map<String, ActorRef> requestActorsByRegion;
@@ -95,8 +95,8 @@ public class UniqueValuesServiceImpl implements UniqueValuesService {
     public void start() {
 
         this.hostname = akkaFig.getHostname();
-        this.port = akkaFig.getPort();
         this.currentRegion = akkaFig.getRegion();
+        this.port = null;
 
         initAkka();
         waitForRequestActors();
@@ -109,8 +109,8 @@ public class UniqueValuesServiceImpl implements UniqueValuesService {
     public void start( String hostname, Integer port, String currentRegion ) {
 
         this.hostname = hostname;
-        this.port = port;
         this.currentRegion = currentRegion;
+        this.port = port;
 
         initAkka();
     }
@@ -196,7 +196,7 @@ public class UniqueValuesServiceImpl implements UniqueValuesService {
             ActorSystem actorSystem = systemMap.get( region );
             if ( !actorSystem.equals( localSystem ) ) {
                 logger.info("Starting ReservationCacheUpdater for {}", region );
-                actorSystem.actorOf( Props.create( ReservationCacheActor.class, region ), "subscriber");
+                actorSystem.actorOf( Props.create( ReservationCacheActor.class ), "subscriber");
             }
         }
     }
@@ -256,6 +256,8 @@ public class UniqueValuesServiceImpl implements UniqueValuesService {
 
         for ( String region : systemMap.keySet() ) {
 
+            logger.info("Creating request actor for region {}", region);
+
             // Each RequestActor needs to know path to ClusterSingletonProxy and region
             ActorRef requestActor = systemMap.get( region ).actorOf(
                     Props.create( RequestActor.class, "/user/uvProxy" ), "requestActor" );
@@ -322,6 +324,8 @@ public class UniqueValuesServiceImpl implements UniqueValuesService {
 
         String[] regionSeeds = akkaFig.getRegionSeeds().split( "," );
 
+        logger.info("Found region {} seeds {}", regionSeeds.length, regionSeeds);
+
         try {
 
             if ( port != null ) {
@@ -329,6 +333,7 @@ public class UniqueValuesServiceImpl implements UniqueValuesService {
                 // we are testing
                 String seed = "akka.tcp://ClusterSystem@" + hostname + ":" + port;
                 seedsByRegion.put( currentRegion, seed );
+                logger.info("Akka testing, only starting one seed");
 
             } else {
 
@@ -344,7 +349,6 @@ public class UniqueValuesServiceImpl implements UniqueValuesService {
                     final Integer regionPort;
 
                     if (port == null) {
-                        // we assume 0th seed has the right port
                         regionPort = Integer.parseInt( regionPortString );
                     } else {
                         regionPort = port; // unless we are testing
@@ -352,6 +356,8 @@ public class UniqueValuesServiceImpl implements UniqueValuesService {
 
                     String seed = "akka.tcp://ClusterSystem@" + hostname + ":" + regionPort;
 
+                    logger.info("Adding seed {} for region {}", seed, region );
+
                     seedsByRegion.put( region, seed );
                 }
 
@@ -366,23 +372,18 @@ public class UniqueValuesServiceImpl implements UniqueValuesService {
             for ( String region : seedsByRegion.keySet() ) {
 
                 List<String> seeds = seedsByRegion.get( region );
-
-                final Integer regionPort;
-
-                if (port == null) {
-                    // we assume 0th seed has the right port
-                    int lastColon = seeds.get(0).lastIndexOf(":") + 1;
-                    regionPort = Integer.parseInt( seeds.get(0).substring( lastColon ));
-                } else {
-                    regionPort = port; // unless we are testing
-                }
+                int lastColon = seeds.get(0).lastIndexOf(":") + 1;
+                final Integer regionPort = Integer.parseInt( seeds.get(0).substring( lastColon ));
 
                 // cluster singletons only run role "io" nodes and NOT on "client" nodes of other regions
                 String clusterRole = currentRegion.equals( region ) ? "io" : "client";
 
-                logger.info( "Config for region {} is:\npoc Akka Hostname {}\npoc Akka Seeds {}\n" +
-                                "poc Akka Port {}\npoc UniqueValueActors per node {}",
-                        region, hostname, seeds, port, numInstancesPerNode );
+                logger.info( "Config for region {} is:\n" +
+                    "poc Akka Hostname {}\n" +
+                    "poc Akka Seeds {}\n" +
+                    "poc Akka Port {}\n" +
+                    "poc UniqueValueActors per node {}",
+                    region, hostname, seeds, port, numInstancesPerNode );
 
                 Map<String, Object> configMap = new HashMap<String, Object>() {{
                     put( "akka", new HashMap<String, Object>() {{

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bf7c3410/stack/corepersistence/common/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/pom.xml b/stack/corepersistence/common/pom.xml
index b47706c..897bb38 100644
--- a/stack/corepersistence/common/pom.xml
+++ b/stack/corepersistence/common/pom.xml
@@ -55,6 +55,12 @@
             <groupId>org.apache.cassandra</groupId>
             <artifactId>cassandra-all</artifactId>
             <version>${cassandra.version}</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>netty</artifactId>
+                    <groupId>io.netty</groupId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bf7c3410/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index a94233e..5eaecd7 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -776,12 +776,6 @@
             </dependency>
 
             <dependency>
-                <groupId>org.jboss.netty</groupId>
-                <artifactId>netty</artifactId>
-                <version>3.2.7.Final</version>
-            </dependency>
-
-            <dependency>
                 <groupId>org.jsoup</groupId>
                 <artifactId>jsoup</artifactId>
                 <version>1.6.0</version>

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bf7c3410/stack/rest/src/test/java/org/apache/usergrid/rest/UniqueValuesIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/UniqueValuesIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/UniqueValuesIT.java
index c1bab62..aa9acfe 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/UniqueValuesIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/UniqueValuesIT.java
@@ -83,7 +83,7 @@ public class UniqueValuesIT {
 
         String randomizer = RandomStringUtils.randomAlphanumeric( 8 );
 
-        String[] targetHosts = {"http://localhost:9090","http://localhost:9090"};
+        String[] targetHosts = {"http://localhost:8080","http://localhost:9090"};
 
         for (int i = 0; i < numUsers; i++) {
 
@@ -171,7 +171,7 @@ public class UniqueValuesIT {
 
         logger.info( "Success count = {}", successCounter.get() );
 
-        logger.info( "Dup count = {}", dupCounter.get() );
+        logger.info( "Rejected dup count = {}", dupCounter.get() );
 
 //        for ( String username : usersCreated.keys() ) {
 //            System.out.println( username );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bf7c3410/stack/rest/src/test/java/org/apache/usergrid/rest/UniqueValuesPerformanceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/UniqueValuesPerformanceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/UniqueValuesPerformanceIT.java
index cb57598..790eee9 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/UniqueValuesPerformanceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/UniqueValuesPerformanceIT.java
@@ -75,7 +75,7 @@ public class UniqueValuesPerformanceIT {
 
         String randomizer = RandomStringUtils.randomAlphanumeric( 8 );
 
-        String[] targetHosts = {"http://localhost:9090","http://localhost:9090"};
+        String[] targetHosts = {"http://localhost:8080","http://localhost:9090"};
 
         final MetricRegistry metrics = new MetricRegistry();
         final Timer responses = metrics.timer( name( UniqueValuesPerformanceIT.class, "responses" ) );
@@ -89,7 +89,7 @@ public class UniqueValuesPerformanceIT {
 
                     // every user gets unique name, no duplicates in this test
                     UUID uuid = UUID.randomUUID();
-                    String username = "uv_test_user_" + randomizer;
+                    String username = "uv_test_user_" + uuid;
 
                     Form form = new Form();
                     form.param( "name", username );
@@ -111,8 +111,6 @@ public class UniqueValuesPerformanceIT {
 
                         } else {
                             String responseBody = response.readEntity( String.class );
-                            int rootCause = responseBody.indexOf( "root cause" );
-                            responseBody = rootCause > 0 ? responseBody.substring( rootCause, rootCause + 100 ) : "";
                             logger.error( "User creation failed status {} - {}", response.getStatus(), responseBody );
                             errorCounter.incrementAndGet();
                         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bf7c3410/stack/services/pom.xml
----------------------------------------------------------------------
diff --git a/stack/services/pom.xml b/stack/services/pom.xml
index c80c58c..d1a97a0 100644
--- a/stack/services/pom.xml
+++ b/stack/services/pom.xml
@@ -287,6 +287,12 @@
         <dependency>
             <groupId>org.apache.jclouds.driver</groupId>
             <artifactId>jclouds-netty</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>netty</artifactId>
+                    <groupId>io.netty</groupId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>