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

Expose batched_reduce_size via _search #23288

Merged
merged 9 commits into from
Feb 21, 2017

Conversation

s1monw
Copy link
Contributor

@s1monw s1monw commented Feb 21, 2017

In #23253 we added the ability to incrementally reduce search results.
This change exposes the parameter to control the batch size and therefore
the memory consumption of a large search request.

In elastic#23253 we added an the ability to incrementally reduce search results.
This change exposes the parameter to control the batch since and therefore
the memory consumption of a large search request.
Copy link
Contributor

@clintongormley clintongormley left a comment

Choose a reason for hiding this comment

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

LGTM, but it's missing the doc changes.

},
"batched_reduce_size" : {
"type" : "number",
"description" : "The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large."
Copy link
Contributor

Choose a reason for hiding this comment

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

add

"default" : 512

@s1monw
Copy link
Contributor Author

s1monw commented Feb 21, 2017

LGTM, but it's missing the doc changes.

I am not sure what you mean? I didn't add a documentation for this since it's so specialized. I want to expose it once we remove the softlimit?

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.

I think it'd be useful to return the number of reduction phases that we did so we can add a test that asserts that we did the right number. Just to make sure we didn't drop setting the parameter on the floor. I'm fine with you doing that in a followup or doing it myself since I'm the one that wants it.

@@ -60,7 +60,7 @@ public RandomizingClient(Client client, Random random) {

@Override
public SearchRequestBuilder prepareSearch(String... indices) {
return in.prepareSearch(indices).setSearchType(defaultSearchType).setPreference(defaultPreference).setReduceUpTo(reduceUpTo);
return in.prepareSearch(indices).setSearchType(defaultSearchType).setPreference(defaultPreference).setBatchedReduceSize(reduceUpTo);
Copy link
Member

Choose a reason for hiding this comment

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

Do you want to rename reduceUpTo here as well?

@s1monw
Copy link
Contributor Author

s1monw commented Feb 21, 2017

I think it'd be useful to return the number of reduction phases that we did so we can add a test that asserts that we did the right number. Just to make sure we didn't drop setting the parameter on the floor. I'm fine with you doing that in a followup or doing it myself since I'm the one that wants it.

I don't think we should clutter the API with such an internal optimization. What do you expect from it?

@nik9000
Copy link
Member

nik9000 commented Feb 21, 2017

What do you expect from it?

Just to know if the parameter had any effect at all. Right now you can't tell.

@s1monw
Copy link
Contributor Author

s1monw commented Feb 21, 2017

Just to know if the parameter had any effect at all. Right now you can't tell.

this argument is odd. We are testing it throughout the stack with unittests and we know it's passed to the SearchRequest since there is the exception coming from. We can't pass any pointers back just for the integration test sake?

@nik9000
Copy link
Member

nik9000 commented Feb 21, 2017

Once we've removed the limit we can test with a really large reduce. We'll want to do that anyway. I like returning the reduction count as well because it is simpler to debug if it fails and because it'll give us more information if the huge reduce fails and the reduction count test doesn't. I'm ok with not doing the test.

@s1monw
Copy link
Contributor Author

s1monw commented Feb 21, 2017

Once we've removed the limit we can test with a really large reduce. We'll want to do that anyway. I like returning the reduction count as well because it is simpler to debug if it fails and because it'll give us more information if the huge reduce fails and the reduction count test doesn't. I'm ok with not doing the test.

we have a whole bunch of tests for this that were added in the original PR

@s1monw
Copy link
Contributor Author

s1monw commented Feb 21, 2017

I spoke to @nik9000 and I start to agree we should have this response parameter especially for debugging purposes of this feature at the users end. I added new commits.

@@ -179,13 +179,6 @@ public void scrollId(String scrollId) {
return internalResponse.profile();
}

static final class Fields {
Copy link
Member

Choose a reason for hiding this comment

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

❤️

@clintongormley
Copy link
Contributor

I am not sure what you mean? I didn't add a documentation for this since it's so specialized. I want to expose it once we remove the softlimit?

OK

@s1monw s1monw merged commit ce625eb into elastic:master Feb 21, 2017
@s1monw s1monw deleted the expose_batched_reduce_size branch February 21, 2017 17:37
s1monw added a commit that referenced this pull request Feb 21, 2017
The assertion that if there are buffered aggs at least one incremental
reduce phase should have happened doens't hold if there are shard failure.
This commit removes this assertion.

Relates to #23288
s1monw added a commit to s1monw/elasticsearch that referenced this pull request Feb 22, 2017
Both PRs below have been backported to 5.4 such that we can enable
BWC tests of this feature as well as remove version dependend serialization
for search request / responses.

Relates to elastic#23288
Relates to elastic#23253
s1monw added a commit that referenced this pull request Feb 22, 2017
In #23253 we added an the ability to incrementally reduce search results.
This change exposes the parameter to control the batch since and therefore
the memory consumption of a large search request.
s1monw added a commit that referenced this pull request Feb 22, 2017
The assertion that if there are buffered aggs at least one incremental
reduce phase should have happened doens't hold if there are shard failure.
This commit removes this assertion.

Relates to #23288
s1monw added a commit that referenced this pull request Feb 22, 2017
Both PRs below have been backported to 5.4 such that we can enable
BWC tests of this feature as well as remove version dependend serialization
for search request / responses.

Relates to #23288
Relates to #23253
builder.field("terminated_early", isTerminatedEarly());
}
if (getNumReducePhases() != 1) {
builder.field("num_reduce_phases", getNumReducePhases());
Copy link
Member

Choose a reason for hiding this comment

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

❤️

Mpdreamz added a commit to elastic/elasticsearch-net that referenced this pull request May 2, 2017
clintongormley added a commit that referenced this pull request May 2, 2017
clintongormley added a commit that referenced this pull request May 2, 2017
clintongormley added a commit that referenced this pull request May 2, 2017
Mpdreamz added a commit to elastic/elasticsearch-net that referenced this pull request May 4, 2017
Mpdreamz added a commit to elastic/elasticsearch-net that referenced this pull request May 4, 2017
Mpdreamz added a commit to elastic/elasticsearch-net that referenced this pull request May 4, 2017
* Updated api gen to 5.4 and added a way to patch specification files

through special *.patch.json companion files. Due to pending discusion
on
elastic/elasticsearch@e579629
:q!

* updated x-pack spec to 5.4

* add codegen part for xpack info related APIs

* Added support for Field Caps API

* add support for RemoteInfo API and adds cross cluster support to IndexName

* added support for SourceExists()

* add skipversion, eventhough this API existed it was undocumented prior to 5.4

* expose word delimiter graph token filter as per elastic/elasticsearch#23327

* spaces=>tabs

* expose num_reduce_phases as per elastic/elasticsearch#23288

* implemented XPackInfo() started on XPackUsage()

* added response structure for XPackUsage()

* change license date from DateTime to DateTimeOffset'

* implement PR feedback on #2743

* remove explicit folder includes in csproj files
Mpdreamz added a commit to elastic/elasticsearch-net that referenced this pull request May 4, 2017
Conflicts:
	src/Nest/Search/Search/SearchResponse.cs
awelburn pushed a commit to Artesian/elasticsearch-net that referenced this pull request Nov 6, 2017
Conflicts:
	src/Nest/Search/Search/SearchResponse.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories v5.4.0 v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants