summaryrefslogtreecommitdiffstats
path: root/messagebus
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-06-26 23:04:23 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2022-06-26 23:04:23 +0200
commitbc136ca2580145a34902a4a77d89b4bbca0ea94a (patch)
tree9a03598479516165ccfde96187cf156e783f7091 /messagebus
parentb659a529c013d6ff0ac21c0a54f49d6b38dc5c67 (diff)
Upgrades from pre vespa-6.149 directly to 8.8 is not supported. GC code from frontend.
Diffstat (limited to 'messagebus')
-rw-r--r--messagebus/src/main/java/com/yahoo/messagebus/network/rpc/RPCNetwork.java1
-rwxr-xr-xmessagebus/src/main/java/com/yahoo/messagebus/network/rpc/RPCSendV1.java156
-rwxr-xr-xmessagebus/src/test/java/com/yahoo/messagebus/network/rpc/SendAdapterTestCase.java25
3 files changed, 18 insertions, 164 deletions
diff --git a/messagebus/src/main/java/com/yahoo/messagebus/network/rpc/RPCNetwork.java b/messagebus/src/main/java/com/yahoo/messagebus/network/rpc/RPCNetwork.java
index c457a703ecc..811d8a25459 100644
--- a/messagebus/src/main/java/com/yahoo/messagebus/network/rpc/RPCNetwork.java
+++ b/messagebus/src/main/java/com/yahoo/messagebus/network/rpc/RPCNetwork.java
@@ -199,7 +199,6 @@ public class RPCNetwork implements Network, MethodHandler {
}
this.owner = owner;
- sendAdapters.put(new Version(5), new RPCSendV1(this));
sendAdapters.put(new Version(6,149), new RPCSendV2(this));
}
diff --git a/messagebus/src/main/java/com/yahoo/messagebus/network/rpc/RPCSendV1.java b/messagebus/src/main/java/com/yahoo/messagebus/network/rpc/RPCSendV1.java
deleted file mode 100755
index 53318aa1299..00000000000
--- a/messagebus/src/main/java/com/yahoo/messagebus/network/rpc/RPCSendV1.java
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.messagebus.network.rpc;
-
-import com.yahoo.component.Version;
-import com.yahoo.jrt.DataValue;
-import com.yahoo.jrt.DoubleValue;
-import com.yahoo.jrt.Int32Array;
-import com.yahoo.jrt.Int32Value;
-import com.yahoo.jrt.Int64Value;
-import com.yahoo.jrt.Int8Value;
-import com.yahoo.jrt.Method;
-import com.yahoo.jrt.Request;
-import com.yahoo.jrt.StringArray;
-import com.yahoo.jrt.StringValue;
-import com.yahoo.jrt.Values;
-import com.yahoo.messagebus.EmptyReply;
-import com.yahoo.messagebus.Error;
-import com.yahoo.messagebus.Message;
-import com.yahoo.messagebus.Reply;
-import com.yahoo.messagebus.Trace;
-import com.yahoo.messagebus.TraceNode;
-import com.yahoo.messagebus.routing.Route;
-import com.yahoo.text.Utf8Array;
-
-/**
- * Implements the request adapter for method "mbus.send1".
- *
- * @author Simon Thoresen Hult
- */
-public class RPCSendV1 extends RPCSend {
-
- private final String METHOD_NAME = "mbus.send1";
- private final String METHOD_PARAMS = "sssbilsxi";
- private final String METHOD_RETURN = "sdISSsxs";
-
- protected RPCSendV1(RPCNetwork net) { super(net); }
-
- @Override
- protected String getReturnSpec() { return METHOD_RETURN; }
-
- @Override
- protected Method buildMethod() {
-
- Method method = new Method(METHOD_NAME, METHOD_PARAMS, METHOD_RETURN, this);
- method.methodDesc("Send a message bus request and get a reply back.");
- method.paramDesc(0, "version", "The version of the message.")
- .paramDesc(1, "route", "Names of additional hops to visit.")
- .paramDesc(2, "session", "The local session that should receive this message.")
- .paramDesc(3, "retryEnabled", "Whether or not this message can be resent.")
- .paramDesc(4, "retry", "The number of times the sending of this message has been retried.")
- .paramDesc(5, "timeRemaining", "The number of milliseconds until timeout.")
- .paramDesc(6, "protocol", "The name of the protocol that knows how to decode this message.")
- .paramDesc(7, "payload", "The protocol specific message payload.")
- .paramDesc(8, "level", "The trace level of the message.");
- method.returnDesc(0, "version", "The lowest version the message was serialized as.")
- .returnDesc(1, "retryDelay", "The retry request of the reply.")
- .returnDesc(2, "errorCodes", "The reply error codes.")
- .returnDesc(3, "errorMessages", "The reply error messages.")
- .returnDesc(4, "errorServices", "The reply error service names.")
- .returnDesc(5, "protocol", "The name of the protocol that knows how to decode this reply.")
- .returnDesc(6, "payload", "The protocol specific reply payload.")
- .returnDesc(7, "trace", "A string representation of the trace.");
- return method;
- }
- @Override
- protected Request encodeRequest(Version version, Route route, RPCServiceAddress address, Message msg,
- long timeRemaining, byte[] payload, int traceLevel) {
- Request req = new Request(METHOD_NAME);
- Values v = req.parameters();
- v.add(new StringValue(version.toUtf8()));
- v.add(new StringValue(route.toString()));
- v.add(new StringValue(address.getSessionName()));
- v.add(new Int8Value(msg.getRetryEnabled() ? (byte)1 : (byte)0));
- v.add(new Int32Value(msg.getRetry()));
- v.add(new Int64Value(timeRemaining));
- v.add(new StringValue(msg.getProtocol()));
- v.add(new DataValue(payload));
- v.add(new Int32Value(traceLevel));
- return req;
- }
-
- @Override
- protected Reply createReply(Values ret, String serviceName, Trace trace) {
- Version version = new Version(ret.get(0).asUtf8Array());
- double retryDelay = ret.get(1).asDouble();
- int[] errorCodes = ret.get(2).asInt32Array();
- String[] errorMessages = ret.get(3).asStringArray();
- String[] errorServices = ret.get(4).asStringArray();
- Utf8Array protocolName = ret.get(5).asUtf8Array();
- byte[] payload = ret.get(6).asData();
- String replyTrace = ret.get(7).asString();
-
- // Make sure that the owner understands the protocol.
- Reply reply = null;
- Error error = null;
- if (payload.length > 0) {
- Object retval = decode(protocolName, version, payload);
- if (retval instanceof Reply) {
- reply = (Reply) retval;
- } else {
- error = (Error) retval;
- }
- }
- if (reply == null) {
- reply = new EmptyReply();
- }
- if (error != null) {
- reply.addError(error);
- }
- reply.setRetryDelay(retryDelay);
- for (int i = 0; i < errorCodes.length && i < errorMessages.length; i++) {
- reply.addError(new Error(errorCodes[i], errorMessages[i],
- errorServices[i].length() > 0 ? errorServices[i] : serviceName));
- }
- if (trace.getLevel() > 0) {
- trace.getRoot().addChild(TraceNode.decode(replyTrace));
- }
- return reply;
- }
-
- protected Params toParams(Values args) {
- Params p = new Params();
- p.version = new Version(args.get(0).asUtf8Array());
- p.route = args.get(1).asString();
- p.session = args.get(2).asString();
- p.retryEnabled = (args.get(3).asInt8() != 0);
- p.retry = args.get(4).asInt32();
- p.timeRemaining = args.get(5).asInt64();
- p.protocolName = args.get(6).asUtf8Array();
- p.payload = args.get(7).asData();
- p.traceLevel = args.get(8).asInt32();
- return p;
- }
-
- @Override
- protected void createResponse(Values ret, Reply reply, Version version, byte [] payload) {
- int[] eCodes = new int[reply.getNumErrors()];
- String[] eMessages = new String[reply.getNumErrors()];
- String[] eServices = new String[reply.getNumErrors()];
- for (int i = 0; i < reply.getNumErrors(); ++i) {
- Error error = reply.getError(i);
- eCodes[i] = error.getCode();
- eMessages[i] = error.getMessage();
- eServices[i] = error.getService() != null ? error.getService() : "";
- }
- ret.add(new StringValue(version.toUtf8()));
- ret.add(new DoubleValue(reply.getRetryDelay()));
- ret.add(new Int32Array(eCodes));
- ret.add(new StringArray(eMessages));
- ret.add(new StringArray(eServices));
- ret.add(new StringValue(reply.getProtocol()));
- ret.add(new DataValue(payload));
- ret.add(new StringValue(reply.getTrace().getRoot() != null ? reply.getTrace().getRoot().encode() : ""));
- }
-
-}
diff --git a/messagebus/src/test/java/com/yahoo/messagebus/network/rpc/SendAdapterTestCase.java b/messagebus/src/test/java/com/yahoo/messagebus/network/rpc/SendAdapterTestCase.java
index efb1045ba84..437be44ea25 100755
--- a/messagebus/src/test/java/com/yahoo/messagebus/network/rpc/SendAdapterTestCase.java
+++ b/messagebus/src/test/java/com/yahoo/messagebus/network/rpc/SendAdapterTestCase.java
@@ -4,7 +4,16 @@ package com.yahoo.messagebus.network.rpc;
import com.yahoo.component.Version;
import com.yahoo.jrt.ListenFailedException;
import com.yahoo.jrt.slobrok.server.Slobrok;
-import com.yahoo.messagebus.*;
+import com.yahoo.messagebus.DestinationSession;
+import com.yahoo.messagebus.DestinationSessionParams;
+import com.yahoo.messagebus.IntermediateSession;
+import com.yahoo.messagebus.IntermediateSessionParams;
+import com.yahoo.messagebus.Message;
+import com.yahoo.messagebus.MessageBusParams;
+import com.yahoo.messagebus.Reply;
+import com.yahoo.messagebus.Routable;
+import com.yahoo.messagebus.SourceSession;
+import com.yahoo.messagebus.SourceSessionParams;
import com.yahoo.messagebus.network.Identity;
import com.yahoo.messagebus.network.rpc.test.TestServer;
import com.yahoo.messagebus.routing.Route;
@@ -20,7 +29,11 @@ import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
/**
* @author Simon Thoresen Hult
@@ -81,17 +94,15 @@ public class SendAdapterTestCase {
@Test
public void requireCorrectVersionSelection() {
assertNull(srcServer.net.getSendAdapter(new Version(4,999)));
- assertTrue(srcServer.net.getSendAdapter(new Version(5,0)) instanceof RPCSendV1);
- assertTrue(srcServer.net.getSendAdapter(new Version(6,148)) instanceof RPCSendV1);
+ assertNull(srcServer.net.getSendAdapter(new Version(5,0)));
+ assertNull(srcServer.net.getSendAdapter(new Version(6,148)));
assertTrue(srcServer.net.getSendAdapter(new Version(6,149)) instanceof RPCSendV2);
assertTrue(srcServer.net.getSendAdapter(new Version(9,9999)) instanceof RPCSendV2);
}
@Test
- public void requireThatMessagesCanBeSentAcrossAllSupportedVersions() throws Exception {
+ public void requireThatMessagesCanBeSentAcrossAllSupportedVersions() {
List<Version> versions = Arrays.asList(
- new Version(5, 0),
- new Version(6, 148),
new Version(6, 149),
new Version(9, 999)
);