summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@oath.com>2017-12-09 10:58:17 +0100
committerHarald Musum <musum@oath.com>2017-12-09 10:58:17 +0100
commitebe646e39c4227097b2f67e19fffb399e963fef2 (patch)
treee25b794edc878efabc744ffbf9ce49e21c5eb178
parent46947a0782d08c2a58514f12ca788d7dfd9f11a2 (diff)
Fix some issues related to RPC methods for file distribution
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java11
-rw-r--r--filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java7
2 files changed, 6 insertions, 12 deletions
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 15147d522f3..a09087ad8d3 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
@@ -467,9 +467,6 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener {
fileBlob.parameters().add(new StringValue(fileData.filename()));
fileBlob.parameters().add(new StringValue(fileData.type().name()));
fileBlob.parameters().add(new Int64Value(fileData.size()));
- fileBlob.parameters().add(new Int64Value(fileData.xxhash()));
- fileBlob.parameters().add(new Int32Value(status.getCode()));
- fileBlob.parameters().add(new StringValue(status.getDescription()));
target.invokeSync(fileBlob, 600);
if (fileBlob.isError()) {
log.warning("Failed delivering reference '" + fileData.fileReference().value() + "' with file '" + fileData.filename() + "' to " +
@@ -502,12 +499,12 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener {
}
int retCode = request.returnValues().get(0).asInt32();
if (retCode != 0) {
- throw new IllegalArgumentException("Unknow error from target '" + target.toString() + "' during rpc call " + request.methodName());
+ throw new IllegalArgumentException("Unknown error from target '" + target.toString() + "' during rpc call " + request.methodName());
}
return request.returnValues().get(1).asInt32();
}
private void sendPart(int session, FileReference ref, int partId, byte [] buf) {
- Request request = new Request(FileReceiver.RECEIVE_EOF_METHOD);
+ Request request = new Request(FileReceiver.RECEIVE_PART_METHOD);
request.parameters().add(new StringValue(ref.value()));
request.parameters().add(new Int32Value(session));
request.parameters().add(new Int32Value(partId));
@@ -519,7 +516,7 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener {
}
int retCode = request.returnValues().get(0).asInt32();
if (retCode != 0) {
- throw new IllegalArgumentException("Unknow error from target '" + target.toString() + "' during rpc call " + request.methodName());
+ throw new IllegalArgumentException("Unknown error from target '" + target.toString() + "' during rpc call " + request.methodName());
}
}
private void sendEof(int session, FileReferenceData fileData, FileServer.ReplayStatus status) {
@@ -536,7 +533,7 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener {
}
int retCode = request.returnValues().get(0).asInt32();
if (retCode != 0) {
- throw new IllegalArgumentException("Unknow error from target '" + target.toString() + "' during rpc call " + request.methodName());
+ throw new IllegalArgumentException("Unknown error from target '" + target.toString() + "' during rpc call " + request.methodName());
}
}
}
diff --git a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java
index b28e192f8e4..87bffa145a1 100644
--- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java
+++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java
@@ -9,16 +9,13 @@ import com.yahoo.jrt.Request;
import com.yahoo.jrt.Supervisor;
import com.yahoo.log.LogLevel;
import net.jpountz.xxhash.StreamingXXHash64;
-import net.jpountz.xxhash.XXHash64;
import net.jpountz.xxhash.XXHashFactory;
import java.io.File;
import java.io.IOException;
-import java.nio.ByteBuffer;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
-import java.nio.file.attribute.PosixFilePermissions;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -37,7 +34,6 @@ public class FileReceiver {
private final Supervisor supervisor;
private final FileReferenceDownloader downloader;
private final File downloadDirectory;
- private final XXHash64 hasher = XXHashFactory.fastestInstance().hash64();
private final AtomicInteger nextSessionId = new AtomicInteger(1);
private final Map<Integer, Session> sessions = new HashMap<>();
@@ -161,7 +157,7 @@ public class FileReceiver {
.paramDesc(4, "error-description", "Error description.")
.returnDesc(0, "ret", "0 if success, 1 if crc mismatch, 2 otherwise"));
// Temporary method until we have chunking
- methods.add(new Method(RECEIVE_METHOD, "sssxlis", "i", handler, "receiveFile")
+ methods.add(new Method(RECEIVE_METHOD, "sssXlis", "i", handler, "receiveFile")
.methodDesc("receive file reference content")
.paramDesc(0, "file reference", "file reference to download")
.paramDesc(1, "filename", "filename")
@@ -300,6 +296,7 @@ public class FileReceiver {
synchronized (sessions) {
sessions.remove(sessionId);
}
+ req.returnValues().add(new Int32Value(retval));
}
private final Session getSession(Integer sessionId) {