usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject usergrid git commit: Make unique value actor system logic more configurable.
Date Mon, 15 Aug 2016 20:54:25 GMT
Repository: usergrid
Updated Branches:
  refs/heads/master 77b6573e4 -> f91960371


Make unique value actor system logic more configurable.


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

Branch: refs/heads/master
Commit: f919603718fe3445e33e69f08b0b677cba678f72
Parents: 77b6573
Author: Michael Russo <mrusso@apigee.com>
Authored: Mon Aug 15 13:53:59 2016 -0700
Committer: Michael Russo <mrusso@apigee.com>
Committed: Mon Aug 15 13:53:59 2016 -0700

----------------------------------------------------------------------
 .../main/resources/usergrid-default.properties   |  4 ++--
 .../collection/uniquevalues/UniqueValuesFig.java | 19 ++++++++++++++++++-
 .../uniquevalues/UniqueValuesServiceImpl.java    | 10 +++++-----
 3 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/f9196037/stack/config/src/main/resources/usergrid-default.properties
----------------------------------------------------------------------
diff --git a/stack/config/src/main/resources/usergrid-default.properties b/stack/config/src/main/resources/usergrid-default.properties
index 1385216..d153ef1 100644
--- a/stack/config/src/main/resources/usergrid-default.properties
+++ b/stack/config/src/main/resources/usergrid-default.properties
@@ -449,8 +449,8 @@ collection.uniquevalues.cache.ttl=10
 # TTL of a unique value reservation when written to Cassandra
 collection.uniquevalues.reservation.ttl=10
 
-# The default authoritative region for when is not specified elsewhere
-collection.uniquevalues.authoritative.region=default
+# The default authoritative region for when is not specified elsewhere; by default leave
this empty
+collection.uniquevalues.authoritative.region=
 
 
 ##############################  Usergrid Scheduler  ###########################

http://git-wip-us.apache.org/repos/asf/usergrid/blob/f9196037/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesFig.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesFig.java
index edd0cbe..a220adc 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesFig.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesFig.java
@@ -36,6 +36,10 @@ public interface UniqueValuesFig extends GuicyFig, Serializable {
 
     String UNIQUEVALUE_AUTHORITATIVE_REGION = "collection.uniquevalues.authoritative.region";
 
+    String UNIQUEVALUE_REQUEST_TIMEOUT = "collection.uniquevalues.request.timeout";
+
+    String UNIQUEVALUE_REQUEST_RETRY_COUNT = "collection.uniquevalues.request.retrycount";
+
 
     /**
      * Unique Value cache TTL in seconds.
@@ -62,6 +66,19 @@ public interface UniqueValuesFig extends GuicyFig, Serializable {
      * Primary authoritative region (used if none other specified).
      */
     @Key(UNIQUEVALUE_AUTHORITATIVE_REGION)
-    @Default("default")
     String getAuthoritativeRegion();
+
+    /**
+     * Number of milliseconds before timing out the unique value request to the Actor System
+     */
+    @Key(UNIQUEVALUE_REQUEST_TIMEOUT)
+    @Default("5000")
+    int getRequestTimeout();
+
+    /**
+     * Number of actor instances to create on each.
+     */
+    @Key(UNIQUEVALUE_REQUEST_RETRY_COUNT)
+    @Default("2")
+    int getRequestRetryCount();
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/f9196037/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 777029f..8bdb02c 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
@@ -220,13 +220,13 @@ public class UniqueValuesServiceImpl implements UniqueValuesService
{
     private void sendUniqueValueRequest(
         Entity entity, String region, UniqueValueActor.Request request ) throws UniqueValueException
{
 
-        int maxRetries = 5;
+        int maxRetries = uniqueValuesFig.getRequestRetryCount();
         int retries = 0;
 
         UniqueValueActor.Response response = null;
         while ( retries++ < maxRetries ) {
             try {
-                Timeout t = new Timeout( 1, TimeUnit.SECONDS );
+                Timeout t = new Timeout( uniqueValuesFig.getRequestTimeout(), TimeUnit.MILLISECONDS
);
 
                 Future<Object> fut;
 
@@ -256,15 +256,15 @@ public class UniqueValuesServiceImpl implements UniqueValuesService
{
                     break;
 
                 } else if ( response != null  ) {
-                    logger.debug("ERROR status retrying {} entity {} rowkey {}",
+                    logger.warn("ERROR status retrying {} entity {} rowkey {}",
                             retries, entity.getId().getUuid(), request.getConsistentHashKey());
                 } else {
-                    logger.debug("Timed-out retrying {} entity {} rowkey",
+                    logger.warn("Timed-out retrying {} entity {} rowkey",
                             retries, entity.getId().getUuid(), request.getConsistentHashKey());
                 }
 
             } catch ( Exception e ) {
-                logger.debug("{} caused retry {} for entity {} rowkey {}",
+                logger.error("{} caused retry {} for entity {} rowkey {}",
                     e.getClass().getSimpleName(), retries, entity.getId().getUuid(), request.getConsistentHashKey());
             }
         }


Mime
View raw message