summaryrefslogtreecommitdiffstats
path: root/filedistribution
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-10-14 14:53:48 +0200
committerHarald Musum <musum@verizonmedia.com>2020-10-14 14:53:48 +0200
commit69734747006ea6748796c3ad998a86a8ed208b71 (patch)
treec3beecd37a42355d8eca3da3edea2147cb687971 /filedistribution
parentbb7814f7e0619a8b481969b407275b7b4c709385 (diff)
Log more when downloading file fails
Include client info
Diffstat (limited to 'filedistribution')
-rw-r--r--filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java4
-rw-r--r--filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java16
2 files changed, 15 insertions, 5 deletions
diff --git a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java
index f7b951e89d8..7470ac0952d 100644
--- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java
+++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java
@@ -5,6 +5,7 @@ import com.yahoo.config.FileReference;
import java.util.logging.Level;
import com.yahoo.vespa.config.ConnectionPool;
import com.yahoo.vespa.defaults.Defaults;
+import com.yahoo.yolean.Exceptions;
import java.io.File;
import java.time.Duration;
@@ -55,7 +56,8 @@ public class FileDownloader implements AutoCloseable {
try {
return getFutureFile(fileReferenceDownload).get(timeout.toMillis(), TimeUnit.MILLISECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
- log.log(Level.WARNING, "Failed downloading '" + fileReferenceDownload.fileReference().value() + "', removing from download queue: " + e.getMessage());
+ log.log(Level.WARNING, "Failed downloading '" + fileReferenceDownload +
+ "', removing from download queue: " + Exceptions.toMessageString(e));
fileReferenceDownloader.failedDownloading(fileReferenceDownload.fileReference());
return Optional.empty();
}
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 fe501484faf..31e6eb5daab 100644
--- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java
+++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java
@@ -1,4 +1,4 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.filedistribution;
@@ -15,15 +15,17 @@ public class FileReferenceDownload {
// If a config server wants to download from another config server (because it does not have the
// file itself) we set this flag to true to avoid an eternal loop
private final boolean downloadFromOtherSourceIfNotFound;
+ private final String client;
public FileReferenceDownload(FileReference fileReference) {
- this(fileReference, true);
+ this(fileReference, true, "unknown");
}
- public FileReferenceDownload(FileReference fileReference, boolean downloadFromOtherSourceIfNotFound) {
+ public FileReferenceDownload(FileReference fileReference, boolean downloadFromOtherSourceIfNotFound, String client) {
this.fileReference = fileReference;
this.future = new CompletableFuture<>();
this.downloadFromOtherSourceIfNotFound = downloadFromOtherSourceIfNotFound;
+ this.client = client;
}
FileReference fileReference() {
@@ -34,7 +36,13 @@ public class FileReferenceDownload {
return future;
}
- boolean downloadFromOtherSourceIfNotFound() {
+ public boolean downloadFromOtherSourceIfNotFound() {
return downloadFromOtherSourceIfNotFound;
}
+
+ @Override
+ public String toString() {
+ return fileReference + ", client: " + client;
+ }
+
}