diff options
author | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-03-08 09:20:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 09:20:44 +0100 |
commit | 4de52ed5557f5d16d05e39296a1405223ccd8e54 (patch) | |
tree | 95a6ccb34361a04ac5498660f21c5a66540d6831 /config-model | |
parent | 34b28580764915adb3fe0e8d5539727eb6f59706 (diff) | |
parent | 4b55e59b0bdda6559a40addf0ede434ab955dc07 (diff) |
Merge pull request #26347 from vespa-engine/bjorncs/global-phase
Only setup `RankProfilesEvaluator` for schemas with 'global-phase'
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java index b2a38bd6b08..414d4c817c7 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import static com.yahoo.vespa.model.container.PlatformBundles.SEARCH_AND_DOCPROC_BUNDLE; @@ -46,6 +47,7 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> private final ApplicationContainerCluster owningCluster; private final List<SearchCluster> searchClusters = new LinkedList<>(); + private final Collection<String> schemasWithGlobalPhase; private final boolean globalPhase; private QueryProfiles queryProfiles; @@ -55,6 +57,7 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> public ContainerSearch(DeployState deployState, ApplicationContainerCluster cluster, SearchChains chains) { super(chains); this.globalPhase = deployState.featureFlags().enableGlobalPhase(); + this.schemasWithGlobalPhase = getSchemasWithGlobalPhase(deployState); this.owningCluster = cluster; owningCluster.addComponent(Component.fromClassAndBundle(CompiledQueryProfileRegistry.class, SEARCH_AND_DOCPROC_BUNDLE)); @@ -65,6 +68,11 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> cluster.addSearchAndDocprocBundles(); } + private static Collection<String> getSchemasWithGlobalPhase(DeployState state) { + return state.rankProfileRegistry().all().stream() + .filter(rp -> rp.getGlobalPhase() != null).map(rp -> rp.schema().getName()).collect(Collectors.toSet()); + } + public void connectSearchClusters(Map<String, SearchCluster> searchClusters) { this.searchClusters.addAll(searchClusters.values()); initializeDispatchers(searchClusters.values()); @@ -80,6 +88,7 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> } if (globalPhase) { for (var documentDb : searchCluster.getDocumentDbs()) { + if (!schemasWithGlobalPhase.contains(documentDb.getSchemaName())) continue; var factory = new RankProfilesEvaluatorComponent(documentDb); if (! owningCluster.getComponentsMap().containsKey(factory.getComponentId())) { owningCluster.addComponent(factory); |