summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServer.java5
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java10
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java2
3 files changed, 12 insertions, 5 deletions
diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServer.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServer.java
index 01f2c161247..699a66ac5d5 100644
--- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServer.java
+++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServer.java
@@ -131,12 +131,15 @@ public class ConfigProxyRpcServer implements Runnable, TargetWatcher, RpcServer
.methodDesc("set which file references to download")
.paramDesc(0, "file references", "file reference to download")
.returnDesc(0, "ret", "0 if success, 1 otherwise"));
- supervisor.addMethod(new Method("filedistribution.receiveFile", "slx", "i", // TODO Temporary method to get started with testing
+ supervisor.addMethod(new Method("filedistribution.receiveFile", "ssxli", "i", // TODO Temporary method to get started with testing
this, "receiveFile")
.methodDesc("receive file reference content")
.paramDesc(0, "file references", "file reference to download")
.paramDesc(1, "filename", "filename")
.paramDesc(2, "content", "array of bytes")
+ .paramDesc(3, "hash", "xx64hash of the file content")
+ .paramDesc(4, "errorcode", "Error code. 0 if none")
+ .paramDesc(5, "error-description", "Error description.")
.returnDesc(0, "ret", "0 if success, 1 otherwise"));
}
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 581293c3128..4b0b19a34d0 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
@@ -52,21 +52,25 @@ public class FileServer {
}
private void serveFile(String fileName, Target target) {
- Request fileBlob = new Request("receiveFile");
+ Request fileBlob = new Request("filedistribution.receiveFile");
File file = new File(getPath(new FileReference(fileName)));
fileBlob.parameters().add(new StringValue(fileName));
+ fileBlob.parameters().add(new StringValue(fileName));
byte [] blob = new byte [0];
boolean success = false;
+ String errorDescription = "OK";
try {
blob = IOUtils.readFileBytes(file);
success = true;
} catch (IOException e) {
- log.warning("Failed reading file '" + file.getAbsolutePath() + "' for sending to '" + target.toString() + "'.");
+ errorDescription = "Failed reading file '" + file.getAbsolutePath() + "'";
+ log.warning(errorDescription + "for sending to '" + target.toString() + "'.");
}
XXHash64 hasher = XXHashFactory.fastestInstance().hash64();
fileBlob.parameters().add(new DataValue(blob));
- fileBlob.parameters().add(new Int32Value(success ? 0 : 1));
fileBlob.parameters().add(new Int64Value(hasher.hash(ByteBuffer.wrap(blob), 0)));
+ fileBlob.parameters().add(new Int32Value(success ? 0 : 1));
+ fileBlob.parameters().add(new StringValue(success ? "OK" : errorDescription));
target.invokeSync(fileBlob, 600);
}
}
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 25652eb5ace..3ae6a8a1af9 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
@@ -198,7 +198,7 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener {
getSupervisor().addMethod(new Method("printStatistics", "", "s", this, "printStatistics")
.methodDesc("printStatistics")
.returnDesc(0, "statistics", "Statistics for server"));
- getSupervisor().addMethod(new Method("serveFile", "s", "is", this, "serveFile"));
+ getSupervisor().addMethod(new Method("filedistribution.serveFile", "s", "is", this, "serveFile"));
}
/**