rinkako opened a new pull request #12707:
URL: https://github.com/apache/flink/pull/12707


   ## What is the purpose of the change
   
   The story is: when a flink job for ingesting large number of records from 
data sources, processing and indexing with Elasticsearch sink failed, we may 
restart it from a specific data set which contains lots of data which already 
sink into ES.
   
   At this case, a `INSERT IGNORE` semantics is necessary, and we use `public 
IndexRequest create(boolean create)` with `true` args and ignore the 409 
restStatusCode at a customized ActionRequestFailureHandler to make it work.
   
   But, the `BulkProcessorListener` always log a error event before it calls 
the `failureHandler` in its `afterBulk` method, and will produce tons of error 
log for document id conflict, which we already know and handle them in 
customized ActionRequestFailureHandler.
   
   Therefore, it seems that the error log action at the 
ActionRequestFailureHandler (either the default IgnoringFailureHandler or a 
custom handler) is more flexible.
   
   ## Brief change log
   
   - Deleted 2 `LOG.error()` in `ElasticsearchSinkBase`
   - Placed `LOG.error()` into 2 implement classes of 
`ActionRequestFailureHandler`: `NoOpFailureHandler` and 
`RetryRejectedExecutionFailureHandler`, so that user can customize their log 
actions
   
   ## Verifying this change
   
   - Implement a custom `ActionRequestFailureHandler` without logging  409 
restStatusCode (or other status that handled at failure handler and no need for 
logging)
   - Build the ElasticSearchSink via Builder and use above custom failure 
handler, and then exceptions can be handled and logged properly (user can 
decide log it or not).
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: yes
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): yes (every 
record in ES sink that fails to index)
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper:  no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented?  not documented
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to