diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-08-02 09:56:21 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-08-02 09:56:21 +0200 |
commit | 6f4fda159cd6bef0622267879be9efafa35c9112 (patch) | |
tree | f369fbd4caa64cba655796c2a68ae90548ac7bed | |
parent | b81a83cd54f5d90ac1c12863fb26c7cf2b0038af (diff) |
Cleanup unused stuff to reduce entanglement
5 files changed, 2 insertions, 158 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java index 34ea41384bc..3eb56096e18 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java @@ -352,7 +352,6 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> if (hasIndexedCluster()) { // Important: these must all be the normalized "within a single leaf group" values, // _not_ the cluster-wide, cross-group values. - indexedCluster.setSearchableCopies(redundancy.readyCopies()); indexedCluster.setRedundancy(redundancy.finalRedundancy()); } this.redundancy = redundancy; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java b/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java deleted file mode 100644 index 643a305f369..00000000000 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.model.search; - -import java.util.Map; -import java.util.TreeMap; - -/** - * Class representing a group of @link{SearchInterface} nodes and a set of @link{Dispatch} nodes. - * - * Each @link{Dispatch} has a reference to an instance of this class and use it when producing config. - * - * @author baldersheim - */ -public class DispatchGroup { - - private final Map<Integer, Map<Integer, SearchInterface>> searchers = new TreeMap<>(); - - final private IndexedSearchCluster sc; - - public DispatchGroup(IndexedSearchCluster sc) { - this.sc = sc; - } - - DispatchGroup addSearcher(SearchInterface search) { - Map<Integer, SearchInterface> rows = searchers.get(search.getNodeSpec().partitionId()); - if (rows == null) { - rows = new TreeMap<>(); - rows.put(search.getNodeSpec().groupIndex(), search); - searchers.put(search.getNodeSpec().partitionId(), rows); - } else { - if (rows.containsKey(search.getNodeSpec().groupIndex())) { - throw new IllegalArgumentException("Already contains a search node with row id '" + search.getNodeSpec().groupIndex() + "'"); - } - rows.put(search.getNodeSpec().groupIndex(), search); - } - return this; - } - - public Iterable getSearchersIterable() { - return new Iterable(searchers); - } - - public int getRowBits() { - return sc.getRowBits(); - } - - public int getNumPartitions() { - return searchers.size(); - } - - public boolean useFixedRowInDispatch() { - return sc.useFixedRowInDispatch(); - } - - public int getSearchableCopies() { return sc.getSearchableCopies(); } - - public int getRedundancy() { return sc.getRedundancy(); } - - static class Iterator implements java.util.Iterator<SearchInterface> { - - private java.util.Iterator<Map<Integer, SearchInterface>> it1; - private java.util.Iterator<SearchInterface> it2; - - Iterator(Map<Integer, Map<Integer, SearchInterface> > s) { - it1 = s.values().iterator(); - if (it1.hasNext()) { - it2 = it1.next().values().iterator(); - } - } - - @Override - public boolean hasNext() { - if (it2 == null) { - return false; - } - while (!it2.hasNext() && it1.hasNext()) { - it2 = it1.next().values().iterator(); - } - return it2.hasNext(); - } - - @Override - public SearchInterface next() { - return it2.next(); - } - - @Override - public void remove() { - throw new IllegalStateException("'remove' not implemented"); - } - } - - public static class Iterable implements java.lang.Iterable<SearchInterface> { - final Map<Integer, Map<Integer, SearchInterface> > searchers; - Iterable(Map<Integer, Map<Integer, SearchInterface> > searchers) { this.searchers = searchers; } - @Override - public java.util.Iterator<SearchInterface> iterator() { - return new Iterator(searchers); - } - } - -} diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java index a71e72c0ef8..65a667feb4f 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java @@ -50,10 +50,8 @@ public class IndexedSearchCluster extends SearchCluster private final List<DocumentDatabase> documentDbs = new LinkedList<>(); private final MultipleDocumentDatabasesConfigProducer documentDbsConfigProducer; - private int searchableCopies = 1; private int redundancy = 1; - private final DispatchGroup rootDispatch; private final List<SearchNode> searchNodes = new ArrayList<>(); private final DispatchTuning.DispatchPolicy defaultDispatchPolicy; private final double dispatchWarmup; @@ -72,7 +70,6 @@ public class IndexedSearchCluster extends SearchCluster super(parent, clusterName, index); indexingDocproc = new IndexingDocproc(); documentDbsConfigProducer = new MultipleDocumentDatabasesConfigProducer(this, documentDbs); - rootDispatch = new DispatchGroup(this); defaultDispatchPolicy = DispatchTuning.Builder.toDispatchPolicy(featureFlags.queryDispatchPolicy()); dispatchWarmup = featureFlags.queryDispatchWarmup(); summaryDecodePolicy = featureFlags.summaryDecodePolicy(); @@ -83,11 +80,9 @@ public class IndexedSearchCluster extends SearchCluster public IndexingDocproc getIndexingDocproc() { return indexingDocproc; } - public DispatchGroup getRootDispatch() { return rootDispatch; } public void addSearcher(SearchNode searcher) { searchNodes.add(searcher); - rootDispatch.addSearcher(searcher); } public List<SearchNode> getSearchNodes() { return Collections.unmodifiableList(searchNodes); } @@ -198,27 +193,6 @@ public class IndexedSearchCluster extends SearchCluster documentDbsConfigProducer.getConfig(builder); } - boolean useFixedRowInDispatch() { - for (SearchNode node : getSearchNodes()) { - if (node.getNodeSpec().groupIndex() > 0) { - return true; - } - } - return false; - } - - public int getSearchableCopies() { - return searchableCopies; - } - - public void setSearchableCopies(int searchableCopies) { - this.searchableCopies = searchableCopies; - } - - public int getRedundancy() { - return redundancy; - } - public void setRedundancy(int redundancy) { this.redundancy = redundancy; } @@ -258,7 +232,7 @@ public class IndexedSearchCluster extends SearchCluster if (tuning.dispatch.getMaxHitsPerPartition() != null) builder.maxHitsPerNode(tuning.dispatch.getMaxHitsPerPartition()); - builder.redundancy(rootDispatch.getRedundancy()); + builder.redundancy(redundancy); if (searchCoverage != null) { if (searchCoverage.getMinimum() != null) builder.minSearchCoverage(searchCoverage.getMinimum() * 100.0); diff --git a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java index c128b9af6e0..9126c678171 100644 --- a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java +++ b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java @@ -1327,7 +1327,7 @@ public class ModelProvisioningTest { assertEquals(4, cluster.getRedundancy().effectiveInitialRedundancy()); assertEquals(4, cluster.getRedundancy().effectiveFinalRedundancy()); assertEquals(4, cluster.getRedundancy().effectiveReadyCopies()); - assertEquals(4, cluster.getSearch().getIndexed().getSearchableCopies()); + assertEquals(4, cluster.getRedundancy().readyCopies()); assertFalse(cluster.getRootGroup().getPartitions().isPresent()); assertEquals(4, cluster.getRootGroup().getNodes().size()); assertEquals(0, cluster.getRootGroup().getSubgroups().size()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java index 7fba5ba12e9..8a47eb030f3 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java @@ -3,13 +3,10 @@ package com.yahoo.vespa.model.content; import com.yahoo.vespa.config.content.StorDistributionConfig; import com.yahoo.vespa.model.content.cluster.ContentCluster; -import com.yahoo.vespa.model.search.DispatchGroup; -import com.yahoo.vespa.model.search.SearchInterface; import com.yahoo.vespa.model.search.SearchNode; import com.yahoo.yolean.Exceptions; import org.junit.jupiter.api.Test; -import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -193,30 +190,6 @@ public class IndexedHierarchicDistributionTest { } @Test - void requireThatLeafGroupsCanHaveUnequalNumberOfNodesIfRandomPolicy() throws Exception { - ContentCluster c = getOddGroupsCluster(); - DispatchGroup dg = c.getSearch().getIndexed().getRootDispatch(); - assertEquals(8, dg.getRowBits()); - assertEquals(3, dg.getNumPartitions()); - assertTrue(dg.useFixedRowInDispatch()); - ArrayList<SearchInterface> list = new ArrayList<>(); - for (SearchInterface si : dg.getSearchersIterable()) { - list.add(si); - } - assertEquals(5, list.size()); - assertEquals(0, list.get(0).getNodeSpec().partitionId()); - assertEquals(0, list.get(0).getNodeSpec().groupIndex()); - assertEquals(0, list.get(1).getNodeSpec().partitionId()); - assertEquals(1, list.get(1).getNodeSpec().groupIndex()); - assertEquals(1, list.get(2).getNodeSpec().partitionId()); - assertEquals(0, list.get(2).getNodeSpec().groupIndex()); - assertEquals(1, list.get(3).getNodeSpec().partitionId()); - assertEquals(1, list.get(3).getNodeSpec().groupIndex()); - assertEquals(2, list.get(4).getNodeSpec().partitionId()); - assertEquals(1, list.get(4).getNodeSpec().groupIndex()); - } - - @Test void requireThatLeafGroupsCountMustBeAFactorOfRedundancy() { try { getTwoGroupsCluster(3, 3, "2|*"); |