-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenSearch Sink: Add log messages when there is no exception #3532
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,6 +238,13 @@ private BulkOperationRequestResponse handleRetriesAndFailures(final Accumulating | |
if (doRetry) { | ||
if (retryCount % 5 == 0) { | ||
LOG.warn("Bulk Operation Failed. Number of retries {}. Retrying... ", retryCount, e); | ||
if (Objects.isNull(e)) { | ||
for (final BulkResponseItem bulkItemResponse : bulkResponse.items()) { | ||
if (Objects.nonNull(bulkItemResponse.error())) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure that this will be non-null for successful records? Did you test and see no log here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean to say "it will be NULL for successful records"?
|
||
LOG.warn("operation = {}, error = {}", bulkItemResponse.operationType(), bulkItemResponse.error()); | ||
} | ||
} | ||
} | ||
} | ||
bulkRequestNumberOfRetries.increment(); | ||
return new BulkOperationRequestResponse(bulkRequestForRetry, bulkResponse); | ||
|
@@ -248,7 +255,13 @@ private BulkOperationRequestResponse handleRetriesAndFailures(final Accumulating | |
} | ||
|
||
private void handleFailures(final AccumulatingBulkRequest<BulkOperationWrapper, BulkRequest> bulkRequest, final BulkResponse bulkResponse, final Throwable failure) { | ||
LOG.warn("Bulk Operation Failed.", failure); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want the full stack trace here? We know where the exception is thrown from right? Or should this be the following?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function may be called from multiple paths, right? |
||
if (Objects.isNull(failure)) { | ||
for (final BulkResponseItem bulkItemResponse : bulkResponse.items()) { | ||
if (Objects.nonNull(bulkItemResponse.error())) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, let's use |
||
LOG.warn("operation = {}, error = {}", bulkItemResponse.operationType(), bulkItemResponse.error()); | ||
} | ||
} | ||
handleFailures(bulkRequest, bulkResponse.items()); | ||
} else { | ||
handleFailures(bulkRequest, failure); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is that right now we only hit this block I think (or at least that is the case when max_retries is reached). But as long as the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new change, prints "failure" in both cases. If it is non-null, it will be printed. If it is non-null, I think it would be useful. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason
isNull
exists is to help with streams. I think outside of a stream, we should usex == null
.