Skip to content

Commit

Permalink
Remove nio transport from 6.x (elastic#34756) (elastic#34879)
Browse files Browse the repository at this point in the history
This commit removes the nio transport work from 6.x This work will never
be enabled outside of the test framework. Additionally, we get
sufficient testing on master/7.0 right now. So there is no need to have
it on 6.x.

This is motivated by the fact that this work has diverged significantly
from master. This makes backports difficult. Additionally, the nio
transport uses many connections increasing the timeouts due to resource
exhaustion in the build.
  • Loading branch information
Tim-Brooks authored Oct 26, 2018
1 parent 0eab246 commit 2ae0d1b
Show file tree
Hide file tree
Showing 51 changed files with 8 additions and 5,608 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.transport.MockTcpTransportPlugin;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
import org.elasticsearch.transport.nio.NioTransportPlugin;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
Expand Down Expand Up @@ -82,16 +81,9 @@ private static Client startClient(Path tempDir, TransportAddress... transportAdd
.put("client.transport.ignore_cluster_name", true)
.put(Environment.PATH_HOME_SETTING.getKey(), tempDir);
final Collection<Class<? extends Plugin>> plugins;
boolean usNio = random().nextBoolean();
String transportKey;
Class<? extends Plugin> transportPlugin;
if (usNio) {
transportKey = NioTransportPlugin.NIO_TRANSPORT_NAME;
transportPlugin = NioTransportPlugin.class;
} else {
transportKey = MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME;
transportPlugin = MockTcpTransportPlugin.class;
}
String transportKey = MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME;
Class<? extends Plugin> transportPlugin = MockTcpTransportPlugin.class;

if (random().nextBoolean()) {
builder.put(NetworkModule.TRANSPORT_TYPE_KEY, transportKey);
plugins = Collections.singleton(transportPlugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.transport.MockTcpTransportPlugin;
import org.elasticsearch.transport.Netty4Plugin;
import org.elasticsearch.transport.nio.NioTransportPlugin;
import org.junit.BeforeClass;

import java.util.Arrays;
Expand All @@ -47,8 +46,6 @@ public static void setUpTransport() {
private static String getTypeKey(Class<? extends Plugin> clazz) {
if (clazz.equals(MockTcpTransportPlugin.class)) {
return MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME;
} else if (clazz.equals(NioTransportPlugin.class)) {
return NioTransportPlugin.NIO_TRANSPORT_NAME;
} else {
assert clazz.equals(Netty4Plugin.class);
return Netty4Plugin.NETTY_TRANSPORT_NAME;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
import org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.MockTcpTransportPlugin;
import org.elasticsearch.transport.nio.NioTransportPlugin;
import org.joda.time.DateTimeZone;
import org.junit.After;
import org.junit.AfterClass;
Expand All @@ -128,8 +127,8 @@
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.ZoneId;
import java.security.Security;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -991,19 +990,12 @@ public static String randomGeohash(int minPrecision, int maxPrecision) {
return geohashGenerator.ofStringLength(random(), minPrecision, maxPrecision);
}

private static boolean useNio;

@BeforeClass
public static void setUseNio() throws Exception {
useNio = randomBoolean();
}

public static String getTestTransportType() {
return useNio ? NioTransportPlugin.NIO_TRANSPORT_NAME : MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME;
return MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME;
}

public static Class<? extends Plugin> getTestTransportPlugin() {
return useNio ? NioTransportPlugin.class : MockTcpTransportPlugin.class;
return MockTcpTransportPlugin.class;
}

private static final GeohashGenerator geohashGenerator = new GeohashGenerator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.transport.MockTcpTransportPlugin;
import org.elasticsearch.transport.MockTransportClient;
import org.elasticsearch.transport.nio.NioTransportPlugin;

import java.io.IOException;
import java.net.InetSocketAddress;
Expand Down Expand Up @@ -84,12 +83,9 @@ public ExternalTestCluster(Path tempDir, Settings additionalSettings, Collection
if (addMockTcpTransport) {
String transport = getTestTransportType();
clientSettingsBuilder.put(NetworkModule.TRANSPORT_TYPE_KEY, transport);
if (pluginClasses.contains(MockTcpTransportPlugin.class) == false &&
pluginClasses.contains(NioTransportPlugin.class) == false) {
if (pluginClasses.contains(MockTcpTransportPlugin.class) == false) {
pluginClasses = new ArrayList<>(pluginClasses);
if (transport.equals(NioTransportPlugin.NIO_TRANSPORT_NAME)) {
pluginClasses.add(NioTransportPlugin.class);
} else {
if (transport.equals(MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME)) {
pluginClasses.add(MockTcpTransportPlugin.class);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.transport.nio.NioTransportPlugin;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -59,14 +58,6 @@ private static Collection<Class<? extends Plugin>> addMockTransportIfMissing(Set
plugins.add(MockTcpTransportPlugin.class);
return plugins;
}
} else if (NioTransportPlugin.NIO_TRANSPORT_NAME.equals(transportType)) {
if (plugins.contains(NioTransportPlugin.class)) {
return plugins;
} else {
plugins = new ArrayList<>(plugins);
plugins.add(NioTransportPlugin.class);
return plugins;
}
}
return plugins;
}
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2ae0d1b

Please sign in to comment.