diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-10-15 08:49:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-15 08:49:31 +0200 |
commit | 2839eec173e2e40258e426c94950b769d02c79c3 (patch) | |
tree | 90a8a6c045f6ceb2ac5f4da113e1bb1bab597afb /filedistribution/src | |
parent | 61eaea251e8cacd320ac10754ffd1513d8638043 (diff) |
Revert "Revert "Log more when downloading file fails""
Diffstat (limited to 'filedistribution/src')
-rw-r--r-- | filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java | 4 | ||||
-rw-r--r-- | filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java | 16 |
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; + } + } |