diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-11-21 14:47:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-21 14:47:04 +0100 |
commit | 39c75dd01b0e85b6d4ab7c06cfc8458d0990921b (patch) | |
tree | 1ab5915122ad61580853e62625710dc5741d5b20 /configserver | |
parent | 4a021c9a57e67947cce9203708be5b9fb0877438 (diff) | |
parent | 3d55ce3c6f315414f2db105776dd8e11346642a0 (diff) |
Merge pull request #4221 from vespa-engine/hmusum/download-from-another-config-server
Add support for downloading from another config server
Diffstat (limited to 'configserver')
3 files changed, 15 insertions, 2 deletions
diff --git a/configserver/pom.xml b/configserver/pom.xml index 4ebb76bd5fe..66359e0bcc0 100644 --- a/configserver/pom.xml +++ b/configserver/pom.xml @@ -126,6 +126,11 @@ </dependency> <dependency> <groupId>com.yahoo.vespa</groupId> + <artifactId>filedistribution</artifactId> + <version>6-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>com.yahoo.vespa</groupId> <artifactId>filedistributionmanager</artifactId> <version>${project.version}</version> </dependency> 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 a504cd120ee..9dc94c9fe93 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 @@ -4,7 +4,10 @@ package com.yahoo.vespa.config.server.filedistribution; import com.google.inject.Inject; import com.yahoo.config.FileReference; import com.yahoo.config.model.api.FileDistribution; +import com.yahoo.config.subscription.ConfigSourceSet; import com.yahoo.io.IOUtils; +import com.yahoo.vespa.config.JRTConnectionPool; +import com.yahoo.vespa.filedistribution.FileDownloader; import java.io.File; import java.io.IOException; @@ -16,6 +19,7 @@ public class FileServer { private static final Logger log = Logger.getLogger(FileServer.class.getName()); private final FileDirectory root; private final ExecutorService executor; + private final FileDownloader downloader = new FileDownloader(new JRTConnectionPool(ConfigSourceSet.createDefault())); public static class ReplayStatus { private final int code; @@ -86,4 +90,8 @@ public class FileServer { // TODO remove once verified in system tests. log.info("Done serving reference '" + reference.toString() + "' with file '" + file.getAbsolutePath() + "'"); } + + public void download(FileReference fileReference) { + downloader.getFile(fileReference); + } } 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 7c5adb3b932..d17cdf722ea 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 @@ -21,7 +21,6 @@ import com.yahoo.jrt.StringValue; import com.yahoo.jrt.Supervisor; import com.yahoo.jrt.Target; import com.yahoo.jrt.Transport; -import com.yahoo.jrt.Value; import com.yahoo.log.LogLevel; import com.yahoo.vespa.config.ErrorCode; import com.yahoo.vespa.config.JRTMethods; @@ -249,7 +248,6 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener { } for (int i = 0; i < responsesSent; i++) { - try { completionService.take(); } catch (InterruptedException e) { @@ -469,6 +467,8 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener { : FileApiErrorCodes.NOT_FOUND; if (result == FileApiErrorCodes.OK) { fileServer.startFileServing(fileReference, new FileReceiver(request.target())); + } else { + fileServer.download(new FileReference(fileReference)); } } catch (IllegalArgumentException e) { result = FileApiErrorCodes.NOT_FOUND; |