Skip to content

reorder query planner execution#1484

Merged
Geal merged 12 commits intomainfrom
geal/reorder-query-planner2
Aug 12, 2022
Merged

reorder query planner execution#1484
Geal merged 12 commits intomainfrom
geal/reorder-query-planner2

Conversation

@Geal
Copy link
Contributor

@Geal Geal commented Aug 9, 2022

Fix #1412

the query plan only depends on the query, operation name and query plan
options, so any chages by plugins should be deterministic.
Working from that assumption, the query planner cache should be able to
store the result of plugins and query planner execution (instead of
applying plugins everytime as it is done currently)

the query plan only depends on the query, operation name and query plan
options, so any chages by plugins should be deterministic.
Working from that assumption, the query planner cache should be able to
store the result of plugins and query planner execution (instead of
applying plugins everytime as it is done currently)
@github-actions

This comment has been minimized.

@Geal Geal marked this pull request as ready for review August 11, 2022 09:33
@Geal Geal requested review from BrynCooke and SimonSapin August 11, 2022 09:33
@SimonSapin
Copy link
Contributor

How does this new caching interact with the mutability of Context in QueryPlannerRequest and QueryPlannerResponse? Should we remove their context fields?

@Geal
Copy link
Contributor Author

Geal commented Aug 11, 2022

How does this new caching interact with the mutability of Context in QueryPlannerRequest and QueryPlannerResponse? Should we remove their context fields?

Context is still used to set the usage reporting field for telemetry so it should stay. When we retrieve the cached response, the context for the current request is updated accordingly

Copy link
Contributor

@SimonSapin SimonSapin 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 good to document for plugin authors that their Plugin::query_planning_service may be cached, what’s the cache key, and how they can influence it (from a router/supergraph service)

@Geal
Copy link
Contributor Author

Geal commented Aug 11, 2022

I think it’d be good to document for plugin authors that their Plugin::query_planning_service may be cached, what’s the cache key, and how they can influence it (from a router/supergraph service

good idea

inner_e
);
Err(error) => {
if let Some(error) = error.downcast_ref::<QueryPlannerError>() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a question, did you already test it ? I sometimes played with that and sometimes it doesn't work because you need to fetch the error.source()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if a plugin replaces the error then that will not work, but there won't be anything we can do about it

retrieval_error.deref(),
QueryPlannerError::SpecError(_)
| QueryPlannerError::SchemaValidationErrors(_)
retrieval_error.deref().downcast_ref::<QueryPlannerError>(),
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment about .source() and so one

@Geal Geal merged commit 584d096 into main Aug 12, 2022
@Geal Geal deleted the geal/reorder-query-planner2 branch August 12, 2022 12:33
@Geal Geal self-assigned this Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query planner: reorder plugin and cache application and remove the HTTP request

3 participants