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

Added soft limit to open scroll contexts #25244 #36009

Merged
merged 4 commits into from
Dec 3, 2018
Merged

Added soft limit to open scroll contexts #25244 #36009

merged 4 commits into from
Dec 3, 2018

Conversation

joaofcmb
Copy link
Contributor

Missing updated documentation. Will be added later.

Since development had already begun on this issue before the suggestions made by @geekpete , we thought it would be best to first make a pull request for the initial situation.

Closes #25244

@jimczi jimczi added >feature :Search/Search Search-related issues that do not fall into other categories v7.0.0 labels Nov 28, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

Thanks @joaofcmb , the pr looks good. I left some comments and questions.

@@ -696,6 +710,7 @@ public boolean freeContext(long id) {
assert context.refCount() > 0 : " refCount must be > 0: " + context.refCount();
context.indexShard().getSearchOperationListener().onFreeContext(context);
if (context.scrollContext() != null) {
openScrollContexts.decrementAndGet();
Copy link
Contributor

Choose a reason for hiding this comment

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

we should also check the scroll contexts in freeAllContextForIndex above ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't freeAllContextForIndex simply call freeContext ? Am I supposed to do any extra processing here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry my bad, it does call freeContext

@@ -145,6 +146,9 @@
public static final Setting<Boolean> DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS =
Setting.boolSetting("search.default_allow_partial_results", true, Property.Dynamic, Property.NodeScope);

public static final Setting<Integer> MAX_OPEN_SCROLL_CONTEXT =
Setting.intSetting("search.max_open_scroll_context", 150, 0, Property.NodeScope);
Copy link
Contributor

Choose a reason for hiding this comment

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

This setting should be dynamic, you should extract the value in the SearchService ctr and register an update consumer. DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS is a good example of how to do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be dynamic now. Please review the changes.

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

Thanks @joaofcmb , the code looks good. Can you add a note in the docs ?

@@ -145,6 +146,9 @@
public static final Setting<Boolean> DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS =
Setting.boolSetting("search.default_allow_partial_results", true, Property.Dynamic, Property.NodeScope);

public static final Setting<Integer> MAX_OPEN_SCROLL_CONTEXT =
Setting.intSetting("search.max_open_scroll_context", 150, 0, Property.Dynamic, Property.NodeScope);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's start at 500 ? That's the number we agreed on in #29252.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, i'll change it while I update the docs

@jimczi
Copy link
Contributor

jimczi commented Dec 3, 2018

@elasticmachine test this please

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

Thanks @joaofcmb , the changes look good. The tests are running on CI now and I'll merge if they succeed.

@jimczi
Copy link
Contributor

jimczi commented Dec 3, 2018

@elasticmachine test this please

@jimczi jimczi added the v6.6.0 label Dec 3, 2018
Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

Thanks @joaofcmb . I'll backport to 6.x but will set the default to unlimited in this version.

@jimczi jimczi merged commit d27aa72 into elastic:master Dec 3, 2018
jimczi pushed a commit to jimczi/elasticsearch that referenced this pull request Dec 3, 2018
This change adds a soft limit to open scroll contexts that can be controlled with the dynamic cluster setting `search.max_open_scroll_context` (defaults to 500).
jimczi added a commit that referenced this pull request Dec 4, 2018
This change adds a soft limit to open scroll contexts that can be controlled with the dynamic cluster setting `search.max_open_scroll_context` (defaults to unlimited).

Relates #36009
spinscale pushed a commit that referenced this pull request Dec 4, 2018
This change adds a soft limit to open scroll contexts that can be controlled with the dynamic cluster setting `search.max_open_scroll_context` (defaults to 500).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>feature :Search/Search Search-related issues that do not fall into other categories v6.6.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants