-
Notifications
You must be signed in to change notification settings - Fork 275
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 query plan only works on the first query #1541
Comments
That feels like a caching issue. |
It is indeed! We can't and shouldn't wrap all of the QueryPlanner plugins with |
fixes #1541 This commit lets the QueryPlanner cache wrap only the `bridge_query_planner`, so that plugins get a chance to run whether the cache will hit or not.
Hmm no that was very intentional, the result of query planning and plugin application only depends on the query, operation name and options, so the result of plugin application should be cached. The issue here is not that the cache is in the wrong place, but that it does not cache the extensions field |
That was done in #1484 |
I don't think we should cache the extensions field. I think plugins should always run, because we cannot assume plugins to be stateless. The specific bit i disagree with is this one While this is true for the bridge_query_planner, it might not be for plugins, especially if they fiddle with the context. For example let's pretend the first request doesn't set |
ok so here it's not even the extensions field that should be cached, because it does not exist in the query planner service. The relevant code uses the context: my belief here is that the functionality to expose the query plan should not have been a plugin, but instead a special case inside the supergraph_service. Not everything fits neatly into a plugin, and for core functionality like this we should put it in the right place. The query planner is a special place in the router, and is designed to be deterministic, so letting plugins introduce whatever they want there is dangerous. In particular, that's why we hid the query plan from the router/apollo-router/src/services/mod.rs Line 362 in 7710b99
But the plugin to expose it actually ignores that constraint because it is part of the router's crate. I propose we sleep on it and look for a better solution tomorrow? |
I'm going to update the PR in light of #1545 and our discussion |
Confirmed this is fixed. Thank you! |
If I run the router (from
main
as of this issue 77621dd) with the experimental feature in #1470 using the following config (using the starstuff getting started graph):Config
It starts up with this:
And then if I make this request:
Request
It successfully returns:
However, if I run the query again after that (no matter how many times), it no longer returns the query plan and only returns the
data
:The text was updated successfully, but these errors were encountered: