[
https://issues.apache.org/jira/browse/METRON-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15536036#comment-15536036
]
ASF GitHub Bot commented on METRON-326:
---------------------------------------
Github user justinleet commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/286#discussion_r81340588
--- Diff:
metron-platform/metron-writer/src/main/java/org/apache/metron/writer/WriterToBulkWriter.java
---
@@ -44,11 +45,15 @@ public void init(Map stormConf, WriterConfiguration
config) throws Exception {
}
@Override
- public void write(String sensorType, WriterConfiguration configurations,
Iterable<Tuple> tuples, List<MESSAGE_T> messages) throws Exception {
+ public BulkWriterResponse write(String sensorType, WriterConfiguration
configurations, Iterable<Tuple> tuples, List<MESSAGE_T> messages) throws
Exception {
if(messages.size() > 1) {
throw new IllegalStateException("WriterToBulkWriter expects a batch
of exactly 1");
}
messageWriter.write(sensorType, configurations,
Iterables.getFirst(tuples, null), Iterables.getFirst(messages, null));
+
+ BulkWriterResponse response = new BulkWriterResponse();
--- End diff --
Right now, the Exception handling path is slightly different from the main
path, and would just treat everything as failures, regardless. The
BulkWriterComponent catches exceptions and uses its complete list to mark
everything as failed regardless of what the response is.
The write() method interface does note in the comments that an exception
should be treated as a full batch failure, but it could pretty easily be
modified to catch the exception, mark failures and kick it back up that way. I
left it as-is, because that matches current behavior exactly. At that point,
I'd want to do the same thing for all the implementations (hbase, etc.)
> Error Handling in ElasticsearchWriter
> -------------------------------------
>
> Key: METRON-326
> URL: https://issues.apache.org/jira/browse/METRON-326
> Project: Metron
> Issue Type: Bug
> Reporter: Ajay Yadav
> Assignee: Justin Leet
>
> In Elasticsearch writer we raise a exception if BulkResponse object has
> failures and that results in failing the whole batch even if some objects
> failed in it. This has spiral effect specially when there is continuous
> stream of bad messages and errorStream is tied to indexingBolt.
> If possible we should iterate through items in BulkResponse object and send
> only failed messages to errorStream.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)