Skip to content

Commit

Permalink
Merge pull request #32212 from vespa-engine/hmusum/rename-method
Browse files Browse the repository at this point in the history
Rename a couple of methods
  • Loading branch information
baldersheim authored Aug 21, 2024
2 parents 57db625 + d88806b commit 8473612
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
3 changes: 2 additions & 1 deletion config-model-api/abi-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : [ ]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileReference> fileReferences);
// TODO: Remove when 8.399 is oldest config model version in use
default void startDownload(String hostName, int port, Set<FileReference> 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<FileReference> fileReferences);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileReference> fileReferences) {
public void triggerDownload(String hostName, int port, Set<FileReference> fileReferences) {
Target target = supervisor.connect(new Spec(hostName, port));
Request request = new Request("filedistribution.setFileReferencesToDownload");
request.setContext(target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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();
Expand Down Expand Up @@ -243,15 +244,15 @@ 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 " +
applicationId + " (" + fileReference + ")");
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;
Expand Down

0 comments on commit 8473612

Please sign in to comment.