-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Conversation
Pinging @elastic/es-search |
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.
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(); |
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.
we should also check the scroll contexts in freeAllContextForIndex
above ?
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.
Doesn't freeAllContextForIndex
simply call freeContext
? Am I supposed to do any extra processing here?
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.
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); |
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.
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.
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.
Should be dynamic now. Please review the changes.
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.
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); |
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.
Let's start at 500
? That's the number we agreed on in #29252.
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.
Sure, i'll change it while I update the docs
@elasticmachine test this please |
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.
Thanks @joaofcmb , the changes look good. The tests are running on CI now and I'll merge if they succeed.
@elasticmachine test this please |
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.
Thanks @joaofcmb . I'll backport to 6.x but will set the default to unlimited in this version.
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).
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