Skip to content

Commit

Permalink
fix: propagate evaluated plans limit and paths limit to the native qu…
Browse files Browse the repository at this point in the history
…ery planner

The experimental `max_evaluated_plans` and `paths_limit` options were
only propagated to the legacy JS planner, not the native query planner.

Now they work with both planners.
  • Loading branch information
goto-bus-stop committed Nov 29, 2024
1 parent b7320f6 commit 4560b50
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions apollo-router/src/configuration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::io::BufReader;
use std::iter;
use std::net::IpAddr;
use std::net::SocketAddr;
use std::num::NonZeroU32;
use std::num::NonZeroUsize;
use std::str::FromStr;
use std::sync::Arc;
Expand Down Expand Up @@ -416,16 +417,31 @@ impl Configuration {
pub(crate) fn rust_query_planner_config(
&self,
) -> apollo_federation::query_plan::query_planner::QueryPlannerConfig {
apollo_federation::query_plan::query_planner::QueryPlannerConfig {
use apollo_federation::query_plan::query_planner::QueryPlanIncrementalDeliveryConfig;
use apollo_federation::query_plan::query_planner::QueryPlannerConfig;
use apollo_federation::query_plan::query_planner::QueryPlannerDebugConfig;

let max_evaluated_plans = self
.supergraph
.query_planning
.experimental_plans_limit
// Fails if experimental_plans_limit is zero; use our default.
.and_then(NonZeroU32::new)
.unwrap_or(NonZeroU32::new(10_000).expect("it is not zero"));

QueryPlannerConfig {
reuse_query_fragments: self.supergraph.reuse_query_fragments.unwrap_or(true),
subgraph_graphql_validation: false,
generate_query_fragments: self.supergraph.generate_query_fragments,
incremental_delivery:
apollo_federation::query_plan::query_planner::QueryPlanIncrementalDeliveryConfig {
enable_defer: self.supergraph.defer_support,
},
incremental_delivery: QueryPlanIncrementalDeliveryConfig {
enable_defer: self.supergraph.defer_support,
},
type_conditioned_fetching: self.experimental_type_conditioned_fetching,
debug: Default::default(),
debug: QueryPlannerDebugConfig {
bypass_planner_for_single_subgraph: false,
max_evaluated_plans,
paths_limit: self.supergraph.query_planning.experimental_paths_limit,
},
}
}
}
Expand Down

0 comments on commit 4560b50

Please sign in to comment.