[ 
https://issues.apache.org/jira/browse/BEAM-3026?focusedWorklogId=131992&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-131992
 ]

ASF GitHub Bot logged work on BEAM-3026:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Aug/18 18:39
            Start Date: 07/Aug/18 18:39
    Worklog Time Spent: 10m 
      Work Description: timrobertson100 commented on a change in pull request 
#6146: BEAM-3026 Adding retrying behavior on ElasticSearchIO for 429: Too Many 
Requests
URL: https://github.com/apache/beam/pull/6146#discussion_r208341739
 
 

 ##########
 File path: 
sdks/java/io/elasticsearch-tests/elasticsearch-tests-5/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOTest.java
 ##########
 @@ -216,4 +231,42 @@ public void testWritePartialUpdate() throws Exception {
     elasticsearchIOTestCommon.setPipeline(pipeline);
     elasticsearchIOTestCommon.testWritePartialUpdate();
   }
+
+  @Test
+  public void testDefaultRetryPredicate() throws IOException {
+    assertFalse(DEFAULT_RETRY_PREDICATE.test(new IOException("test")));
+    String x =
+        "{ \"index\" : { \"_index\" : \"test\", \"_type\" : \"doc\", \"_id\" : 
\"1\" } }\n"
+            + "{ \"field1\" : @ }\n";
+    HttpEntity entity = new NStringEntity(x, ContentType.APPLICATION_JSON);
+
+    Response response =
+        getRestClient().performRequest("POST", "/_bulk", 
Collections.emptyMap(), entity);
+    //Cannnot create a mock Response, so tried with a bulk request and 
expecting 400 code.
 
 Review comment:
   Inline comment not necessary

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 131992)
    Time Spent: 1h 40m  (was: 1.5h)

> Improve retrying in ElasticSearch client
> ----------------------------------------
>
>                 Key: BEAM-3026
>                 URL: https://issues.apache.org/jira/browse/BEAM-3026
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-elasticsearch
>            Reporter: Tim Robertson
>            Assignee: Ravi Pathak
>            Priority: Major
>             Fix For: 2.6.0
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Currently an overloaded ES server will result in clients failing fast.
> I suggest implementing backoff pauses.  Perhaps something like this:
> {code}
>     ElasticsearchIO.ConnectionConfiguration conn = 
> ElasticsearchIO.ConnectionConfiguration
>       .create(new String[]{"http://...:9200"}, "test", "test")
>       .retryWithWaitStrategy(WaitStrategies.exponentialBackoff(1000, 
> TimeUnit.MILLISECONDS)
>       .retryWithStopStrategy(StopStrategies.stopAfterAttempt(10)
>     );
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to