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

Fix NOOP bulk updates #32819

Merged
merged 1 commit into from
Aug 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,10 @@ public void markOperationAsExecuted(Engine.Result result) {
/** finishes the execution of the current request, with the response that should be returned to the user */
public void markAsCompleted(BulkItemResponse translatedResponse) {
assertInvariants(ItemProcessingState.EXECUTED);
assert executionResult == null || translatedResponse.getItemId() == executionResult.getItemId();
assert executionResult != null && translatedResponse.getItemId() == executionResult.getItemId();
assert translatedResponse.getItemId() == getCurrentItem().id();

if (translatedResponse.isFailed() == false && requestToExecute != getCurrent()) {
if (translatedResponse.isFailed() == false && requestToExecute != null && requestToExecute != getCurrent()) {
request.items()[currentIndex] = new BulkItemRequest(request.items()[currentIndex].id(), requestToExecute);
}
getCurrentItem().setPrimaryResponse(translatedResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ public void testUpdateDelete() {
assertSameIndices(updateRequest, updateShardActions);
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32808")
public void testBulk() {
String[] bulkShardActions = new String[]{BulkAction.NAME + "[s][p]", BulkAction.NAME + "[s][r]"};
interceptTransportActions(bulkShardActions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,8 @@ public void testNoopUpdateRequest() throws Exception {
assertThat(primaryResponse.getResponse(), equalTo(noopUpdateResponse));
assertThat(primaryResponse.getResponse().getResult(),
equalTo(DocWriteResponse.Result.NOOP));
assertThat(bulkShardRequest.items().length, equalTo(1));
assertEquals(primaryRequest, bulkShardRequest.items()[0]); // check that bulk item was not mutated
assertThat(primaryResponse.getResponse().getSeqNo(), equalTo(SequenceNumbers.UNASSIGNED_SEQ_NO));
}

Expand Down