usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject incubator-usergrid git commit: Added server side timeouts instead of client side timeouts.
Date Mon, 20 Apr 2015 18:39:17 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/EsServerSideTimeouts [created] f6129f259


Added server side timeouts instead of client side timeouts.


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

Branch: refs/heads/EsServerSideTimeouts
Commit: f6129f259ca3d241c12927e82a8f1ca2e4be6b7a
Parents: 472ccaf
Author: GERey <greyes@apigee.com>
Authored: Mon Apr 20 11:39:15 2015 -0700
Committer: GERey <greyes@apigee.com>
Committed: Mon Apr 20 11:39:15 2015 -0700

----------------------------------------------------------------------
 .../persistence/index/impl/EsEntityIndexImpl.java         | 10 ++++++----
 .../persistence/index/impl/EsIndexBufferConsumerImpl.java |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f6129f25/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 9add426..427d82e 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -60,6 +60,7 @@ import org.elasticsearch.action.search.SearchScrollRequestBuilder;
 import org.elasticsearch.client.AdminClient;
 import org.elasticsearch.common.settings.ImmutableSettings;
 import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.unit.TimeValue;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.common.xcontent.XContentFactory;
 import org.elasticsearch.index.query.*;
@@ -452,7 +453,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
             try {
                 //Added For Graphite Metrics
                 Timer.Context timeSearch = searchTimer.time();
-                searchResponse = srb.execute().actionGet(config.getQueryTimeout());
+                searchResponse = srb.setTimeout( TimeValue.timeValueMillis(config.getQueryTimeout())
).get();
                 timeSearch.stop();
             }
             catch ( Throwable t ) {
@@ -476,7 +477,8 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
             //now get the cursor from the map  and validate
             final String esScrollCursor  = mapManager.getString( userCursorString );
 
-            Preconditions.checkArgument(esScrollCursor != null, "Could not find a cursor
for the value '{}' ",  esScrollCursor);
+            Preconditions.checkArgument( esScrollCursor != null, "Could not find a cursor
for the value '{}' ",
+                esScrollCursor );
 
 
 
@@ -484,12 +486,12 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
 
 
             SearchScrollRequestBuilder ssrb = esProvider.getClient()
-                    .prepareSearchScroll(esScrollCursor).setScroll( cursorTimeout + "m" );
+                    .prepareSearchScroll( esScrollCursor ).setScroll( cursorTimeout + "m"
);
 
             try {
                 //Added For Graphite Metrics
                 Timer.Context timeSearchCursor = cursorTimer.time();
-                searchResponse = ssrb.execute().actionGet(config.getQueryTimeout());
+                searchResponse = ssrb.execute().actionGet();
                 timeSearchCursor.stop();
             }
             catch ( Throwable t ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f6129f25/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 f0f6427..2110923 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
@@ -31,6 +31,7 @@ import org.elasticsearch.action.bulk.BulkItemResponse;
 import org.elasticsearch.action.bulk.BulkRequestBuilder;
 import org.elasticsearch.action.bulk.BulkResponse;
 import org.elasticsearch.client.Client;
+import org.elasticsearch.common.unit.TimeValue;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -315,7 +316,7 @@ public class EsIndexBufferConsumerImpl implements IndexBufferConsumer
{
         final BulkResponse responses;
 
         try {
-            responses = bulkRequest.execute().actionGet(config.getWriteTimeout());
+            responses = bulkRequest.setTimeout( TimeValue.timeValueMillis(config.getWriteTimeout())
).get();
         } catch (Throwable t) {
             log.error("Unable to communicate with elasticsearch");
             failureMonitor.fail("Unable to execute batch", t);


Mime
View raw message