Github user rmetzger commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3358#discussion_r102204385
  
    --- Diff: 
flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/streaming/connectors/elasticsearch/ElasticsearchSinkBase.java
 ---
    @@ -165,20 +286,36 @@ public void beforeBulk(long executionId, BulkRequest 
request) { }
                                @Override
                                public void afterBulk(long executionId, 
BulkRequest request, BulkResponse response) {
                                        if (response.hasFailures()) {
    -                                           for (BulkItemResponse itemResp 
: response.getItems()) {
    -                                                   Throwable failure = 
callBridge.extractFailureCauseFromBulkItemResponse(itemResp);
    +                                           BulkItemResponse itemResponse;
    +                                           Throwable failure;
    +
    +                                           for (int i = 0; i < 
response.getItems().length; i++) {
    +                                                   itemResponse = 
response.getItems()[i];
    +                                                   failure = 
callBridge.extractFailureCauseFromBulkItemResponse(itemResponse);
                                                        if (failure != null) {
    -                                                           
LOG.error("Failed Elasticsearch item request: {}", failure.getMessage(), 
failure);
    -                                                           
failureThrowable.compareAndSet(null, failure);
    +                                                           
LOG.error("Failed Elasticsearch item request: {}", 
itemResponse.getFailureMessage(), failure);
    +
    +                                                           if 
(failureHandler.onFailure(request.requests().get(i), failure, requestIndexer)) {
    --- End diff --
    
    Mh. I don't know if the use case I've mentioned makes a lot of sense. 
Probably most of the users just want to use a custom logic to decide how to do 
the retries / discards.
    
    I think we shouldn't do complicated things like checkpointing the state of 
the failure handler. Its good enough if the user keeps it locally (and loses it 
on failure)



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to