usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [09/16] incubator-usergrid git commit: Added equivalent two-dot-o search/write timeouts to ES Search and Buffer Consumer.
Date Tue, 21 Apr 2015 15:55:18 GMT
Added equivalent two-dot-o search/write timeouts to ES Search and Buffer Consumer.


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

Branch: refs/heads/USERGRID-578
Commit: 2ae6a3d1562e999af94c9f13dd5db81558d6ef0b
Parents: 078666e
Author: GERey <greyes@apigee.com>
Authored: Mon Apr 20 10:06:33 2015 -0700
Committer: GERey <greyes@apigee.com>
Committed: Mon Apr 20 10:06:33 2015 -0700

----------------------------------------------------------------------
 .../apache/usergrid/persistence/index/IndexFig.java  | 15 +++++++++++++++
 .../index/impl/EsApplicationEntityIndexImpl.java     |  4 +++-
 .../index/impl/EsIndexBufferConsumerImpl.java        |  2 +-
 3 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ae6a3d1/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
index d13d055..47b25ae 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
@@ -71,6 +71,13 @@ public interface IndexFig extends GuicyFig {
     String QUERY_LIMIT_DEFAULT = "index.query.limit.default";
 
 
+    /**
+     * Timeout calls to elasticsearch.
+     * @return
+     */
+    public static final String ELASTICSEARCH_QUERY_TIMEOUT = "elasticsearch.query.timeout";
+
+    public static final String ELASTICSEARCH_WRITE_TIMEOUT= "elasticsearch.write.timeout";
 
     /**
      * The client type to use.  Valid values are NODE or TRANSPORT
@@ -177,5 +184,13 @@ public interface IndexFig extends GuicyFig {
     @Key("elasticsearch.refresh_sleep_ms")
     @Default("200")
     long refreshSleep();
+    
+    @Default( "5000" )
+    @Key( ELASTICSEARCH_QUERY_TIMEOUT )
+    long getQueryTimeout();
+
+    @Default( "5000" )
+    @Key( ELASTICSEARCH_WRITE_TIMEOUT )
+    long getWriteTimeout();
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ae6a3d1/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsApplicationEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsApplicationEntityIndexImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsApplicationEntityIndexImpl.java
index 0986ff6..43b55d0 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsApplicationEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsApplicationEntityIndexImpl.java
@@ -95,6 +95,7 @@ public class EsApplicationEntityIndexImpl implements ApplicationEntityIndex
{
     private final SearchRequestBuilderStrategy searchRequest;
     private FailureMonitor failureMonitor;
     private final int cursorTimeout;
+    private final long queryTimeout;
 
 
     @Inject
@@ -118,6 +119,7 @@ public class EsApplicationEntityIndexImpl implements ApplicationEntityIndex
{
         this.searchTimer = metricsFactory.getTimer( EsApplicationEntityIndexImpl.class, "search.timer"
);
         this.cursorTimer = metricsFactory.getTimer( EsApplicationEntityIndexImpl.class, "search.cursor.timer"
);
         this.cursorTimeout = config.getQueryCursorTimeout();
+        this.queryTimeout = config.getWriteTimeout();
 
         this.deleteApplicationTimer =
                 metricsFactory.getTimer( EsApplicationEntityIndexImpl.class, "delete.application"
);
@@ -163,7 +165,7 @@ public class EsApplicationEntityIndexImpl implements ApplicationEntityIndex
{
         try {
             //Added For Graphite Metrics
             Timer.Context timeSearch = searchTimer.time();
-            searchResponse = srb.execute().actionGet();
+            searchResponse = srb.execute().actionGet(queryTimeout);
             timeSearch.stop();
         }
         catch ( Throwable t ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ae6a3d1/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
index 6bcc405..7cc7dcf 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
@@ -209,7 +209,7 @@ public class EsIndexBufferConsumerImpl implements IndexBufferConsumer
{
 
 
         try {
-            responses = bulkRequest.execute().actionGet();
+            responses = bulkRequest.execute().actionGet(indexFig.getWriteTimeout());
         }
         catch ( Throwable t ) {
             log.error( "Unable to communicate with elasticsearch" );


Mime
View raw message