-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Force execution of finish shard bulk request #51957
Changes from 2 commits
5a02d1a
4b0b0eb
ae403e7
07135b2
722236d
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 | ||
---|---|---|---|---|
|
@@ -170,16 +170,28 @@ protected void doRun() throws Exception { | |||
|
||||
@Override | ||||
public void onRejection(Exception e) { | ||||
// Fail all operations after a bulk rejection hit an action that waited for a mapping update and finish the request | ||||
while (context.hasMoreOperationsToExecute()) { | ||||
context.setRequestToExecute(context.getCurrent()); | ||||
final DocWriteRequest<?> docWriteRequest = context.getRequestToExecute(); | ||||
onComplete( | ||||
exceptionToResult( | ||||
e, primary, docWriteRequest.opType() == DocWriteRequest.OpType.DELETE, docWriteRequest.version()), | ||||
context, null); | ||||
} | ||||
finishRequest(); | ||||
// Force the execution to finish the request | ||||
executor.execute(new ActionRunnable<>(listener) { | ||||
|
||||
@Override | ||||
protected void doRun() { | ||||
// Fail all operations after a bulk rejection hit an action that waited for a mapping update and finish the request | ||||
while (context.hasMoreOperationsToExecute()) { | ||||
context.setRequestToExecute(context.getCurrent()); | ||||
final DocWriteRequest<?> docWriteRequest = context.getRequestToExecute(); | ||||
onComplete( | ||||
exceptionToResult( | ||||
e, primary, docWriteRequest.opType() == DocWriteRequest.OpType.DELETE, docWriteRequest.version()), | ||||
context, null); | ||||
} | ||||
finishRequest(); | ||||
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. I was thinking that rather than scheduling only elasticsearch/server/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java Line 160 in 3ad8aa6
The reason I think this is because we're still doing work in 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. I wonder if we should instead let Looking at various Also notice that Finally, notice that I doubt that we careful consider that That said, I think this PR is good and I am not objecting to it going in. Following my suggestion is likely to surface a few additional things to resolve. 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. I made @jasontedor change. I think maybe Henning's comment about maybe 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. @tbrooks8, yes, that is fine, I just found it most natural to put it here. I will open a PR with that change so we can discuss based on that PR instead. |
||||
} | ||||
|
||||
@Override | ||||
public boolean isForceExecution() { | ||||
return true; | ||||
} | ||||
}); | ||||
} | ||||
|
||||
private void finishRequest() { | ||||
|
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.
It's probably worth a comment here why we fork to the executor (since it's not obvious from the code).