Adding BulkProcessor2.addWithBackpressure()#94599
Merged
masseyke merged 2 commits intoelastic:mainfrom Mar 21, 2023
Merged
Conversation
Collaborator
|
Pinging @elastic/es-data-management (Team:Data Management) |
jbaiera
approved these changes
Mar 21, 2023
| add(request); | ||
| successfullyAdded = true; | ||
| } catch (EsRejectedExecutionException e) { | ||
| logger.trace("Rollup doc rejected, and will try again"); |
Member
There was a problem hiding this comment.
Nit: Lets make the trace message more generic, i.e. remove "Rollup"
Member
Author
There was a problem hiding this comment.
Oops, missed that in the port from it's original location!
| boolean successfullyAdded = false; | ||
| while (successfullyAdded == false) { | ||
| if (shouldAbort.get()) { | ||
| throw new EsRejectedExecutionException("Rejecting request because shouldAbort is now true"); |
Member
There was a problem hiding this comment.
Nit: mentioning shouldAbort is a little weird here, should we reformat the message to just say that the caller has cancelled the bulk operation?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Most clients of BulkProcessor are OK with using it asynchronously. For example failing to load a single ILM history record does not impact what we do with other ILM history records. But some clients do care. For example if we are downsampling a TSDB index we want to abort if a single entry does not make it.
This PR adds a method called addWithBackpressure() to BulkProcessor2. This method is similar to the add() method that already exists, except that it blocks the calling thread until there is room to add the request.
This code is ported from code that was originally in RollupShardIndexer in #94197.