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

Honor update request timeout #23825

Merged
merged 5 commits into from
Mar 30, 2017

Conversation

jasontedor
Copy link
Member

@jasontedor jasontedor commented Mar 30, 2017

When executing an update request, the request timeout is not transferred to the index/delete request executed on behalf of the update request. This leads to update requests not timing out when they should (e.g., if not all shards are available when the request specifies wait_for_shards=all with a small timeout). This commit causes the index/delete requests to honor the update request timeout.

When executing an update request, the request timeout is not transferred
to the index/delete request executed on behalf of the update
request. This leads to update requests not timing out when they should
(e.g., if not all shards are available when the request specifies
wait_for_shards=all with a small timeout). This commit causes the
index/delete requests to honor the update request timeout.
Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

I think the upsert case has the same problem.

@@ -307,12 +338,12 @@ public void testNowInScript() throws IOException {
Streamable action = result.action();
assertThat(action, instanceOf(IndexRequest.class));
IndexRequest indexAction = (IndexRequest) action;
assertEquals(indexAction.sourceAsMap().get("update_timestamp"), nowInMillis);
assertEquals(nowInMillis, indexAction.sourceAsMap().get("update_timestamp"));
Copy link
Member

Choose a reason for hiding this comment

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

❤️

}
}

private Script mockInlineScript(final String script) {
Copy link
Member

Choose a reason for hiding this comment

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

If we think this makes things more readable we should probably add it as a static method on MockScriptEngine and statically import it in the tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

I pushed f970908.

ESTestCase::randomNonNegativeLong);
final Streamable action = result.action();
if (delete) {
assertThat(action, instanceOf(DeleteRequest.class));
Copy link
Member

Choose a reason for hiding this comment

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

I tend to prefer letting the test throw the ClassCastException rather than asserting this first.

@jasontedor
Copy link
Member Author

I think the upsert case has the same problem.

It should be handled by the index case but I'll add a test to be sure.

@jasontedor
Copy link
Member Author

It should be handled by the index case but I'll add a test to be sure.

You were right, there was a case missing. I pushed 58b4d8c.

@jasontedor jasontedor merged commit 48357e4 into elastic:master Mar 30, 2017
jasontedor added a commit that referenced this pull request Mar 30, 2017
When executing an update request, the request timeout is not transferred
to the index/delete request executed on behalf of the update
request. This leads to update requests not timing out when they should
(e.g., if not all shards are available when the request specifies
wait_for_shards=all with a small timeout). This commit causes the
index/delete requests to honor the update request timeout.

Relates #23825
jasontedor added a commit that referenced this pull request Mar 30, 2017
When executing an update request, the request timeout is not transferred
to the index/delete request executed on behalf of the update
request. This leads to update requests not timing out when they should
(e.g., if not all shards are available when the request specifies
wait_for_shards=all with a small timeout). This commit causes the
index/delete requests to honor the update request timeout.

Relates #23825
@jasontedor
Copy link
Member Author

Thank you @nik9000.

@jasontedor jasontedor deleted the update-request-timeout branch March 30, 2017 18:51
@bleskes
Copy link
Contributor

bleskes commented Mar 30, 2017

LGTM2 (albeit too late to count)

@jasontedor
Copy link
Member Author

LGTM2 (albeit too late to count)

Your thoughts are never too late to count, thank you for looking.

@astefan
Copy link
Contributor

astefan commented Mar 31, 2017

Would be doable to push this to 2.x as well?

@jasontedor
Copy link
Member Author

This is not a critical bug and not a regression, I think that we will not be backporting this one.

@bleskes
Copy link
Contributor

bleskes commented Mar 31, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants