diff options
author | Harald Musum <musum@yahooinc.com> | 2022-07-06 15:02:38 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-07-06 15:02:38 +0200 |
commit | 57a7a125c024c90a47467dbc49338e2127cadc8b (patch) | |
tree | 71bdb24bac3529b3027793b9ba2103e69e27d953 /filedistribution | |
parent | 193ab3ee7d39f555c4f7959f668d494a06a3d4b8 (diff) |
Temporarily add env varioable for forcing download of file references
This can be used for testing file distributuion on one node.
E.g. config proxy takes no config or feature flag, so need to use an
environment variable.
Diffstat (limited to 'filedistribution')
-rw-r--r-- | filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java | 5 |
1 files changed, 5 insertions, 0 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 dc87ae2a0b4..63ae8faacfe 100644 --- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java +++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java @@ -31,6 +31,7 @@ public class FileDownloader implements AutoCloseable { private static final Logger log = Logger.getLogger(FileDownloader.class.getName()); private static final Duration defaultSleepBetweenRetries = Duration.ofSeconds(5); public static final File defaultDownloadDirectory = new File(Defaults.getDefaults().underVespaHome("var/db/vespa/filedistribution")); + private static final boolean forceDownload = Boolean.parseBoolean(System.getenv("VESPA_CONFIG_PROXY_FORCE_DOWNLOAD_OF_FILE_REFERENCES")); private final ConnectionPool connectionPool; private final Supervisor supervisor; @@ -65,6 +66,8 @@ public class FileDownloader implements AutoCloseable { sleepBetweenRetries, downloadDirectory, acceptedCompressionTypes); + if (forceDownload) + log.log(Level.INFO, "Force download of file references (download even if file reference exists on disk)"); } public Optional<File> getFile(FileReferenceDownload fileReferenceDownload) { @@ -103,6 +106,8 @@ public class FileDownloader implements AutoCloseable { } private static Optional<File> getFileFromFileSystem(FileReference fileReference, File downloadDirectory) { + if (forceDownload) return Optional.empty(); + File[] files = new File(downloadDirectory, fileReference.value()).listFiles(); if (files == null) return Optional.empty(); if (files.length == 0) return Optional.empty(); |