summaryrefslogtreecommitdiffstats
path: root/vespa-http-client
diff options
context:
space:
mode:
authorTor Egge <tegge@oath.com>2018-11-06 13:07:07 +0000
committerJon Bratseth <bratseth@verizonmedia.com>2019-01-23 21:40:11 +0100
commitdb737fbf11d3e72658a2f564d9a11cccc05c9dd0 (patch)
tree605afb0a0211ee18ed0d2b9801a266cce1d39ba9 /vespa-http-client
parentedc29b2b3029f4fc2e7ad518d5c75e757391f841 (diff)
Remove support for vespa http client protocol v2. Always use protocol v3.
Diffstat (limited to 'vespa-http-client')
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/ConnectionParams.java13
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java13
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java10
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java4
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/CommandLineArguments.java16
-rw-r--r--vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnectionTest.java3
-rw-r--r--vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessorTest.java8
-rw-r--r--vespa-http-client/src/test/java/com/yahoo/vespa/http/client/runner/CommandLineArgumentsTest.java21
8 files changed, 12 insertions, 76 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/ConnectionParams.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/ConnectionParams.java
index d5f362ce1d1..9e34d4d1747 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/ConnectionParams.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/ConnectionParams.java
@@ -46,7 +46,6 @@ public final class ConnectionParams {
private int maxRetries = 100;
private long minTimeBetweenRetriesMs = 700;
private boolean dryRun = false;
- private boolean enableV3Protocol = true;
private int traceLevel = 0;
private int traceEveryXOperation = 0;
private boolean printTraceToStdErr = true;
@@ -175,12 +174,6 @@ public final class ConnectionParams {
return this;
}
- @Beta
- public Builder setEnableV3Protocol(boolean enableV3Protocol) {
- this.enableV3Protocol = enableV3Protocol;
- return this;
- }
-
/**
* Set the min time between retries when temporarily failing against a gateway.
*
@@ -245,7 +238,6 @@ public final class ConnectionParams {
maxRetries,
minTimeBetweenRetriesMs,
dryRun,
- enableV3Protocol,
traceLevel,
traceEveryXOperation,
printTraceToStdErr);
@@ -301,7 +293,6 @@ public final class ConnectionParams {
private final int maxRetries;
private final long minTimeBetweenRetriesMs;
private final boolean dryRun;
- private final boolean enableV3Protocol;
private final int traceLevel;
private final int traceEveryXOperation;
private final boolean printTraceToStdErr;
@@ -319,7 +310,6 @@ public final class ConnectionParams {
int maxRetries,
long minTimeBetweenRetriesMs,
boolean dryRun,
- boolean enableV3Protocol,
int traceLevel,
int traceEveryXOperation,
boolean printTraceToStdErr) {
@@ -335,7 +325,6 @@ public final class ConnectionParams {
this.maxRetries = maxRetries;
this.minTimeBetweenRetriesMs = minTimeBetweenRetriesMs;
this.dryRun = dryRun;
- this.enableV3Protocol = enableV3Protocol;
this.traceLevel = traceLevel;
this.traceEveryXOperation = traceEveryXOperation;
this.printTraceToStdErr = printTraceToStdErr;
@@ -387,8 +376,6 @@ public final class ConnectionParams {
return dryRun;
}
- public boolean isEnableV3Protocol() { return enableV3Protocol; }
-
public int getTraceLevel() {
return traceLevel;
}
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java
index e9852de215a..d7733a23b18 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java
@@ -78,7 +78,7 @@ class ApacheGatewayConnection implements GatewayConnection {
ConnectionParams connectionParams,
HttpClientFactory httpClientFactory,
String clientId) {
- SUPPORTED_VERSIONS.add(2);
+ SUPPORTED_VERSIONS.add(3);
this.endpoint = endpoint;
this.feedParams = feedParams;
this.clusterSpecificRoute = clusterSpecificRoute;
@@ -94,11 +94,8 @@ class ApacheGatewayConnection implements GatewayConnection {
endOfFeed = END_OF_FEED_XML;
}
this.clientId = clientId;
- if (connectionParams.isEnableV3Protocol()) {
- if (this.clientId == null) {
- throw new RuntimeException("Set to support version 3, but got no client Id.");
- }
- SUPPORTED_VERSIONS.add(3);
+ if (this.clientId == null) {
+ throw new RuntimeException("Got no client Id.");
}
}
@@ -344,10 +341,6 @@ class ApacheGatewayConnection implements GatewayConnection {
log.log(Level.FINE, "Server decided upon protocol version " + serverVersion + ".");
}
}
- if (this.connectionParams.isEnableV3Protocol() && serverVersion != 3) {
- throw new ServerResponseException("Client was set up to use v3 of protocol, however, gateway wants to " +
- "use version " + serverVersion + ". Already set up structures for v3 so can not do v2 now.");
- }
this.negotiatedVersion = serverVersion;
}
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java
index d124475e3a5..da45acc5687 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java
@@ -79,12 +79,8 @@ public class ClusterConnection implements AutoCloseable {
operationProcessor.getClientId()
);
}
- if (connectionParams.isEnableV3Protocol()) {
- if (documentQueue == null) {
- documentQueue = new DocumentQueue(clientQueueSizePerCluster);
- }
- } else {
- documentQueue = new DocumentQueue(clientQueueSizePerCluster / cluster.getEndpoints().size());
+ if (documentQueue == null) {
+ documentQueue = new DocumentQueue(clientQueueSizePerCluster);
}
final IOThread ioThread = new IOThread(
operationProcessor.getIoThreadGroup(),
@@ -95,7 +91,7 @@ public class ClusterConnection implements AutoCloseable {
maxInFlightPerSession,
feedParams.getLocalQueueTimeOut(),
documentQueue,
- connectionParams.isEnableV3Protocol() ? feedParams.getMaxSleepTimeMs() : 0);
+ feedParams.getMaxSleepTimeMs());
ioThreads.add(ioThread);
}
}
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java
index 7ead0c4a37f..45133901567 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java
@@ -51,7 +51,6 @@ public class OperationProcessor {
private final long minTimeBetweenRetriesMs;
private final Random random = new SecureRandom();
private final int traceEveryXOperation;
- private final boolean blockOperationsToSameDocument;
private int traceCounter = 0;
private final boolean traceToStderr;
private final ThreadGroup ioThreadGroup;
@@ -66,7 +65,6 @@ public class OperationProcessor {
this.resultCallback = resultCallback;
this.incompleteResultsThrottler = incompleteResultsThrottler;
this.timeoutExecutor = timeoutExecutor;
- this.blockOperationsToSameDocument = sessionParams.getConnectionParams().isEnableV3Protocol();
this.ioThreadGroup = new ThreadGroup("operationprocessor");
if (sessionParams.getClusters().isEmpty()) {
@@ -243,7 +241,7 @@ public class OperationProcessor {
incompleteResultsThrottler.operationStart();
synchronized (monitor) {
- if (blockOperationsToSameDocument && inflightDocumentIds.contains(document.getDocumentId())) {
+ if (inflightDocumentIds.contains(document.getDocumentId())) {
blockedDocumentsByDocumentId.put(document.getDocumentId(), document);
return;
}
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/CommandLineArguments.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/CommandLineArguments.java
index 1aee1670832..98cd13a226d 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/CommandLineArguments.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/CommandLineArguments.java
@@ -66,16 +66,6 @@ public class CommandLineArguments {
return null;
}
}
- if (cmdArgs.enableV2Protocol) {
- if (cmdArgs.enableV3Protocol) {
- System.err.println("both --useV2Protocol and --useV3Protocol options specified, ignoring deprecated --useV2Protocol option");
- cmdArgs.enableV2Protocol = false;
- } else {
- System.err.println("--useV2Protocol option is deprecated");
- }
- } else {
- cmdArgs.enableV3Protocol = true;
- }
return cmdArgs;
}
@@ -110,10 +100,7 @@ public class CommandLineArguments {
private HelpOption helpOption;
@Option(name = {"--useV3Protocol"}, description = "Use V3 protocol to gateway. This is the default protocol.")
- private boolean enableV3Protocol = false;
-
- @Option(name = {"--useV2Protocol"}, description = "Use old V2 protocol to gateway. This option is deprecated.")
- private boolean enableV2Protocol = false;
+ private boolean enableV3Protocol = true;
@Option(name = {"--file"},
description = "The name of the input file to read.")
@@ -240,7 +227,6 @@ public class CommandLineArguments {
.setHostnameVerifier(insecure ? NoopHostnameVerifier.INSTANCE :
SSLConnectionSocketFactory.getDefaultHostnameVerifier())
.setNumPersistentConnectionsPerEndpoint(16)
- .setEnableV3Protocol(! enableV2Protocol)
.setUseCompression(useCompressionArg)
.setMaxRetries(noRetryArg ? 0 : 100)
.setMinTimeBetweenRetries(retrydelayArg, TimeUnit.SECONDS)
diff --git a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnectionTest.java b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnectionTest.java
index fa14a276445..90d2fa28833 100644
--- a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnectionTest.java
+++ b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnectionTest.java
@@ -55,7 +55,6 @@ public class ApacheGatewayConnectionTest {
final FeedParams feedParams = new FeedParams.Builder().setDataFormat(FeedParams.DataFormat.JSON_UTF8).build();
final String clusterSpecificRoute = "";
final ConnectionParams connectionParams = new ConnectionParams.Builder()
- .setEnableV3Protocol(true)
.build();
final List<Document> documents = new ArrayList<>();
@@ -90,7 +89,6 @@ public class ApacheGatewayConnectionTest {
final FeedParams feedParams = new FeedParams.Builder().setDataFormat(FeedParams.DataFormat.JSON_UTF8).build();
final String clusterSpecificRoute = "";
final ConnectionParams connectionParams = new ConnectionParams.Builder()
- .setEnableV3Protocol(true)
.build();
// This is the fake server, returns wrong session Id.
@@ -115,7 +113,6 @@ public class ApacheGatewayConnectionTest {
final FeedParams feedParams = new FeedParams.Builder().setDataFormat(FeedParams.DataFormat.JSON_UTF8).build();
final String clusterSpecificRoute = "";
final ConnectionParams connectionParams = new ConnectionParams.Builder()
- .setEnableV3Protocol(true)
.build();
final ApacheGatewayConnection.HttpClientFactory mockFactory =
diff --git a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessorTest.java b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessorTest.java
index 42cbfd19a88..6eb878eaeea 100644
--- a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessorTest.java
+++ b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessorTest.java
@@ -123,7 +123,7 @@ public class OperationProcessorTest {
SessionParams sessionParams = new SessionParams.Builder()
.addCluster(new Cluster.Builder().addEndpoint(Endpoint.create("host")).build())
.addCluster(new Cluster.Builder().addEndpoint(Endpoint.create("host")).build())
- .setConnectionParams(new ConnectionParams.Builder().setEnableV3Protocol(true).build())
+ .setConnectionParams(new ConnectionParams.Builder().build())
.build();
OperationProcessor operationProcessor = new OperationProcessor(
new IncompleteResultsThrottler(1000, 1000, null, null),
@@ -160,7 +160,7 @@ public class OperationProcessorTest {
public void testBlockingOfOperationsToSameDocIdWithTwoOperations() {
SessionParams sessionParams = new SessionParams.Builder()
.addCluster(new Cluster.Builder().addEndpoint(Endpoint.create("host")).build())
- .setConnectionParams(new ConnectionParams.Builder().setEnableV3Protocol(true).build())
+ .setConnectionParams(new ConnectionParams.Builder().build())
.build();
OperationProcessor operationProcessor = new OperationProcessor(
@@ -193,7 +193,7 @@ public class OperationProcessorTest {
public void testBlockingOfOperationsToSameDocIdMany() {
SessionParams sessionParams = new SessionParams.Builder()
.addCluster(new Cluster.Builder().addEndpoint(Endpoint.create("host")).build())
- .setConnectionParams(new ConnectionParams.Builder().setEnableV3Protocol(true).build())
+ .setConnectionParams(new ConnectionParams.Builder().build())
.build();
OperationProcessor operationProcessor = new OperationProcessor(
@@ -228,7 +228,7 @@ public class OperationProcessorTest {
Endpoint endpoint = Endpoint.create("host");
SessionParams sessionParams = new SessionParams.Builder()
.addCluster(new Cluster.Builder().addEndpoint(endpoint).build())
- .setConnectionParams(new ConnectionParams.Builder().setEnableV3Protocol(true).build())
+ .setConnectionParams(new ConnectionParams.Builder().build())
.build();
OperationProcessor operationProcessor = new OperationProcessor(
diff --git a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/runner/CommandLineArgumentsTest.java b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/runner/CommandLineArgumentsTest.java
index 1f01ea12934..ec80dd53a4b 100644
--- a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/runner/CommandLineArgumentsTest.java
+++ b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/runner/CommandLineArgumentsTest.java
@@ -95,7 +95,6 @@ public class CommandLineArgumentsTest {
assertThat(params.getClusters().get(0).getEndpoints().get(0).isUseSsl(), is(false));
assertThat(params.getConnectionParams().getUseCompression(), is(false));
assertThat(params.getConnectionParams().getNumPersistentConnectionsPerEndpoint(), is(16));
- assertThat(params.getConnectionParams().isEnableV3Protocol(), is(true));
assertThat(params.getFeedParams().getRoute(), is("default"));
assertThat(params.getFeedParams().getDataFormat(), is(FeedParams.DataFormat.XML_UTF8));
assertThat(params.getFeedParams().getLocalQueueTimeOut(), is(180000L));
@@ -176,30 +175,10 @@ public class CommandLineArgumentsTest {
}
@Test
- public void testDeprecatedUseV2Protocol() {
- addMinimum();
- args.add("--useV2Protocol");
- CommandLineArguments arguments = CommandLineArguments.build(asArray());
- SessionParams params = arguments.createSessionParams(true /* use json */);
- assertThat(params.getConnectionParams().isEnableV3Protocol(), is(false));
- }
-
- @Test
public void testUseV3Protocol() {
addMinimum();
args.add("--useV3Protocol");
CommandLineArguments arguments = CommandLineArguments.build(asArray());
SessionParams params = arguments.createSessionParams(true /* use json */);
- assertThat(params.getConnectionParams().isEnableV3Protocol(), is(true));
- }
-
- @Test
- public void testDeprecatedUseV2ProtocolAndUseV3Protocol() {
- addMinimum();
- args.add("--useV2Protocol");
- args.add("--useV3Protocol");
- CommandLineArguments arguments = CommandLineArguments.build(asArray());
- SessionParams params = arguments.createSessionParams(true /* use json */);
- assertThat(params.getConnectionParams().isEnableV3Protocol(), is(true));
}
}