Skip to content

Conversation

Mpdreamz
Copy link
Member

The current BulkAll() implementation was written to steamroll its way to completion. This leads to a lot of unnecessary request in the case where most documents are expected to fail e.g due to a bad mapping.

This assumption is not clear from the contract nor our docs hence the bug label.

This PR halts BulkAll() if any documents with errors are returned that can not be retried.
It also halts or retries based on the _bulk requests status itself.
It introduces a more explicit FailedOverAllNodes audit event which currently bubbles out as a MaxRetries only.

Finally you can opt in to the streamroll by setting ContinueAfterDroppedDocuments to true which will feed all documents it can not retry to an optional DroppedDocumentCallback which can put it in a DLQ for instance.

Copy link
Contributor

@codebrain codebrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mpdreamz Mpdreamz merged commit ec5ef6f into 6.x Sep 18, 2018
Mpdreamz added a commit that referenced this pull request Sep 18, 2018
* Add more explicit support for what to do when dropped documents are encountered. Now defaults to halting the BulkAll which is a saner default

* fix audit reporting negative durations

* Add FailedOverOnAllNodes audit event

* BulkAll now handles bad responses from the _bulk itself as well and optionally bails out early

* Fixed tests now excepting FailedOverAllNodes

* ContinueAfterDroppedDocuments should not be tested for nullable arg in the code standards test

(cherry picked from commit ec5ef6f)
Mpdreamz added a commit that referenced this pull request Sep 18, 2018
* Add more explicit support for what to do when dropped documents are encountered. Now defaults to halting the BulkAll which is a saner default

* fix audit reporting negative durations

* Add FailedOverOnAllNodes audit event

* BulkAll now handles bad responses from the _bulk itself as well and optionally bails out early

* Fixed tests now excepting FailedOverAllNodes

* ContinueAfterDroppedDocuments should not be tested for nullable arg in the code standards test

(cherry picked from commit ec5ef6f)
@Mpdreamz
Copy link
Member Author

backported to master 5.x

@Mpdreamz Mpdreamz deleted the fix/bulk-all-improvements branch September 18, 2018 11:17
@Mpdreamz
Copy link
Member Author

f7e3262

Introduces a couple of adjustments, the predicate was checking response.IsValid in the Where to select retry and dropped documents. I changed this to a more explict item.IsValid. As this was considering too many non retryable documents as dropped if the request was invalid but the item itself was.

Another change is that the DroppedDocumentCallback is always called no matter if ContinueAfterDroppedDocuments is true or not. If its false it will return the dropped documents of the failed buffer which is very usefull.

This change is now in 6.x and master as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants