-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
Allow rejection of bulk items before processing #26434
Conversation
Adds support for bulk items to be rejected (i.e. failed) before they are processed by the TransportShardBulkAction. This can be used by an ActionFilter to reject a subset of the items in a bulk action without rejecting the whole action (or all the items for a shard).
@@ -120,8 +119,10 @@ protected boolean resolveIndex() { | |||
final IndexMetaData metaData = primary.indexSettings().getIndexMetaData(); | |||
Translog.Location location = null; | |||
for (int requestIndex = 0; requestIndex < request.items().length; requestIndex++) { | |||
location = executeBulkItemRequest(metaData, primary, request, location, requestIndex, | |||
if (request.items()[requestIndex].getPrimaryResponse() == null) { |
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.
this is tricky - see here, which shows we may have a primary response, but still execute the item... I'm not sure it's wrong, I saying "watch out" ...
Also reverts BWC checks to production-ready state
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.
LGTM. Left some nits.
*/ | ||
public void abort(String index, Exception cause) { | ||
if (primaryResponse != null) { | ||
throw new IllegalStateException("Item already has a response (status=" + primaryResponse.status() + ")"); |
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.
shall we make this an assertion so the node dies?
} | ||
BulkShardRequest bulkShardRequest = new BulkShardRequest(shardId, RefreshPolicy.NONE, items); | ||
|
||
// Preemptively reject one of the bulk items, but allow the others to proceed |
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.
reject -> abort
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.
LGTM.
* master: Allow abort of bulk items before processing (elastic#26434) [Tests] Improve testing of FieldSortBuilder (elastic#26437) Upgrade to lucene-7.0.0-snapshot-d94a5f0. (elastic#26441) Implement adaptive replica selection (elastic#26128) Build: Quiet bwc build output (elastic#26430) Migrate Search requests to use Writeable reading strategies (elastic#26428) Changed version from 7.0.0-alpha1 to 6.1.0 in the nested sorting serialization check. Remove dead path conf BWC code in build
In some cases a request can already be aborted and retried. This means the condition that aborting a request should only happen when an item has not been processed yet is too strict. This commit allows for a double abort. If we attempt to abort an operation that was previously processed but not aborted, we treat that as a hard failure. Relates #26434
Adds support for bulk items to be aborted before they are processed by the TransportShardBulkAction. This can be used by an ActionFilter to reject a subset of the items in a bulk action without rejecting the whole action (or all the items for a shard).
In some cases a request can already be aborted and retried. This means the condition that aborting a request should only happen when an item has not been processed yet is too strict. This commit allows for a double abort. If we attempt to abort an operation that was previously processed but not aborted, we treat that as a hard failure. Relates #26434
Adds support for bulk items to be aborted before they are processed by the TransportShardBulkAction. This can be used by an ActionFilter to reject a subset of the items in a bulk action without rejecting the whole action (or all the items for a shard).
In some cases a request can already be aborted and retried. This means the condition that aborting a request should only happen when an item has not been processed yet is too strict. This commit allows for a double abort. If we attempt to abort an operation that was previously processed but not aborted, we treat that as a hard failure. Relates #26434
Adds support for bulk items to be aborted before they are processed by the TransportShardBulkAction. This can be used by an ActionFilter to reject a subset of the items in a bulk action without rejecting the whole action (or all the items for a shard).
In some cases a request can already be aborted and retried. This means the condition that aborting a request should only happen when an item has not been processed yet is too strict. This commit allows for a double abort. If we attempt to abort an operation that was previously processed but not aborted, we treat that as a hard failure. Relates #26434
Adds support for bulk items to be aborted before they are processed by the TransportShardBulkAction. This can be used by an ActionFilter to reject a subset of the items in a bulk action without rejecting the whole action (or all the items for a shard).
In some cases a request can already be aborted and retried. This means the condition that aborting a request should only happen when an item has not been processed yet is too strict. This commit allows for a double abort. If we attempt to abort an operation that was previously processed but not aborted, we treat that as a hard failure. Relates #26434
Adds support for bulk items to be rejected (i.e. failed) before they are processed by the TransportShardBulkAction.
This can be used by an ActionFilter to reject a subset of the items in a bulk action without rejecting the whole action (or all the items for a shard).