diff --git a/config-model-api/abi-spec.json b/config-model-api/abi-spec.json index 01a4a997b17b..d238a6db66f4 100644 --- a/config-model-api/abi-spec.json +++ b/config-model-api/abi-spec.json @@ -1233,7 +1233,8 @@ "abstract" ], "methods" : [ - "public abstract void startDownload(java.lang.String, int, java.util.Set)" + "public void startDownload(java.lang.String, int, java.util.Set)", + "public abstract void triggerDownload(java.lang.String, int, java.util.Set)" ], "fields" : [ ] }, diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/FileDistribution.java b/config-model-api/src/main/java/com/yahoo/config/model/api/FileDistribution.java index bb5dec35f209..fb3b058f9bfc 100644 --- a/config-model-api/src/main/java/com/yahoo/config/model/api/FileDistribution.java +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/FileDistribution.java @@ -19,6 +19,19 @@ public interface FileDistribution { * @param port port which should be used when notifying * @param fileReferences set of file references to start downloading */ - void startDownload(String hostName, int port, Set fileReferences); + // TODO: Remove when 8.399 is oldest config model version in use + default void startDownload(String hostName, int port, Set fileReferences) { + triggerDownload(hostName, port, fileReferences); + } + + /** + * Notifies client which file references to download. Used to trigger downloading early (while + * preparing application package). + * + * @param hostName host which should be notified about file references to download + * @param port port which should be used when notifying + * @param fileReferences set of file references for downloading + */ + void triggerDownload(String hostName, int port, Set fileReferences); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java index a9d7e4c736cb..54e26475ad2a 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java @@ -38,7 +38,7 @@ public FileDistributionImpl(Supervisor supervisor) { * @param fileReferences set of file references to start downloading */ @Override - public void startDownload(String hostName, int port, Set fileReferences) { + public void triggerDownload(String hostName, int port, Set fileReferences) { Target target = supervisor.connect(new Spec(hostName, port)); Request request = new Request("filedistribution.setFileReferencesToDownload"); request.setContext(target); diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java index e534821f2a73..ca0414c3e925 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java @@ -129,7 +129,8 @@ public SessionPreparer(ModelFactoryRegistry modelFactoryRegistry, ExecutorService getExecutor() { return executor; } /** - * Prepares a session (validates, builds model, writes to zookeeper and distributes files) + * Prepares a session (validates, builds model, trigger distribution of application package + * to other config servers, writes to zookeeper) * * @param hostValidator host validator * @param logger for storing logs returned in response to client. @@ -150,7 +151,7 @@ public PrepareResult prepare(HostValidator hostValidator, DeployLogger logger, P AllocatedHosts allocatedHosts = preparation.buildModels(now); preparation.makeResult(allocatedHosts); if ( ! params.isDryRun()) { - FileReference fileReference = preparation.startDistributionOfApplicationPackage(); + FileReference fileReference = preparation.triggerDistributionOfApplicationPackage(); preparation.writeStateZK(fileReference); preparation.writeEndpointCertificateMetadataZK(); preparation.writeContainerEndpointsZK(); @@ -243,7 +244,7 @@ void checkTimeout(String step) { } } - FileReference startDistributionOfApplicationPackage() { + FileReference triggerDistributionOfApplicationPackage() { FileReference fileReference = fileRegistry.addApplicationPackage(); FileDistribution fileDistribution = fileDistributionFactory.createFileDistribution(); log.log(Level.FINE, () -> "Ask other config servers to download application package for " + @@ -251,7 +252,7 @@ FileReference startDistributionOfApplicationPackage() { ConfigServerSpec.fromConfig(configserverConfig) .stream() .filter(spec -> !spec.getHostName().equals(HostName.getLocalhost())) - .forEach(spec -> fileDistribution.startDownload(spec.getHostName(), spec.getConfigServerPort(), Set.of(fileReference))); + .forEach(spec -> fileDistribution.triggerDownload(spec.getHostName(), spec.getConfigServerPort(), Set.of(fileReference))); checkTimeout("startDistributionOfApplicationPackage"); return fileReference;