diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-14 16:42:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-14 16:42:11 +0200 |
commit | b25a527dc0706eaadf8960f1e74900c67ea27d4a (patch) | |
tree | b91c6efd91b07e8fa71cf91571f10915614e9425 /configserver | |
parent | 61d7e5169e55f2f78f6aed956813f3caa362bc21 (diff) | |
parent | 69734747006ea6748796c3ad998a86a8ed208b71 (diff) |
Merge pull request #14858 from vespa-engine/hmusum/log-more-when-download-fails
Log more when downloading file fails
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java | 20 | ||||
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java | 6 |
2 files changed, 13 insertions, 13 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 31294faad05..9d35b4f0e32 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 @@ -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.config.server.filedistribution; import com.google.inject.Inject; @@ -20,7 +20,6 @@ import com.yahoo.yolean.Exceptions; import java.io.File; import java.io.IOException; -import java.util.Optional; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.logging.Level; @@ -157,7 +156,11 @@ public class FileServer { boolean fileExists; try { - fileExists = hasFile(fileReference) || download(fileReference, downloadFromOtherSourceIfNotFound); + String client = request.target().toString(); + FileReferenceDownload fileReferenceDownload = new FileReferenceDownload(new FileReference(fileReference), + downloadFromOtherSourceIfNotFound, + client); + fileExists = hasFile(fileReference) || download(fileReferenceDownload); if (fileExists) startFileServing(fileReference, receiver); } catch (IllegalArgumentException e) { fileExists = false; @@ -173,21 +176,16 @@ public class FileServer { // downloadFromOtherSourceIfNotFound is true when the request comes from another config server. // This is to avoid config servers asking each other for a file that does not exist - private boolean download(String fileReference, boolean downloadFromOtherSourceIfNotFound) { - if (downloadFromOtherSourceIfNotFound) { + private boolean download(FileReferenceDownload fileReferenceDownload) { + if (fileReferenceDownload.downloadFromOtherSourceIfNotFound()) { log.log(Level.FINE, "File not found, downloading from another source"); - return download(fileReference).isPresent(); + return downloader.getFile(fileReferenceDownload).isPresent(); } else { log.log(Level.FINE, "File not found, will not download from another source since request came from another config server"); return false; } } - private Optional<File> download(String fileReference) { - /* downloadFromOtherSourceIfNotFound should be false here, since this request is from a config server */ - return downloader.getFile(new FileReferenceDownload(new FileReference(fileReference), false)); - } - public FileDownloader downloader() { return downloader; } 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 55ee45482f9..3f6d6d0d257 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 @@ -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.config.server.rpc; import com.google.inject.Inject; @@ -567,7 +567,9 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener { Stream.of(fileReferenceStrings) .map(FileReference::new) .forEach(fileReference -> downloader.downloadIfNeeded( - new FileReferenceDownload(fileReference, false /* downloadFromOtherSourceIfNotFound */))); + new FileReferenceDownload(fileReference, + false, /* downloadFromOtherSourceIfNotFound */ + req.target().toString()))); req.returnValues().add(new Int32Value(0)); }); } |