From ec1e89e1d07937f7d819eb1bbe2e8ff84f2549aa Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Tue, 22 May 2018 10:07:29 -0600 Subject: [PATCH 1/5] Deprecate http.pipelining setting This is related to #29500. In 7.0 this setting will be removed. This PR marks the setting in 6.x as deprecated. --- .../java/org/elasticsearch/http/HttpTransportSettings.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/http/HttpTransportSettings.java b/server/src/main/java/org/elasticsearch/http/HttpTransportSettings.java index ce305872d222d..fbf596445982c 100644 --- a/server/src/main/java/org/elasticsearch/http/HttpTransportSettings.java +++ b/server/src/main/java/org/elasticsearch/http/HttpTransportSettings.java @@ -49,8 +49,9 @@ public final class HttpTransportSettings { new Setting<>("http.cors.allow-headers", "X-Requested-With,Content-Type,Content-Length", (value) -> value, Property.NodeScope); public static final Setting SETTING_CORS_ALLOW_CREDENTIALS = Setting.boolSetting("http.cors.allow-credentials", false, Property.NodeScope); + // In 7.0 pipelining support will always be enabled and this setting will be removed. public static final Setting SETTING_PIPELINING = - Setting.boolSetting("http.pipelining", true, Property.NodeScope); + Setting.boolSetting("http.pipelining", true, Property.NodeScope, Property.Deprecated); public static final Setting SETTING_PIPELINING_MAX_EVENTS = Setting.intSetting("http.pipelining.max_events", 10000, Property.NodeScope); public static final Setting SETTING_HTTP_COMPRESSION = From 0ca3980ab6e919d9c39ff2021cb1ea28aed070bc Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Tue, 22 May 2018 10:57:49 -0600 Subject: [PATCH 2/5] Fix test --- .../org/elasticsearch/test/test/InternalTestClusterTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java b/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java index 23c665af30a30..e603c4e1a5ec1 100644 --- a/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java +++ b/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java @@ -31,6 +31,7 @@ import org.elasticsearch.discovery.DiscoverySettings; import org.elasticsearch.discovery.zen.ZenDiscovery; import org.elasticsearch.env.NodeEnvironment; +import org.elasticsearch.http.HttpTransportSettings; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.InternalTestCluster; @@ -456,7 +457,7 @@ public Settings transportClientSettings() { } finally { cluster.close(); } - assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED, HttpTransportSettings.SETTING_PIPELINING}); } public void testTwoNodeCluster() throws Exception { From fa1b8a40877e411093bb40d1ab6b41daf897aa10 Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Tue, 22 May 2018 11:30:01 -0600 Subject: [PATCH 3/5] Fix tests --- .../java/org/elasticsearch/node/MockNodeTests.java | 3 ++- .../test/test/InternalTestClusterTests.java | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java b/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java index a0cdb8c3168f4..0b41a515d275c 100644 --- a/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java +++ b/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java @@ -25,6 +25,7 @@ import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.MockBigArrays; import org.elasticsearch.env.Environment; +import org.elasticsearch.http.HttpTransportSettings; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.MockSearchService; import org.elasticsearch.search.SearchService; @@ -69,6 +70,6 @@ public void testComponentsMockedByMarkerPlugins() throws IOException { assertSame(searchService.getClass(), SearchService.class); } } - assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED, HttpTransportSettings.SETTING_PIPELINING}); } } diff --git a/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java b/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java index e603c4e1a5ec1..bf66dbec4d0ca 100644 --- a/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java +++ b/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java @@ -73,6 +73,8 @@ @LuceneTestCase.SuppressFileSystems("ExtrasFS") // doesn't work with potential multi data path from test cluster yet public class InternalTestClusterTests extends ESTestCase { + private static final Setting[] DEPRECATED_SETTINGS = {NetworkModule.HTTP_ENABLED, HttpTransportSettings.SETTING_PIPELINING}; + public void testInitializiationIsConsistent() { long clusterSeed = randomLong(); boolean masterNodes = randomBoolean(); @@ -234,7 +236,7 @@ public Settings transportClientSettings() { assertArrayEquals(cluster0.getNodeNames(), cluster1.getNodeNames()); if (cluster0.getNodeNames().length > 0) { shouldAssertSettingsDeprecationsAndWarnings = true; - assertSettingDeprecationsAndWarnings(new Setting[]{NetworkModule.HTTP_ENABLED}); + assertSettingDeprecationsAndWarnings(DEPRECATED_SETTINGS); } Iterator iterator1 = cluster1.getClients().iterator(); for (Client client : cluster0.getClients()) { @@ -249,7 +251,7 @@ public Settings transportClientSettings() { } finally { IOUtils.close(cluster0, cluster1); if (shouldAssertSettingsDeprecationsAndWarnings) { - assertSettingDeprecationsAndWarnings(new Setting[]{NetworkModule.HTTP_ENABLED}); + assertSettingDeprecationsAndWarnings(DEPRECATED_SETTINGS); } } } @@ -356,7 +358,7 @@ public Settings transportClientSettings() { } finally { cluster.close(); } - assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); + assertSettingDeprecationsAndWarnings(DEPRECATED_SETTINGS); } private Path[] getNodePaths(InternalTestCluster cluster, String name) { @@ -457,7 +459,7 @@ public Settings transportClientSettings() { } finally { cluster.close(); } - assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED, HttpTransportSettings.SETTING_PIPELINING}); + assertSettingDeprecationsAndWarnings(DEPRECATED_SETTINGS); } public void testTwoNodeCluster() throws Exception { @@ -517,6 +519,6 @@ public Settings onNodeStopped(String nodeName) throws Exception { } finally { cluster.close(); } - assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); + assertSettingDeprecationsAndWarnings(DEPRECATED_SETTINGS); } } From b228af19547c21abe9380e54b75c980abe03ef3d Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Tue, 22 May 2018 17:32:38 -0600 Subject: [PATCH 4/5] Fix tests --- .../src/test/java/org/elasticsearch/node/MockNodeTests.java | 2 +- .../org/elasticsearch/test/test/InternalTestClusterTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java b/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java index 0b41a515d275c..5eb437d14d608 100644 --- a/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java +++ b/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java @@ -70,6 +70,6 @@ public void testComponentsMockedByMarkerPlugins() throws IOException { assertSame(searchService.getClass(), SearchService.class); } } - assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED, HttpTransportSettings.SETTING_PIPELINING}); + assertSettingDeprecationsAndWarnings(new Setting[] {NetworkModule.HTTP_ENABLED}); } } diff --git a/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java b/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java index bf66dbec4d0ca..ad30abe494e40 100644 --- a/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java +++ b/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java @@ -251,7 +251,7 @@ public Settings transportClientSettings() { } finally { IOUtils.close(cluster0, cluster1); if (shouldAssertSettingsDeprecationsAndWarnings) { - assertSettingDeprecationsAndWarnings(DEPRECATED_SETTINGS); + assertSettingDeprecationsAndWarnings(new Setting[] {NetworkModule.HTTP_ENABLED}); } } } From 608292d6e9581424a87de64dab52fc99b1350ef1 Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Tue, 22 May 2018 20:59:54 -0600 Subject: [PATCH 5/5] Fix tests --- .../http/netty4/Netty4HttpServerPipeliningTests.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerPipeliningTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerPipeliningTests.java index 91a5465f6a764..1c7475379bb87 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerPipeliningTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerPipeliningTests.java @@ -32,13 +32,16 @@ import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpVersion; +import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.network.NetworkService; +import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.util.MockBigArrays; import org.elasticsearch.common.util.MockPageCacheRecycler; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.http.HttpServerTransport; +import org.elasticsearch.http.HttpTransportSettings; import org.elasticsearch.http.NullDispatcher; import org.elasticsearch.http.netty4.pipelining.HttpPipelinedRequest; import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; @@ -110,6 +113,8 @@ public void testThatHttpPipeliningWorksWhenEnabled() throws Exception { assertThat(responseBodies, contains(requests.toArray())); } } + + assertSettingDeprecationsAndWarnings(new Setting[] {HttpTransportSettings.SETTING_PIPELINING}); } public void testThatHttpPipeliningCanBeDisabled() throws Exception { @@ -152,6 +157,8 @@ public void testThatHttpPipeliningCanBeDisabled() throws Exception { assertThat(slowIds, equalTo(ids)); } } + + assertSettingDeprecationsAndWarnings(new Setting[] {HttpTransportSettings.SETTING_PIPELINING}); } class CustomNettyHttpServerTransport extends Netty4HttpServerTransport {