Skip to content
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

Merged
merged 9 commits into from
Aug 31, 2017

Conversation

tvernum
Copy link
Contributor

@tvernum tvernum commented Aug 30, 2017

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).

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) {
Copy link
Contributor

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" ...

Copy link
Contributor

@bleskes bleskes left a 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() + ")");
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

reject -> abort

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

LGTM.

@tvernum tvernum merged commit eb87df9 into elastic:master Aug 31, 2017
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Aug 31, 2017
* 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
jasontedor added a commit that referenced this pull request Aug 31, 2017
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
jasontedor pushed a commit that referenced this pull request Aug 31, 2017
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).
jasontedor added a commit that referenced this pull request Aug 31, 2017
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
jasontedor pushed a commit that referenced this pull request Aug 31, 2017
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).
jasontedor added a commit that referenced this pull request Aug 31, 2017
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
jasontedor pushed a commit that referenced this pull request Aug 31, 2017
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).
jasontedor added a commit that referenced this pull request Aug 31, 2017
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
jasontedor pushed a commit that referenced this pull request Aug 31, 2017
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).
jasontedor added a commit that referenced this pull request Aug 31, 2017
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
@lcawl lcawl removed the v6.1.0 label Dec 12, 2017
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants