Skip to content

Commit

Permalink
Deprecate http.pipelining setting (#30786)
Browse files Browse the repository at this point in the history
This is related to #29500. In 7.0 this setting will be removed. This PR
marks the setting in 6.x as deprecated.
  • Loading branch information
Tim-Brooks committed May 23, 2018
1 parent 42d0af1 commit 621a26b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -152,6 +157,8 @@ public void testThatHttpPipeliningCanBeDisabled() throws Exception {
assertThat(slowIds, equalTo(ids));
}
}

assertSettingDeprecationsAndWarnings(new Setting<?>[] {HttpTransportSettings.SETTING_PIPELINING});
}

class CustomNettyHttpServerTransport extends Netty4HttpServerTransport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean> 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<Boolean> SETTING_PIPELINING =
Setting.boolSetting("http.pipelining", true, Property.NodeScope);
Setting.boolSetting("http.pipelining", true, Property.NodeScope, Property.Deprecated);
public static final Setting<Integer> SETTING_PIPELINING_MAX_EVENTS =
Setting.intSetting("http.pipelining.max_events", 10000, Property.NodeScope);
public static final Setting<Boolean> SETTING_HTTP_COMPRESSION =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -72,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();
Expand Down Expand Up @@ -233,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<Client> iterator1 = cluster1.getClients().iterator();
for (Client client : cluster0.getClients()) {
Expand All @@ -248,7 +251,7 @@ public Settings transportClientSettings() {
} finally {
IOUtils.close(cluster0, cluster1);
if (shouldAssertSettingsDeprecationsAndWarnings) {
assertSettingDeprecationsAndWarnings(new Setting<?>[]{NetworkModule.HTTP_ENABLED});
assertSettingDeprecationsAndWarnings(new Setting<?>[] {NetworkModule.HTTP_ENABLED});
}
}
}
Expand Down Expand Up @@ -355,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) {
Expand Down Expand Up @@ -456,7 +459,7 @@ public Settings transportClientSettings() {
} finally {
cluster.close();
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
assertSettingDeprecationsAndWarnings(DEPRECATED_SETTINGS);
}

public void testTwoNodeCluster() throws Exception {
Expand Down Expand Up @@ -518,7 +521,7 @@ public Settings onNodeStopped(String nodeName) throws Exception {
} finally {
cluster.close();
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
assertSettingDeprecationsAndWarnings(DEPRECATED_SETTINGS);
}

/**
Expand Down

0 comments on commit 621a26b

Please sign in to comment.