aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java11
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ApplicationPackageMaintainer.java4
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java4
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java2
-rw-r--r--filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java8
-rw-r--r--filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java6
6 files changed, 17 insertions, 18 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java
index b6a7efd3d4d..81cd1dd9738 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java
@@ -166,8 +166,8 @@ public class FileServer {
try {
String client = request.target().toString();
FileReferenceDownload fileReferenceDownload = new FileReferenceDownload(new FileReference(fileReference),
- downloadFromOtherSourceIfNotFound,
- client);
+ client,
+ downloadFromOtherSourceIfNotFound);
fileExists = hasFileDownloadIfNeeded(fileReferenceDownload);
if (fileExists) startFileServing(fileReference, receiver);
} catch (IllegalArgumentException e) {
@@ -190,8 +190,11 @@ public class FileServer {
if (fileReferenceDownload.downloadFromOtherSourceIfNotFound()) {
log.log(Level.FINE, "File not found, downloading from another source");
// Create new FileReferenceDownload with downloadFromOtherSourceIfNotFound set to false
- // to avoid config servers requesting a file reference perpetually, e.g. for a file that does not exist anymore
- FileReferenceDownload newDownload = new FileReferenceDownload(fileReference, false, fileReferenceDownload.client());
+ // to avoid config servers requesting a file reference perpetually, e.g. for a file that
+ // does not exist anymore
+ FileReferenceDownload newDownload = new FileReferenceDownload(fileReference,
+ fileReferenceDownload.client(),
+ false);
boolean fileExists = downloader.getFile(newDownload).isPresent();
if ( ! fileExists)
log.log(Level.WARNING, "Failed downloading '" + fileReferenceDownload + "'");
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ApplicationPackageMaintainer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ApplicationPackageMaintainer.java
index 53007566a62..47eabb0347e 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ApplicationPackageMaintainer.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ApplicationPackageMaintainer.java
@@ -76,8 +76,8 @@ public class ApplicationPackageMaintainer extends ConfigServerMaintainer {
log.fine(() -> "Downloading application package for " + applicationId + " (session " + sessionId + ")");
FileReferenceDownload download = new FileReferenceDownload(appFileReference,
- false,
- this.getClass().getSimpleName());
+ this.getClass().getSimpleName(),
+ false);
if (fileDownloader.getFile(download).isEmpty()) {
failures++;
log.info("Failed downloading application package (" + appFileReference + ")" +
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java
index 6ea32a32dd1..99ffff6403b 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java
@@ -583,8 +583,8 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener {
.map(FileReference::new)
.forEach(fileReference -> downloader.downloadIfNeeded(
new FileReferenceDownload(fileReference,
- false, /* downloadFromOtherSourceIfNotFound */
- req.target().toString())));
+ req.target().toString(),
+ false /* downloadFromOtherSourceIfNotFound */)));
req.returnValues().add(new Int32Value(0));
});
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java
index 29ec11bad26..67c40f94b6a 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java
@@ -56,7 +56,7 @@ public class FileServerTest {
public void requireThatNonExistingFileWillBeDownloaded() throws IOException {
String dir = "123";
assertFalse(fileServer.hasFile(dir));
- FileReferenceDownload foo = new FileReferenceDownload(new FileReference(dir));
+ FileReferenceDownload foo = new FileReferenceDownload(new FileReference(dir), "test");
assertFalse(fileServer.hasFileDownloadIfNeeded(foo));
writeFile(dir);
assertTrue(fileServer.hasFileDownloadIfNeeded(foo));
diff --git a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java
index 796f6ad2ebf..8d6f428eaef 100644
--- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java
+++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java
@@ -18,15 +18,11 @@ public class FileReferenceDownload {
private final boolean downloadFromOtherSourceIfNotFound;
private final String client;
- public FileReferenceDownload(FileReference fileReference) {
- this(fileReference, true, "unknown");
- }
-
public FileReferenceDownload(FileReference fileReference, String client) {
- this(fileReference, true, client);
+ this(fileReference, client, true);
}
- public FileReferenceDownload(FileReference fileReference, boolean downloadFromOtherSourceIfNotFound, String client) {
+ public FileReferenceDownload(FileReference fileReference, String client, boolean downloadFromOtherSourceIfNotFound) {
Objects.requireNonNull(fileReference, "file reference cannot be null");
this.fileReference = fileReference;
this.future = new CompletableFuture<>();
diff --git a/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java b/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java
index 3655285efbe..e8bd63fc083 100644
--- a/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java
+++ b/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java
@@ -207,7 +207,7 @@ public class FileDownloaderTest {
FileReference fileReference = new FileReference("fileReference123");
File fileReferenceFullPath = fileReferenceFullPath(downloadDir, fileReference);
- FileReferenceDownload fileReferenceDownload = new FileReferenceDownload(fileReference);
+ FileReferenceDownload fileReferenceDownload = new FileReferenceDownload(fileReference, "test");
Future<Future<Optional<File>>> future1 = executor.submit(() -> fileDownloader.getFutureFile(fileReferenceDownload));
do {
@@ -242,13 +242,13 @@ public class FileDownloaderTest {
FileDownloader fileDownloader = new FileDownloader(connectionPool, supervisor, downloadDir, timeout, sleepBetweenRetries);
FileReference xyzzy = new FileReference("xyzzy");
// Should download since we do not have the file on disk
- fileDownloader.downloadIfNeeded(new FileReferenceDownload(xyzzy));
+ fileDownloader.downloadIfNeeded(new FileReferenceDownload(xyzzy, "test"));
assertTrue(fileDownloader.isDownloading(xyzzy));
assertFalse(getFile(xyzzy).isPresent());
// Receive files to simulate download
receiveFile(xyzzy, "xyzzy.jar", FileReferenceData.Type.file, "content");
// Should not download, since file has already been downloaded
- fileDownloader.downloadIfNeeded(new FileReferenceDownload(xyzzy));
+ fileDownloader.downloadIfNeeded(new FileReferenceDownload(xyzzy, "test"));
// and file should be available
assertTrue(getFile(xyzzy).isPresent());
}