summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/ReindexingMaintainer.java13
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java56
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ReindexingController.java48
3 files changed, 48 insertions, 69 deletions
diff --git a/clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/ReindexingMaintainer.java b/clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/ReindexingMaintainer.java
index a336ad02f20..7989338c406 100644
--- a/clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/ReindexingMaintainer.java
+++ b/clustercontroller-reindexer/src/main/java/ai/vespa/reindexing/ReindexingMaintainer.java
@@ -56,19 +56,18 @@ public class ReindexingMaintainer extends AbstractComponent {
Metric metric,
DocumentAccess access, ZookeepersConfig zookeepersConfig,
ClusterListConfig clusterListConfig, AllClustersBucketSpacesConfig allClustersBucketSpacesConfig,
- ReindexingConfig reindexingConfig, DocumentmanagerConfig documentmanagerConfig) {
- this(Clock.systemUTC(), metric, access, zookeepersConfig, clusterListConfig, allClustersBucketSpacesConfig, reindexingConfig, documentmanagerConfig);
+ ReindexingConfig reindexingConfig) {
+ this(Clock.systemUTC(), metric, access, zookeepersConfig, clusterListConfig, allClustersBucketSpacesConfig, reindexingConfig);
}
ReindexingMaintainer(Clock clock, Metric metric, DocumentAccess access, ZookeepersConfig zookeepersConfig,
ClusterListConfig clusterListConfig, AllClustersBucketSpacesConfig allClustersBucketSpacesConfig,
- ReindexingConfig reindexingConfig, DocumentmanagerConfig documentmanagerConfig) {
- DocumentTypeManager manager = new DocumentTypeManager(documentmanagerConfig);
- this.reindexer = new Reindexer(parseCluster(reindexingConfig.clusterName(), clusterListConfig, allClustersBucketSpacesConfig, manager),
- parseReady(reindexingConfig, manager),
+ ReindexingConfig reindexingConfig) {
+ this.reindexer = new Reindexer(parseCluster(reindexingConfig.clusterName(), clusterListConfig, allClustersBucketSpacesConfig, access.getDocumentTypeManager()),
+ parseReady(reindexingConfig, access.getDocumentTypeManager()),
new ReindexingCurator(Curator.create(zookeepersConfig.zookeeperserverlist()),
reindexingConfig.clusterName(),
- manager),
+ access.getDocumentTypeManager()),
access,
metric,
clock);
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java
index d86c5e1eab6..9e15db348a2 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java
@@ -3,13 +3,16 @@ package com.yahoo.vespa.model.admin.clustercontroller;
import com.yahoo.cloud.config.ZookeeperServerConfig;
import com.yahoo.component.ComponentSpecification;
+import com.yahoo.config.model.api.Reindexing;
import com.yahoo.config.model.api.container.ContainerServiceType;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.bundle.BundleInstantiationSpecification;
import com.yahoo.container.core.documentapi.DocumentAccessProvider;
import com.yahoo.container.di.config.PlatformBundlesConfig;
+import com.yahoo.documentmodel.NewDocumentType;
import com.yahoo.osgi.provider.model.ComponentModel;
import com.yahoo.vespa.config.content.FleetcontrollerConfig;
+import com.yahoo.vespa.config.content.reindexing.ReindexingConfig;
import com.yahoo.vespa.model.application.validation.RestartConfigs;
import com.yahoo.vespa.model.container.Container;
import com.yahoo.vespa.model.container.component.AccessLogComponent;
@@ -28,12 +31,15 @@ import java.util.TreeSet;
@RestartConfigs({FleetcontrollerConfig.class, ZookeeperServerConfig.class})
public class ClusterControllerContainer extends Container implements
PlatformBundlesConfig.Producer,
- ZookeeperServerConfig.Producer
+ ZookeeperServerConfig.Producer,
+ ReindexingConfig.Producer
{
private static final ComponentSpecification CLUSTERCONTROLLER_BUNDLE = new ComponentSpecification("clustercontroller-apps");
private static final ComponentSpecification ZOOKEEPER_SERVER_BUNDLE = new ComponentSpecification("zookeeper-server");
+ private static final ComponentSpecification REINDEXING_CONTROLLER_BUNDLE = new ComponentSpecification("clustercontroller-reindexer");
private final Set<String> bundles = new TreeSet<>();
+ private final ReindexingContext reindexingContext;
public ClusterControllerContainer(
AbstractConfigProducer<?> parent,
@@ -42,12 +48,16 @@ public class ClusterControllerContainer extends Container implements
boolean isHosted,
ReindexingContext reindexingContext) {
super(parent, "" + index, index, isHosted);
+ this.reindexingContext = reindexingContext;
+
addHandler("clustercontroller-status",
"com.yahoo.vespa.clustercontroller.apps.clustercontroller.StatusHandler",
- "/clustercontroller-status/*");
+ "/clustercontroller-status/*",
+ CLUSTERCONTROLLER_BUNDLE);
addHandler("clustercontroller-state-restapi-v2",
"com.yahoo.vespa.clustercontroller.apps.clustercontroller.StateRestApiV2Handler",
- "/cluster/v2/*");
+ "/cluster/v2/*",
+ CLUSTERCONTROLLER_BUNDLE);
if (runStandaloneZooKeeper) {
addComponent("clustercontroller-zkrunner",
"com.yahoo.vespa.zookeeper.VespaZooKeeperServerImpl",
@@ -73,7 +83,7 @@ public class ClusterControllerContainer extends Container implements
addFileBundle("clustercontroller-core");
addFileBundle("clustercontroller-utils");
addFileBundle("zookeeper-server");
- configureReindexing(reindexingContext);
+ configureReindexing();
}
@Override
@@ -110,19 +120,21 @@ public class ClusterControllerContainer extends Container implements
addComponent(new Component<>(createComponentModel(id, className, bundle)));
}
- private void addHandler(String id, String className, String path) {
- addHandler(new Handler(createComponentModel(id, className, CLUSTERCONTROLLER_BUNDLE)), path);
+ private void addHandler(String id, String className, String path, ComponentSpecification bundle) {
+ addHandler(new Handler(createComponentModel(id, className, bundle)), path);
}
- private void configureReindexing(ReindexingContext context) {
- if (context != null) {
- addFileBundle(ReindexingController.REINDEXING_CONTROLLER_BUNDLE);
- addComponent(new ReindexingController(context));
+ private void configureReindexing() {
+ if (reindexingContext != null) {
+ addFileBundle(REINDEXING_CONTROLLER_BUNDLE.getName());
addComponent(new SimpleComponent(DocumentAccessProvider.class.getName()));
- addHandler(new Handler(createComponentModel("reindexing-status",
- "ai.vespa.reindexing.http.ReindexingV1ApiHandler",
- new ComponentSpecification(ReindexingController.REINDEXING_CONTROLLER_BUNDLE))),
- "/reindexing/v1/*");
+ addComponent("reindexing-maintainer",
+ "ai.vespa.reindexing.ReindexingMaintainer",
+ REINDEXING_CONTROLLER_BUNDLE);
+ addHandler("reindexing-status",
+ "ai.vespa.reindexing.http.ReindexingV1ApiHandler",
+ "/reindexing/v1/*",
+ REINDEXING_CONTROLLER_BUNDLE);
}
}
@@ -137,4 +149,20 @@ public class ClusterControllerContainer extends Container implements
builder.myid(index());
}
+ @Override
+ public void getConfig(ReindexingConfig.Builder builder) {
+ if (reindexingContext == null)
+ return;
+
+ builder.clusterName(reindexingContext.contentClusterName());
+ builder.enabled(reindexingContext.reindexing().enabled());
+ for (NewDocumentType type : reindexingContext.documentTypes()) {
+ String typeName = type.getFullName().getName();
+ reindexingContext.reindexing().status(reindexingContext.contentClusterName(), typeName)
+ .ifPresent(status -> builder.status(typeName,
+ new ReindexingConfig.Status.Builder()
+ .readyAtMillis(status.ready().toEpochMilli())));
+ }
+ }
+
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ReindexingController.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ReindexingController.java
deleted file mode 100644
index 24909ddbc8d..00000000000
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ReindexingController.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.model.admin.clustercontroller;
-
-import com.yahoo.config.model.api.Reindexing;
-import com.yahoo.container.bundle.BundleInstantiationSpecification;
-import com.yahoo.documentmodel.NewDocumentType;
-import com.yahoo.osgi.provider.model.ComponentModel;
-import com.yahoo.vespa.config.content.reindexing.ReindexingConfig;
-import com.yahoo.vespa.model.container.component.SimpleComponent;
-
-import java.util.Collection;
-
-/**
- * @author bjorncs
- */
-class ReindexingController extends SimpleComponent implements ReindexingConfig.Producer {
-
- static final String REINDEXING_CONTROLLER_BUNDLE = "clustercontroller-reindexer";
-
- private final Reindexing reindexing;
- private final String contentClusterName;
- private final Collection<NewDocumentType> documentTypes;
-
- ReindexingController(ReindexingContext context) {
- super(new ComponentModel(
- BundleInstantiationSpecification.getFromStrings(
- "reindexing-maintainer",
- "ai.vespa.reindexing.ReindexingMaintainer",
- REINDEXING_CONTROLLER_BUNDLE)));
- this.reindexing = context.reindexing();
- this.contentClusterName = context.contentClusterName();
- this.documentTypes = context.documentTypes();
- }
-
- @Override
- public void getConfig(ReindexingConfig.Builder builder) {
- builder.clusterName(contentClusterName);
- builder.enabled(reindexing.enabled());
- for (NewDocumentType type : documentTypes) {
- String typeName = type.getFullName().getName();
- reindexing.status(contentClusterName, typeName).ifPresent(status ->
- builder.status(
- typeName,
- new ReindexingConfig.Status.Builder()
- .readyAtMillis(status.ready().toEpochMilli())));
- }
- }
-}