diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-04-21 23:00:19 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-04-22 10:21:30 +0200 |
commit | 57fff0d430547deb764fda6c253c256b8e7dcd09 (patch) | |
tree | 346f0b557d62a830b6174e0e8c2c2b4b9491d94a | |
parent | ec48ae56010aad00477263c28943054662f9412c (diff) |
For single content clusters we can do a direct jump bypassing indexing docproc too.
4 files changed, 14 insertions, 8 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/routing/DocumentProtocol.java b/config-model/src/main/java/com/yahoo/vespa/model/routing/DocumentProtocol.java index 97236222338..ecfa9a9e53e 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/routing/DocumentProtocol.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/routing/DocumentProtocol.java @@ -34,9 +34,9 @@ import java.util.TreeMap; public final class DocumentProtocol implements Protocol, DocumentrouteselectorpolicyConfig.Producer { private static final String NAME = "document"; - private ApplicationSpec application; - private RoutingTableSpec routingTable; - ConfigModelRepo repo; + private final ApplicationSpec application; + private final RoutingTableSpec routingTable; + private final ConfigModelRepo repo; public static String getIndexedRouteName(String configId) { return configId + "-index"; @@ -51,7 +51,7 @@ public final class DocumentProtocol implements Protocol, Documentrouteselectorpo * * @param plugins The plugins to reflect on. */ - public DocumentProtocol(ConfigModelRepo plugins) { + DocumentProtocol(ConfigModelRepo plugins) { application = createApplicationSpec(plugins); routingTable = createRoutingTable(plugins); this.repo = plugins; @@ -249,7 +249,13 @@ public final class DocumentProtocol implements Protocol, Documentrouteselectorpo route.addHop("indexing"); table.addRoute(route); - table.addRoute(new RouteSpec("default-get").addHop("indexing")); + if (content.size() == 1) { + table.addRoute(new RouteSpec("default-get").addHop("[Content:cluster=" + content.get(0).getConfigId() + "]")); + } else { + //TODO This should ideally skip indexing and go directly to correct cluster. + // But will handle the single cluster for now. + table.addRoute(new RouteSpec("default-get").addHop("indexing")); + } } private static boolean indexingHopExists(RoutingTableSpec table) { diff --git a/config-model/src/test/cfg/routing/replacehop/messagebus.cfg b/config-model/src/test/cfg/routing/replacehop/messagebus.cfg index 12701af6db3..8717deb50a5 100755 --- a/config-model/src/test/cfg/routing/replacehop/messagebus.cfg +++ b/config-model/src/test/cfg/routing/replacehop/messagebus.cfg @@ -12,7 +12,7 @@ routingtable[0].hop[2].ignoreresult false routingtable[0].route[0].name "default" routingtable[0].route[0].hop[0] "indexing" routingtable[0].route[1].name "default-get" -routingtable[0].route[1].hop[0] "indexing" +routingtable[0].route[1].hop[0] "[Content:cluster=music]" routingtable[0].route[2].name "music" routingtable[0].route[2].hop[0] "[MessageType:music]" routingtable[0].route[3].name "music-direct" diff --git a/config-model/src/test/cfg/routing/replaceroute/messagebus.cfg b/config-model/src/test/cfg/routing/replaceroute/messagebus.cfg index d3af5b36c26..7eae6e8ebc5 100755 --- a/config-model/src/test/cfg/routing/replaceroute/messagebus.cfg +++ b/config-model/src/test/cfg/routing/replaceroute/messagebus.cfg @@ -9,7 +9,7 @@ routingtable[0].hop[1].ignoreresult false routingtable[0].route[0].name "default" routingtable[0].route[0].hop[0] "foo" routingtable[0].route[1].name "default-get" -routingtable[0].route[1].hop[0] "indexing" +routingtable[0].route[1].hop[0] "[Content:cluster=music]" routingtable[0].route[2].name "music" routingtable[0].route[2].hop[0] "[MessageType:music]" routingtable[0].route[3].name "music-direct" diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java index bf8e2a353cf..f883e83374e 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java @@ -158,7 +158,7 @@ public class IndexedTest extends ContentBaseTest { assertEquals("jdisc/chain.indexing", spec.getHop(1).getName()); assertRoute(spec.getRoute(0), "default", "indexing"); - assertRoute(spec.getRoute(1), "default-get", "indexing"); + assertRoute(spec.getRoute(1), "default-get", "[Content:cluster=test]"); assertRoute(spec.getRoute(2), "storage/cluster.test", "route:test"); assertRoute(spec.getRoute(3), "test", "[MessageType:test]"); assertRoute(spec.getRoute(4), "test-direct", "[Content:cluster=test]"); |