randomize transport tcp compression on nodes
This commit is contained in:
parent
0469cca4be
commit
976bdd6a26
|
@ -31,6 +31,10 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public interface Transport extends LifecycleComponent<Transport> {
|
public interface Transport extends LifecycleComponent<Transport> {
|
||||||
|
|
||||||
|
public static class TransportSettings {
|
||||||
|
public static final String TRANSPORT_TCP_COMPRESS = "transport.tcp.compress";
|
||||||
|
}
|
||||||
|
|
||||||
void transportServiceAdapter(TransportServiceAdapter service);
|
void transportServiceAdapter(TransportServiceAdapter service);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -179,7 +179,7 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
||||||
this.port = componentSettings.get("port", settings.get("transport.tcp.port", "9300-9400"));
|
this.port = componentSettings.get("port", settings.get("transport.tcp.port", "9300-9400"));
|
||||||
this.bindHost = componentSettings.get("bind_host", settings.get("transport.bind_host", settings.get("transport.host")));
|
this.bindHost = componentSettings.get("bind_host", settings.get("transport.bind_host", settings.get("transport.host")));
|
||||||
this.publishHost = componentSettings.get("publish_host", settings.get("transport.publish_host", settings.get("transport.host")));
|
this.publishHost = componentSettings.get("publish_host", settings.get("transport.publish_host", settings.get("transport.host")));
|
||||||
this.compress = settings.getAsBoolean("transport.tcp.compress", false);
|
this.compress = settings.getAsBoolean(TransportSettings.TRANSPORT_TCP_COMPRESS, false);
|
||||||
this.connectTimeout = componentSettings.getAsTime("connect_timeout", settings.getAsTime("transport.tcp.connect_timeout", settings.getAsTime(TCP_CONNECT_TIMEOUT, TCP_DEFAULT_CONNECT_TIMEOUT)));
|
this.connectTimeout = componentSettings.getAsTime("connect_timeout", settings.getAsTime("transport.tcp.connect_timeout", settings.getAsTime(TCP_CONNECT_TIMEOUT, TCP_DEFAULT_CONNECT_TIMEOUT)));
|
||||||
this.tcpNoDelay = componentSettings.getAsBoolean("tcp_no_delay", settings.getAsBoolean(TCP_NO_DELAY, true));
|
this.tcpNoDelay = componentSettings.getAsBoolean("tcp_no_delay", settings.getAsBoolean(TCP_NO_DELAY, true));
|
||||||
this.tcpKeepAlive = componentSettings.getAsBoolean("tcp_keep_alive", settings.getAsBoolean(TCP_KEEP_ALIVE, true));
|
this.tcpKeepAlive = componentSettings.getAsBoolean("tcp_keep_alive", settings.getAsBoolean(TCP_KEEP_ALIVE, true));
|
||||||
|
|
|
@ -48,6 +48,7 @@ import org.elasticsearch.node.internal.InternalNode;
|
||||||
import org.elasticsearch.test.engine.MockEngineModule;
|
import org.elasticsearch.test.engine.MockEngineModule;
|
||||||
import org.elasticsearch.test.store.MockFSIndexStoreModule;
|
import org.elasticsearch.test.store.MockFSIndexStoreModule;
|
||||||
import org.elasticsearch.test.transport.AssertingLocalTransportModule;
|
import org.elasticsearch.test.transport.AssertingLocalTransportModule;
|
||||||
|
import org.elasticsearch.transport.Transport;
|
||||||
import org.elasticsearch.transport.TransportModule;
|
import org.elasticsearch.transport.TransportModule;
|
||||||
import org.elasticsearch.transport.TransportService;
|
import org.elasticsearch.transport.TransportService;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -137,6 +138,8 @@ public final class TestCluster implements Iterable<Client> {
|
||||||
.put("gateway.type", "none");
|
.put("gateway.type", "none");
|
||||||
if (isLocalTransportConfigured()) {
|
if (isLocalTransportConfigured()) {
|
||||||
builder.put(TransportModule.TRANSPORT_TYPE_KEY, AssertingLocalTransportModule.class.getName());
|
builder.put(TransportModule.TRANSPORT_TYPE_KEY, AssertingLocalTransportModule.class.getName());
|
||||||
|
} else {
|
||||||
|
builder.put(Transport.TransportSettings.TRANSPORT_TCP_COMPRESS, random.nextInt(10) == 0);
|
||||||
}
|
}
|
||||||
this.defaultSettings = builder.build();
|
this.defaultSettings = builder.build();
|
||||||
this.nodeSettingsSource = nodeSettingsSource;
|
this.nodeSettingsSource = nodeSettingsSource;
|
||||||
|
|
Loading…
Reference in New Issue