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

Remove Segmented Request #16324

Closed
wants to merge 4 commits into from
Closed

Conversation

Bargs
Copy link
Contributor

@Bargs Bargs commented Jan 26, 2018

Segmented Request was only being used in Discover. It was only actually segmenting requests for old interval based index patterns (and not even for these index patterns in Dashboard). Interval based index patterns are deprecated (cannot be created in 6.0) and will be completely removed in 7.0. The fact that interval based patterns got segmented was an implementation detail of Kibana that is no longer necessary now that ES is smart enough to quickly skip shards that won't return results. The segmented request code creates a huge maintenance burden that prevents us from easily implementing highly requested features like multi-field sorting. This also makes the search fetching behavior more consistent between Discover and Dashboard (which actually relies on the doc table making requests), which will make it easier to extract that logic into a reusable service when we want to rewrite the doc table in React and remove its dependence on Courier.

tl;dr let's get this monkey off our back

@Bargs
Copy link
Contributor Author

Bargs commented Jan 26, 2018

jenkins, test this

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

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

Left a couple of comments inline.

This is awesome! I'm so excited about this. As I was looking through this I noticed that we still have some references to notExpandable. As far as I can tell, notExpandable isn't used anywhere and, although it's not completely related to this PR, it might be nice to go through and remove all remaining references.

@@ -31,6 +30,12 @@ import { migrateLegacyQuery } from 'ui/utils/migrateLegacyQuery';
import { FilterManagerProvider } from 'ui/filter_manager';
import { SavedObjectsClientProvider } from 'ui/saved_objects';

const fetchStatuses = {
Copy link
Member

Choose a reason for hiding this comment

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

Looks like we're using these same constants in the context app. Maybe we could move them to a more central location (maybe here) and use them for both places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hah that's funny, I wrote those statuses without even realizing context had a similar thing, maybe I did it subconsciously. I only fear that these statuses have slightly different meanings in each app because they fetch results in slightly different ways (context uses fetchAsRejectablePromise, discover uses the onResults callback). If we couple them, it might lead to some contention down the road. I've got some thoughts on how to fix #14544 by making context and discover more similar, I'd like to wait till then to combine the statuses if that's ok with you?

Copy link
Member

Choose a reason for hiding this comment

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

Realized I never responded to this. I thought these were constants that weren't arbitrarily decided on by us. With your explanation I realize they are different, so I think it's fine to punt on this.

this._initFn = initFn;

this._desiredSize = null;
this._maxSegments = config.get('courier:maxSegmentCount');
Copy link
Member

Choose a reason for hiding this comment

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

I guess at this point we should remove this advanced setting, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Crap, I forgot about this setting. I was thinking we could make this change in 6.x since it only affects implementation details. But the fact that we're exposing a setting to tune those details may change things. What do you think @epixa ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just left a comment on the PR as a whole that is sort of related to this. In general, if an advanced setting is truly not doing anything useful anymore, I'm fine with it being removed so long as doing so doesn't break existing kibana installs that may have it set explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, it does still have an effect before this change. It sets a max on the number of requests a search can be segmented into. After this change, searches are no longer broken up into segments, so the setting is useless. I can't think of a situation where segmentation would actually be useful (slow queries maybe, but to me that's a bug in ES or the request itself), but in theory someone might be relying on it for reasons unknown to me at this time.

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, this does seem like a breaking change to me. Regardless of the use case, at some point we felt there was enough of a reason to give people control over their segmenting behavior. Our lack of memory or knowledge on that shouldn't be enough of a reason to just remove it. It seems like we should target master and remove all of this alongside the interval index pattern support itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went ahead and removed this setting since I'm only targeting 7.0 now.

@Bargs
Copy link
Contributor Author

Bargs commented Jan 30, 2018

notExpandable is part of the index pattern mapping, so I think we'll need to wait till 7.0 to remove it? Otherwise I think folks may run afoul of our strict mapping if they're trying to migrate an index pattern from 5.x into a new 6.x install.

@epixa
Copy link
Contributor

epixa commented Jan 30, 2018

Have you tested this PR with the old interval-based index patterns? I know we can't create any new ones, but we shouldn't break existing index patterns in 6.x. The new search optimizations in ES only work with wildcard indices, so the interval-based index pattern names wouldn't take advantage of it since those were handled with individual requests to direct indices.

@Bargs
Copy link
Contributor Author

Bargs commented Jan 30, 2018

@epixa yeah, interval based index patterns still work, they just run as a single query against all of the matching indices instead of one query per matching index. My thinking was that this is fine since the patterns will still work, we'll just be making the request differently under the hood. But it turns out we give the users some control over tuning that under the hood behavior (see inline comment above), which would suddenly have no effect with this change.

@epixa
Copy link
Contributor

epixa commented Jan 31, 2018

@Bargs I'm not sure if the optimizations on the ES end work with explicit index names. It was my understanding they only affect wildcard patterns.

@lukasolson
Copy link
Member

@Bargs 👍 to your response about notExpandable. We can worry about removing that later.

@Bargs Bargs removed the v6.3.0 label Mar 22, 2018
@Bargs
Copy link
Contributor Author

Bargs commented Mar 27, 2018

This week I'm going to rebase this PR and make sure it's cleaned up, then I'd appreciate one more look and an lgtm if all's well. We'll just merge this into master since it's a breaking change and then I'll submit my multi-sort enhancement to master as well.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@Bargs
Copy link
Contributor Author

Bargs commented Mar 29, 2018

Alright, CI is green again, @lukasolson wanna take another look?

@epixa
Copy link
Contributor

epixa commented Apr 2, 2018

Conflicts again

Copy link
Member

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

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

LGTM! 💥

@Bargs Bargs force-pushed the removeSegmentedFetch branch from 3fe8086 to 11cb33d Compare April 3, 2018 19:43
@Bargs
Copy link
Contributor Author

Bargs commented Apr 3, 2018

Conflicts resolved. @epixa you wanna take a look at this or should I grab someone else for a second review?

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@epixa
Copy link
Contributor

epixa commented Apr 4, 2018

@Bargs I should have time later this week to review it if no one else gets to it in the meantime

@tyrken
Copy link

tyrken commented Nov 18, 2018

@epixa @Bargs is this going to get updated and merged? It's called out as a blocker for multi-sort (#696) - you should see the number of thumbs up/+1's on that issue, from myself included.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@Bargs
Copy link
Contributor Author

Bargs commented Nov 19, 2018

@timroes @ppisljar we really should get this into 7.0. Getting rid of segmented request would dramatically reduce the complexity of Discover but it's a breaking change so it needs to go in a major. I just rebased on the latest master and ran into some issues with vis and inspector changes. If I could get some time with one of you to walk through it I think they should be easy to resolve.

@njd5475
Copy link
Contributor

njd5475 commented Jan 15, 2019

Can we get this updated? And prepared for 7.0?

@Bargs
Copy link
Contributor Author

Bargs commented Jan 15, 2019

It's still on my todo list but I'm currently slammed. @timroes I wonder if someone else could pick this up?

@lukasolson
Copy link
Member

Superseded by #33453.

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

Successfully merging this pull request may close these issues.

6 participants