diff options
author | Tor Egge <tegge@oath.com> | 2018-11-06 13:07:07 +0000 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2019-01-23 21:40:11 +0100 |
commit | db737fbf11d3e72658a2f564d9a11cccc05c9dd0 (patch) | |
tree | 605afb0a0211ee18ed0d2b9801a266cce1d39ba9 /vespa-http-client/src/main | |
parent | edc29b2b3029f4fc2e7ad518d5c75e757391f841 (diff) |
Remove support for vespa http client protocol v2. Always use protocol v3.
Diffstat (limited to 'vespa-http-client/src/main')
5 files changed, 8 insertions, 48 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) |