diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-03-11 18:18:30 +0100 |
---|---|---|
committer | Harald Musum <musum@verizonmedia.com> | 2020-03-11 18:18:30 +0100 |
commit | 5ce79371860589a5a0c8971eb25ee21564376c27 (patch) | |
tree | 6727bfb8dc7a82bab81118e45b78586fa4650158 /config/src | |
parent | acb7410c1109426844bb4a4b2fb8c05abec7ec2f (diff) |
Simplify code, as there exists only one config protocol version
Diffstat (limited to 'config/src')
3 files changed, 3 insertions, 62 deletions
diff --git a/config/src/main/java/com/yahoo/vespa/config/benchmark/LoadTester.java b/config/src/main/java/com/yahoo/vespa/config/benchmark/LoadTester.java index dcaa71dda25..f20371d203c 100644 --- a/config/src/main/java/com/yahoo/vespa/config/benchmark/LoadTester.java +++ b/config/src/main/java/com/yahoo/vespa/config/benchmark/LoadTester.java @@ -47,7 +47,6 @@ public class LoadTester { protected Supervisor supervisor = new Supervisor(transport); private List<ConfigKey<?>> configs = new ArrayList<>(); private Map<ConfigDefinitionKey, Tuple2<String, String[]>> defs = new HashMap<>(); - private long protocolVersion = Long.parseLong(JRTConfigRequestFactory.getProtocolVersion()); private CompressionType compressionType = JRTConfigRequestFactory.getCompressionType(); /** @@ -261,13 +260,9 @@ public class LoadTester { private JRTClientConfigRequest getRequest(ConfigKey<?> reqKey, String[] defContent) { if (defContent == null) defContent = new String[0]; final long serverTimeout = 1000; - if (protocolVersion == 3) { - return JRTClientConfigRequestV3.createWithParams(reqKey, DefContent.fromList(Arrays.asList(defContent)), - "unknown", "", 0, serverTimeout, Trace.createDummy(), - compressionType, Optional.empty()); - } else { - throw new RuntimeException("Unsupported protocol version" + protocolVersion); - } + return JRTClientConfigRequestV3.createWithParams(reqKey, DefContent.fromList(Arrays.asList(defContent)), + "unknown", "", 0, serverTimeout, Trace.createDummy(), + compressionType, Optional.empty()); } private Target connect(Spec spec) { diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactory.java b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactory.java index 60c6aa6e54d..b6277f750dc 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactory.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactory.java @@ -6,9 +6,7 @@ import com.yahoo.config.subscription.impl.JRTConfigSubscription; import com.yahoo.vespa.config.RawConfig; import com.yahoo.vespa.config.util.ConfigUtils; -import java.util.Collections; import java.util.Optional; -import java.util.Set; /** * To hide JRT implementations. @@ -17,7 +15,6 @@ import java.util.Set; */ public class JRTConfigRequestFactory { - public static final String VESPA_CONFIG_PROTOCOL_VERSION = "VESPA_CONFIG_PROTOCOL_VERSION"; // Unused, but should be used if we add a new version private static final CompressionType compressionType = getCompressionType(); private static final String VESPA_CONFIG_PROTOCOL_COMPRESSION = "VESPA_CONFIG_PROTOCOL_COMPRESSION"; @@ -31,18 +28,6 @@ public class JRTConfigRequestFactory { return JRTClientConfigRequestV3.createFromRaw(config, serverTimeout, Trace.createNew(), compressionType, getVespaVersion()); } - public static String getProtocolVersion() { - return "3"; - } - - static String getProtocolVersion(String env, String alternateEnv, String property) { - return ConfigUtils.getEnvValue("3", env, alternateEnv, property); - } - - public static Set<Long> supportedProtocolVersions() { - return Collections.singleton(3L); - } - public static CompressionType getCompressionType() { return getCompressionType(System.getenv(VESPA_CONFIG_PROTOCOL_COMPRESSION), System.getenv("services__config_protocol_compression"), diff --git a/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactoryTest.java b/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactoryTest.java index b7c806ce371..04f3a7abe29 100644 --- a/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactoryTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactoryTest.java @@ -20,41 +20,6 @@ public class JRTConfigRequestFactoryTest { private static VespaVersion defaultVespaVersion = JRTConfigRequestFactory.getCompiledVespaVersion(); @Test - public void testGetProtocolVersion() { - assertThat(JRTConfigRequestFactory.getProtocolVersion("", "", ""), is("3")); - - assertThat(JRTConfigRequestFactory.getProtocolVersion("1", "", ""), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("", "1", ""), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("", "", "1"), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("1", "1", ""), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("1", "", "1"), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("", "1", "1"), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("1", "1", "1"), is("1")); - - assertThat(JRTConfigRequestFactory.getProtocolVersion("2", "", ""), is("2")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("", "2", ""), is("2")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("", "", "2"), is("2")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("2", "2", ""), is("2")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("2", "", "2"), is("2")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("", "2", "2"), is("2")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("2", "2", "2"), is("2")); - - assertThat(JRTConfigRequestFactory.getProtocolVersion("1", "2", ""), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("1", "", "2"), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("", "1", "2"), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("2", "1", ""), is("2")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("2", "", "1"), is("2")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("", "2", "1"), is("2")); - - assertThat(JRTConfigRequestFactory.getProtocolVersion("1", "2", "2"), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("1", "1", "2"), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("1", "2", "1"), is("1")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("2", "1", "1"), is("2")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("2", "1", "2"), is("2")); - assertThat(JRTConfigRequestFactory.getProtocolVersion("2", "2", "1"), is("2")); - } - - @Test public void testCompressionType() { assertThat(JRTConfigRequestFactory.getCompressionType("", "", ""), is(CompressionType.LZ4)); @@ -102,9 +67,7 @@ public class JRTConfigRequestFactoryTest { JRTConfigSubscription<FunctionTestConfig> sub = new JRTConfigSubscription<>( new ConfigKey<>(clazz, configId), subscriber, new ConfigSet(), new TimingValues()); - // Default vespa version JRTClientConfigRequest request = JRTConfigRequestFactory.createFromSub(sub); - assertThat(request.getProtocolVersion(), is(3L)); assertThat(request.getVespaVersion().get(), is(defaultVespaVersion)); } @@ -114,9 +77,7 @@ public class JRTConfigRequestFactoryTest { final String configId = "foo"; RawConfig config = new RawConfig(new ConfigKey<>(clazz, configId), "595f44fec1e92a71d3e9e77456ba80d1"); - // Default vespa version JRTClientConfigRequest request = JRTConfigRequestFactory.createFromRaw(config, 1000); - assertThat(request.getProtocolVersion(), is(3L)); assertThat(request.getVespaVersion().get(), is(defaultVespaVersion)); } |