Move reminder settings in NettyHttpServerTransport to the new infra

Some bw incompatible setting changes:

http.netty.http.blocking_server -> http.tcp.blocking_server
http.netty.host (removed, we just have http.host)
http.netty.bind_host (removed, we just have http.bind_host)
http.netty.publish_host (removed, we just have http.publish_host)
http.netty.tcp_no_delay -> http.tcp.no_delay
http.netty.tcp_keep_alive -> http.tcp.keep_alive
http.netty.reuse_address -> http.txp.reuse_address
http.netty.tcp_send_buffer_size -> http.tcp.send_buffer_size
http.netty.tcp_receive_buffer_size -> http.tcp.receive_buffer_size

Closes #16531
This commit is contained in:
Boaz Leskes 2016-02-09 12:34:28 +01:00
parent 092d381b69
commit efb4582eb1
4 changed files with 329 additions and 272 deletions

View File

@ -104,7 +104,7 @@ public class NetworkService extends AbstractComponent {
*/ */
public InetAddress[] resolveBindHostAddresses(String bindHosts[]) throws IOException { public InetAddress[] resolveBindHostAddresses(String bindHosts[]) throws IOException {
// first check settings // first check settings
if (bindHosts == null) { if (bindHosts == null || bindHosts.length == 0) {
if (GLOBAL_NETWORK_BINDHOST_SETTING.exists(settings) || GLOBAL_NETWORK_HOST_SETTING.exists(settings)) { if (GLOBAL_NETWORK_BINDHOST_SETTING.exists(settings) || GLOBAL_NETWORK_HOST_SETTING.exists(settings)) {
// if we have settings use them (we have a fallback to GLOBAL_NETWORK_HOST_SETTING inline // if we have settings use them (we have a fallback to GLOBAL_NETWORK_HOST_SETTING inline
bindHosts = GLOBAL_NETWORK_BINDHOST_SETTING.get(settings).toArray(Strings.EMPTY_ARRAY); bindHosts = GLOBAL_NETWORK_BINDHOST_SETTING.get(settings).toArray(Strings.EMPTY_ARRAY);

View File

@ -22,6 +22,7 @@ import org.elasticsearch.action.admin.indices.close.TransportCloseIndexAction;
import org.elasticsearch.action.support.AutoCreateIndex; import org.elasticsearch.action.support.AutoCreateIndex;
import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.action.support.DestructiveOperations;
import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
import org.elasticsearch.bootstrap.BootstrapSettings;
import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.cache.recycler.PageCacheRecycler;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClientNodesService; import org.elasticsearch.client.transport.TransportClientNodesService;
@ -58,6 +59,7 @@ import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.gateway.GatewayService;
import org.elasticsearch.gateway.PrimaryShardAllocator; import org.elasticsearch.gateway.PrimaryShardAllocator;
import org.elasticsearch.http.HttpTransportSettings; import org.elasticsearch.http.HttpTransportSettings;
import org.elasticsearch.http.netty.NettyHttpServerTransport;
import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.store.IndexStoreConfig; import org.elasticsearch.index.store.IndexStoreConfig;
import org.elasticsearch.indices.IndicesService; import org.elasticsearch.indices.IndicesService;
@ -88,7 +90,6 @@ import org.elasticsearch.transport.TransportService;
import org.elasticsearch.transport.TransportSettings; import org.elasticsearch.transport.TransportSettings;
import org.elasticsearch.transport.netty.NettyTransport; import org.elasticsearch.transport.netty.NettyTransport;
import org.elasticsearch.tribe.TribeService; import org.elasticsearch.tribe.TribeService;
import org.elasticsearch.bootstrap.BootstrapSettings;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -141,7 +142,8 @@ public final class ClusterSettings extends AbstractScopedSettings {
String component = key.substring("logger.".length()); String component = key.substring("logger.".length());
if ("_root".equals(component)) { if ("_root".equals(component)) {
final String rootLevel = value.get(key); final String rootLevel = value.get(key);
ESLoggerFactory.getRootLogger().setLevel(rootLevel == null ? ESLoggerFactory.LOG_DEFAULT_LEVEL_SETTING.get(settings).name() : rootLevel); ESLoggerFactory.getRootLogger().setLevel(rootLevel == null ? ESLoggerFactory.LOG_DEFAULT_LEVEL_SETTING.get(settings)
.name() : rootLevel);
} else { } else {
ESLoggerFactory.getLogger(component).setLevel(value.get(key)); ESLoggerFactory.getLogger(component).setLevel(value.get(key));
} }
@ -150,240 +152,253 @@ public final class ClusterSettings extends AbstractScopedSettings {
} }
public static Set<Setting<?>> BUILT_IN_CLUSTER_SETTINGS = Collections.unmodifiableSet(new HashSet<>( public static Set<Setting<?>> BUILT_IN_CLUSTER_SETTINGS = Collections.unmodifiableSet(new HashSet<>(
Arrays.asList(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING, Arrays.asList(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING,
TransportClientNodesService.CLIENT_TRANSPORT_NODES_SAMPLER_INTERVAL, // TODO these transport client settings are kind of odd here and should only be valid if we are a transport client TransportClientNodesService.CLIENT_TRANSPORT_NODES_SAMPLER_INTERVAL, // TODO these transport client settings are kind
TransportClientNodesService.CLIENT_TRANSPORT_PING_TIMEOUT, // of odd here and should only be valid if we are a transport client
TransportClientNodesService.CLIENT_TRANSPORT_IGNORE_CLUSTER_NAME, TransportClientNodesService.CLIENT_TRANSPORT_PING_TIMEOUT,
TransportClientNodesService.CLIENT_TRANSPORT_SNIFF, TransportClientNodesService.CLIENT_TRANSPORT_IGNORE_CLUSTER_NAME,
AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP_SETTING, TransportClientNodesService.CLIENT_TRANSPORT_SNIFF,
BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING, AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP_SETTING,
BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING, BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING,
BalancedShardsAllocator.THRESHOLD_SETTING, BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING,
ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING, BalancedShardsAllocator.THRESHOLD_SETTING,
ConcurrentRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE_SETTING, ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING,
EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING, ConcurrentRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE_SETTING,
EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING, EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING,
FilterAllocationDecider.CLUSTER_ROUTING_INCLUDE_GROUP_SETTING, EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING,
FilterAllocationDecider.CLUSTER_ROUTING_EXCLUDE_GROUP_SETTING, FilterAllocationDecider.CLUSTER_ROUTING_INCLUDE_GROUP_SETTING,
FilterAllocationDecider.CLUSTER_ROUTING_REQUIRE_GROUP_SETTING, FilterAllocationDecider.CLUSTER_ROUTING_EXCLUDE_GROUP_SETTING,
FsRepository.REPOSITORIES_CHUNK_SIZE_SETTING, FilterAllocationDecider.CLUSTER_ROUTING_REQUIRE_GROUP_SETTING,
FsRepository.REPOSITORIES_COMPRESS_SETTING, FsRepository.REPOSITORIES_CHUNK_SIZE_SETTING,
FsRepository.REPOSITORIES_LOCATION_SETTING, FsRepository.REPOSITORIES_COMPRESS_SETTING,
IndexStoreConfig.INDICES_STORE_THROTTLE_TYPE_SETTING, FsRepository.REPOSITORIES_LOCATION_SETTING,
IndexStoreConfig.INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC_SETTING, IndexStoreConfig.INDICES_STORE_THROTTLE_TYPE_SETTING,
IndicesQueryCache.INDICES_CACHE_QUERY_SIZE_SETTING, IndexStoreConfig.INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC_SETTING,
IndicesQueryCache.INDICES_CACHE_QUERY_COUNT_SETTING, IndicesQueryCache.INDICES_CACHE_QUERY_SIZE_SETTING,
IndicesTTLService.INDICES_TTL_INTERVAL_SETTING, IndicesQueryCache.INDICES_CACHE_QUERY_COUNT_SETTING,
MappingUpdatedAction.INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING, IndicesTTLService.INDICES_TTL_INTERVAL_SETTING,
MetaData.SETTING_READ_ONLY_SETTING, MappingUpdatedAction.INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING,
RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING, MetaData.SETTING_READ_ONLY_SETTING,
RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_STATE_SYNC_SETTING, RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING,
RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_NETWORK_SETTING, RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_STATE_SYNC_SETTING,
RecoverySettings.INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING, RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_NETWORK_SETTING,
RecoverySettings.INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT_SETTING, RecoverySettings.INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING,
RecoverySettings.INDICES_RECOVERY_INTERNAL_LONG_ACTION_TIMEOUT_SETTING, RecoverySettings.INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT_SETTING,
ThreadPool.THREADPOOL_GROUP_SETTING, RecoverySettings.INDICES_RECOVERY_INTERNAL_LONG_ACTION_TIMEOUT_SETTING,
ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING, ThreadPool.THREADPOOL_GROUP_SETTING,
ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING, ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING,
ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING, ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING,
ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING, ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING,
DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING, ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING,
DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING, DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING,
DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING, DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING,
DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING, DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING,
DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING, DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING,
InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING, DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING,
InternalClusterInfoService.INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING, InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING,
SnapshotInProgressAllocationDecider.CLUSTER_ROUTING_ALLOCATION_SNAPSHOT_RELOCATION_ENABLED_SETTING, InternalClusterInfoService.INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING,
DestructiveOperations.REQUIRES_NAME_SETTING, SnapshotInProgressAllocationDecider.CLUSTER_ROUTING_ALLOCATION_SNAPSHOT_RELOCATION_ENABLED_SETTING,
DiscoverySettings.PUBLISH_TIMEOUT_SETTING, DestructiveOperations.REQUIRES_NAME_SETTING,
DiscoverySettings.PUBLISH_DIFF_ENABLE_SETTING, DiscoverySettings.PUBLISH_TIMEOUT_SETTING,
DiscoverySettings.COMMIT_TIMEOUT_SETTING, DiscoverySettings.PUBLISH_DIFF_ENABLE_SETTING,
DiscoverySettings.NO_MASTER_BLOCK_SETTING, DiscoverySettings.COMMIT_TIMEOUT_SETTING,
GatewayService.EXPECTED_DATA_NODES_SETTING, DiscoverySettings.NO_MASTER_BLOCK_SETTING,
GatewayService.EXPECTED_MASTER_NODES_SETTING, GatewayService.EXPECTED_DATA_NODES_SETTING,
GatewayService.EXPECTED_NODES_SETTING, GatewayService.EXPECTED_MASTER_NODES_SETTING,
GatewayService.RECOVER_AFTER_DATA_NODES_SETTING, GatewayService.EXPECTED_NODES_SETTING,
GatewayService.RECOVER_AFTER_MASTER_NODES_SETTING, GatewayService.RECOVER_AFTER_DATA_NODES_SETTING,
GatewayService.RECOVER_AFTER_NODES_SETTING, GatewayService.RECOVER_AFTER_MASTER_NODES_SETTING,
GatewayService.RECOVER_AFTER_TIME_SETTING, GatewayService.RECOVER_AFTER_NODES_SETTING,
NetworkModule.HTTP_ENABLED, GatewayService.RECOVER_AFTER_TIME_SETTING,
NetworkModule.HTTP_TYPE_SETTING, NetworkModule.HTTP_ENABLED,
NetworkModule.TRANSPORT_SERVICE_TYPE_SETTING, NetworkModule.HTTP_TYPE_SETTING,
NetworkModule.TRANSPORT_TYPE_SETTING, NetworkModule.TRANSPORT_SERVICE_TYPE_SETTING,
HttpTransportSettings.SETTING_CORS_ALLOW_CREDENTIALS, NetworkModule.TRANSPORT_TYPE_SETTING,
HttpTransportSettings.SETTING_CORS_ENABLED, HttpTransportSettings.SETTING_CORS_ALLOW_CREDENTIALS,
HttpTransportSettings.SETTING_CORS_MAX_AGE, HttpTransportSettings.SETTING_CORS_ENABLED,
HttpTransportSettings.SETTING_HTTP_DETAILED_ERRORS_ENABLED, HttpTransportSettings.SETTING_CORS_MAX_AGE,
HttpTransportSettings.SETTING_PIPELINING, HttpTransportSettings.SETTING_HTTP_DETAILED_ERRORS_ENABLED,
HttpTransportSettings.SETTING_CORS_ALLOW_ORIGIN, HttpTransportSettings.SETTING_PIPELINING,
HttpTransportSettings.SETTING_HTTP_PORT, HttpTransportSettings.SETTING_CORS_ALLOW_ORIGIN,
HttpTransportSettings.SETTING_HTTP_PUBLISH_PORT, HttpTransportSettings.SETTING_HTTP_PORT,
HttpTransportSettings.SETTING_PIPELINING_MAX_EVENTS, HttpTransportSettings.SETTING_HTTP_PUBLISH_PORT,
HttpTransportSettings.SETTING_HTTP_COMPRESSION, HttpTransportSettings.SETTING_PIPELINING_MAX_EVENTS,
HttpTransportSettings.SETTING_HTTP_COMPRESSION_LEVEL, HttpTransportSettings.SETTING_HTTP_COMPRESSION,
HttpTransportSettings.SETTING_CORS_ALLOW_METHODS, HttpTransportSettings.SETTING_HTTP_COMPRESSION_LEVEL,
HttpTransportSettings.SETTING_CORS_ALLOW_HEADERS, HttpTransportSettings.SETTING_CORS_ALLOW_METHODS,
HttpTransportSettings.SETTING_HTTP_DETAILED_ERRORS_ENABLED, HttpTransportSettings.SETTING_CORS_ALLOW_HEADERS,
HttpTransportSettings.SETTING_HTTP_MAX_CONTENT_LENGTH, HttpTransportSettings.SETTING_HTTP_DETAILED_ERRORS_ENABLED,
HttpTransportSettings.SETTING_HTTP_MAX_CHUNK_SIZE, HttpTransportSettings.SETTING_HTTP_MAX_CONTENT_LENGTH,
HttpTransportSettings.SETTING_HTTP_MAX_HEADER_SIZE, HttpTransportSettings.SETTING_HTTP_MAX_CHUNK_SIZE,
HttpTransportSettings.SETTING_HTTP_MAX_INITIAL_LINE_LENGTH, HttpTransportSettings.SETTING_HTTP_MAX_HEADER_SIZE,
HttpTransportSettings.SETTING_HTTP_RESET_COOKIES, HttpTransportSettings.SETTING_HTTP_MAX_INITIAL_LINE_LENGTH,
HierarchyCircuitBreakerService.TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING, HttpTransportSettings.SETTING_HTTP_RESET_COOKIES,
HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING, NettyHttpServerTransport.SETTING_HTTP_NETTY_MAX_CUMULATION_BUFFER_CAPACITY,
HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING, NettyHttpServerTransport.SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS,
HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, NettyHttpServerTransport.SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE,
HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_OVERHEAD_SETTING, NettyHttpServerTransport.SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MIN,
InternalClusterService.CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING, NettyHttpServerTransport.SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MAX,
SearchService.DEFAULT_SEARCH_TIMEOUT_SETTING, NettyHttpServerTransport.SETTING_HTTP_WORKER_COUNT,
ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING, NettyHttpServerTransport.SETTING_HTTP_TCP_NO_DELAY,
TransportService.TRACE_LOG_EXCLUDE_SETTING, NettyHttpServerTransport.SETTING_HTTP_TCP_KEEP_ALIVE,
TransportService.TRACE_LOG_INCLUDE_SETTING, NettyHttpServerTransport.SETTING_HTTP_TCP_BLOCKING_SERVER,
TransportCloseIndexAction.CLUSTER_INDICES_CLOSE_ENABLE_SETTING, NettyHttpServerTransport.SETTING_HTTP_TCP_REUSE_ADDRESS,
ShardsLimitAllocationDecider.CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING, NettyHttpServerTransport.SETTING_HTTP_TCP_SEND_BUFFER_SIZE,
InternalClusterService.CLUSTER_SERVICE_RECONNECT_INTERVAL_SETTING, NettyHttpServerTransport.SETTING_HTTP_TCP_RECEIVE_BUFFER_SIZE,
HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_TYPE_SETTING, HierarchyCircuitBreakerService.TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING,
HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_TYPE_SETTING, HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING,
Transport.TRANSPORT_TCP_COMPRESS, HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING,
TransportSettings.TRANSPORT_PROFILES_SETTING, HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING,
TransportSettings.HOST, HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_OVERHEAD_SETTING,
TransportSettings.PUBLISH_HOST, InternalClusterService.CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING,
TransportSettings.BIND_HOST, SearchService.DEFAULT_SEARCH_TIMEOUT_SETTING,
TransportSettings.PUBLISH_PORT, ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING,
TransportSettings.PORT, TransportService.TRACE_LOG_EXCLUDE_SETTING,
NettyTransport.WORKER_COUNT, TransportService.TRACE_LOG_INCLUDE_SETTING,
NettyTransport.CONNECTIONS_PER_NODE_RECOVERY, TransportCloseIndexAction.CLUSTER_INDICES_CLOSE_ENABLE_SETTING,
NettyTransport.CONNECTIONS_PER_NODE_BULK, ShardsLimitAllocationDecider.CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING,
NettyTransport.CONNECTIONS_PER_NODE_REG, InternalClusterService.CLUSTER_SERVICE_RECONNECT_INTERVAL_SETTING,
NettyTransport.CONNECTIONS_PER_NODE_STATE, HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_TYPE_SETTING,
NettyTransport.CONNECTIONS_PER_NODE_PING, HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_TYPE_SETTING,
NettyTransport.PING_SCHEDULE, Transport.TRANSPORT_TCP_COMPRESS,
NettyTransport.TCP_BLOCKING_CLIENT, TransportSettings.TRANSPORT_PROFILES_SETTING,
NettyTransport.TCP_CONNECT_TIMEOUT, TransportSettings.HOST,
NettyTransport.NETTY_MAX_CUMULATION_BUFFER_CAPACITY, TransportSettings.PUBLISH_HOST,
NettyTransport.NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS, TransportSettings.BIND_HOST,
NettyTransport.NETTY_RECEIVE_PREDICTOR_SIZE, TransportSettings.PUBLISH_PORT,
NettyTransport.NETTY_RECEIVE_PREDICTOR_MIN, TransportSettings.PORT,
NettyTransport.NETTY_RECEIVE_PREDICTOR_MAX, NettyTransport.WORKER_COUNT,
NetworkService.NETWORK_SERVER, NettyTransport.CONNECTIONS_PER_NODE_RECOVERY,
NettyTransport.NETTY_BOSS_COUNT, NettyTransport.CONNECTIONS_PER_NODE_BULK,
NettyTransport.TCP_NO_DELAY, NettyTransport.CONNECTIONS_PER_NODE_REG,
NettyTransport.TCP_KEEP_ALIVE, NettyTransport.CONNECTIONS_PER_NODE_STATE,
NettyTransport.TCP_REUSE_ADDRESS, NettyTransport.CONNECTIONS_PER_NODE_PING,
NettyTransport.TCP_SEND_BUFFER_SIZE, NettyTransport.PING_SCHEDULE,
NettyTransport.TCP_RECEIVE_BUFFER_SIZE, NettyTransport.TCP_BLOCKING_CLIENT,
NettyTransport.TCP_BLOCKING_SERVER, NettyTransport.TCP_CONNECT_TIMEOUT,
NetworkService.GLOBAL_NETWORK_HOST_SETTING, NettyTransport.NETTY_MAX_CUMULATION_BUFFER_CAPACITY,
NetworkService.GLOBAL_NETWORK_BINDHOST_SETTING, NettyTransport.NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS,
NetworkService.GLOBAL_NETWORK_PUBLISHHOST_SETTING, NettyTransport.NETTY_RECEIVE_PREDICTOR_SIZE,
NetworkService.TcpSettings.TCP_NO_DELAY, NettyTransport.NETTY_RECEIVE_PREDICTOR_MIN,
NetworkService.TcpSettings.TCP_KEEP_ALIVE, NettyTransport.NETTY_RECEIVE_PREDICTOR_MAX,
NetworkService.TcpSettings.TCP_REUSE_ADDRESS, NetworkService.NETWORK_SERVER,
NetworkService.TcpSettings.TCP_SEND_BUFFER_SIZE, NettyTransport.NETTY_BOSS_COUNT,
NetworkService.TcpSettings.TCP_RECEIVE_BUFFER_SIZE, NettyTransport.TCP_NO_DELAY,
NetworkService.TcpSettings.TCP_BLOCKING, NettyTransport.TCP_KEEP_ALIVE,
NetworkService.TcpSettings.TCP_BLOCKING_SERVER, NettyTransport.TCP_REUSE_ADDRESS,
NetworkService.TcpSettings.TCP_BLOCKING_CLIENT, NettyTransport.TCP_SEND_BUFFER_SIZE,
NetworkService.TcpSettings.TCP_CONNECT_TIMEOUT, NettyTransport.TCP_RECEIVE_BUFFER_SIZE,
IndexSettings.QUERY_STRING_ANALYZE_WILDCARD, NettyTransport.TCP_BLOCKING_SERVER,
IndexSettings.QUERY_STRING_ALLOW_LEADING_WILDCARD, NetworkService.GLOBAL_NETWORK_HOST_SETTING,
PrimaryShardAllocator.NODE_INITIAL_SHARDS_SETTING, NetworkService.GLOBAL_NETWORK_BINDHOST_SETTING,
ScriptService.SCRIPT_CACHE_SIZE_SETTING, NetworkService.GLOBAL_NETWORK_PUBLISHHOST_SETTING,
ScriptService.SCRIPT_CACHE_EXPIRE_SETTING, NetworkService.TcpSettings.TCP_NO_DELAY,
ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING, NetworkService.TcpSettings.TCP_KEEP_ALIVE,
IndicesService.INDICES_FIELDDATA_CLEAN_INTERVAL_SETTING, NetworkService.TcpSettings.TCP_REUSE_ADDRESS,
IndicesFieldDataCache.INDICES_FIELDDATA_CACHE_SIZE_KEY, NetworkService.TcpSettings.TCP_SEND_BUFFER_SIZE,
IndicesRequestCache.INDICES_CACHE_QUERY_SIZE, NetworkService.TcpSettings.TCP_RECEIVE_BUFFER_SIZE,
IndicesRequestCache.INDICES_CACHE_QUERY_EXPIRE, NetworkService.TcpSettings.TCP_BLOCKING,
IndicesRequestCache.INDICES_CACHE_REQUEST_CLEAN_INTERVAL, NetworkService.TcpSettings.TCP_BLOCKING_SERVER,
HunspellService.HUNSPELL_LAZY_LOAD, NetworkService.TcpSettings.TCP_BLOCKING_CLIENT,
HunspellService.HUNSPELL_IGNORE_CASE, NetworkService.TcpSettings.TCP_CONNECT_TIMEOUT,
HunspellService.HUNSPELL_DICTIONARY_OPTIONS, IndexSettings.QUERY_STRING_ANALYZE_WILDCARD,
IndicesStore.INDICES_STORE_DELETE_SHARD_TIMEOUT, IndexSettings.QUERY_STRING_ALLOW_LEADING_WILDCARD,
Environment.PATH_CONF_SETTING, PrimaryShardAllocator.NODE_INITIAL_SHARDS_SETTING,
Environment.PATH_DATA_SETTING, ScriptService.SCRIPT_CACHE_SIZE_SETTING,
Environment.PATH_HOME_SETTING, ScriptService.SCRIPT_CACHE_EXPIRE_SETTING,
Environment.PATH_LOGS_SETTING, ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING,
Environment.PATH_PLUGINS_SETTING, IndicesService.INDICES_FIELDDATA_CLEAN_INTERVAL_SETTING,
Environment.PATH_REPO_SETTING, IndicesFieldDataCache.INDICES_FIELDDATA_CACHE_SIZE_KEY,
Environment.PATH_SCRIPTS_SETTING, IndicesRequestCache.INDICES_CACHE_QUERY_SIZE,
Environment.PATH_SHARED_DATA_SETTING, IndicesRequestCache.INDICES_CACHE_QUERY_EXPIRE,
Environment.PIDFILE_SETTING, IndicesRequestCache.INDICES_CACHE_REQUEST_CLEAN_INTERVAL,
DiscoveryService.DISCOVERY_SEED_SETTING, HunspellService.HUNSPELL_LAZY_LOAD,
DiscoveryService.INITIAL_STATE_TIMEOUT_SETTING, HunspellService.HUNSPELL_IGNORE_CASE,
DiscoveryModule.DISCOVERY_TYPE_SETTING, HunspellService.HUNSPELL_DICTIONARY_OPTIONS,
DiscoveryModule.ZEN_MASTER_SERVICE_TYPE_SETTING, IndicesStore.INDICES_STORE_DELETE_SHARD_TIMEOUT,
FaultDetection.PING_RETRIES_SETTING, Environment.PATH_CONF_SETTING,
FaultDetection.PING_TIMEOUT_SETTING, Environment.PATH_DATA_SETTING,
FaultDetection.REGISTER_CONNECTION_LISTENER_SETTING, Environment.PATH_HOME_SETTING,
FaultDetection.PING_INTERVAL_SETTING, Environment.PATH_LOGS_SETTING,
FaultDetection.CONNECT_ON_NETWORK_DISCONNECT_SETTING, Environment.PATH_PLUGINS_SETTING,
ZenDiscovery.PING_TIMEOUT_SETTING, Environment.PATH_REPO_SETTING,
ZenDiscovery.JOIN_TIMEOUT_SETTING, Environment.PATH_SCRIPTS_SETTING,
ZenDiscovery.JOIN_RETRY_ATTEMPTS_SETTING, Environment.PATH_SHARED_DATA_SETTING,
ZenDiscovery.JOIN_RETRY_DELAY_SETTING, Environment.PIDFILE_SETTING,
ZenDiscovery.MAX_PINGS_FROM_ANOTHER_MASTER_SETTING, DiscoveryService.DISCOVERY_SEED_SETTING,
ZenDiscovery.SEND_LEAVE_REQUEST_SETTING, DiscoveryService.INITIAL_STATE_TIMEOUT_SETTING,
ZenDiscovery.MASTER_ELECTION_FILTER_CLIENT_SETTING, DiscoveryModule.DISCOVERY_TYPE_SETTING,
ZenDiscovery.MASTER_ELECTION_WAIT_FOR_JOINS_TIMEOUT_SETTING, DiscoveryModule.ZEN_MASTER_SERVICE_TYPE_SETTING,
ZenDiscovery.MASTER_ELECTION_FILTER_DATA_SETTING, FaultDetection.PING_RETRIES_SETTING,
UnicastZenPing.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING, FaultDetection.PING_TIMEOUT_SETTING,
UnicastZenPing.DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING, FaultDetection.REGISTER_CONNECTION_LISTENER_SETTING,
SearchService.DEFAULT_KEEPALIVE_SETTING, FaultDetection.PING_INTERVAL_SETTING,
SearchService.KEEPALIVE_INTERVAL_SETTING, FaultDetection.CONNECT_ON_NETWORK_DISCONNECT_SETTING,
Node.WRITE_PORTS_FIELD_SETTING, ZenDiscovery.PING_TIMEOUT_SETTING,
Node.NODE_NAME_SETTING, ZenDiscovery.JOIN_TIMEOUT_SETTING,
Node.NODE_CLIENT_SETTING, ZenDiscovery.JOIN_RETRY_ATTEMPTS_SETTING,
Node.NODE_DATA_SETTING, ZenDiscovery.JOIN_RETRY_DELAY_SETTING,
Node.NODE_MASTER_SETTING, ZenDiscovery.MAX_PINGS_FROM_ANOTHER_MASTER_SETTING,
Node.NODE_LOCAL_SETTING, ZenDiscovery.SEND_LEAVE_REQUEST_SETTING,
Node.NODE_MODE_SETTING, ZenDiscovery.MASTER_ELECTION_FILTER_CLIENT_SETTING,
Node.NODE_INGEST_SETTING, ZenDiscovery.MASTER_ELECTION_WAIT_FOR_JOINS_TIMEOUT_SETTING,
Node.NODE_ATTRIBUTES, ZenDiscovery.MASTER_ELECTION_FILTER_DATA_SETTING,
URLRepository.ALLOWED_URLS_SETTING, UnicastZenPing.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING,
URLRepository.REPOSITORIES_LIST_DIRECTORIES_SETTING, UnicastZenPing.DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING,
URLRepository.REPOSITORIES_URL_SETTING, SearchService.DEFAULT_KEEPALIVE_SETTING,
URLRepository.SUPPORTED_PROTOCOLS_SETTING, SearchService.KEEPALIVE_INTERVAL_SETTING,
TransportMasterNodeReadAction.FORCE_LOCAL_SETTING, Node.WRITE_PORTS_FIELD_SETTING,
AutoCreateIndex.AUTO_CREATE_INDEX_SETTING, Node.NODE_NAME_SETTING,
BaseRestHandler.MULTI_ALLOW_EXPLICIT_INDEX, Node.NODE_CLIENT_SETTING,
ClusterName.CLUSTER_NAME_SETTING, Node.NODE_DATA_SETTING,
Client.CLIENT_TYPE_SETTING_S, Node.NODE_MASTER_SETTING,
InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING, Node.NODE_LOCAL_SETTING,
ClusterModule.SHARDS_ALLOCATOR_TYPE_SETTING, Node.NODE_MODE_SETTING,
EsExecutors.PROCESSORS_SETTING, Node.NODE_INGEST_SETTING,
ThreadContext.DEFAULT_HEADERS_SETTING, Node.NODE_ATTRIBUTES,
ESLoggerFactory.LOG_DEFAULT_LEVEL_SETTING, URLRepository.ALLOWED_URLS_SETTING,
ESLoggerFactory.LOG_LEVEL_SETTING, URLRepository.REPOSITORIES_LIST_DIRECTORIES_SETTING,
TribeService.BLOCKS_METADATA_SETTING, URLRepository.REPOSITORIES_URL_SETTING,
TribeService.BLOCKS_WRITE_SETTING, URLRepository.SUPPORTED_PROTOCOLS_SETTING,
TribeService.BLOCKS_WRITE_INDICES_SETTING, TransportMasterNodeReadAction.FORCE_LOCAL_SETTING,
TribeService.BLOCKS_READ_INDICES_SETTING, AutoCreateIndex.AUTO_CREATE_INDEX_SETTING,
TribeService.BLOCKS_METADATA_INDICES_SETTING, BaseRestHandler.MULTI_ALLOW_EXPLICIT_INDEX,
TribeService.ON_CONFLICT_SETTING, ClusterName.CLUSTER_NAME_SETTING,
TribeService.TRIBE_NAME_SETTING, Client.CLIENT_TYPE_SETTING_S,
NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING, InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING,
NodeEnvironment.ENABLE_LUCENE_SEGMENT_INFOS_TRACE_SETTING, ClusterModule.SHARDS_ALLOCATOR_TYPE_SETTING,
NodeEnvironment.ADD_NODE_ID_TO_CUSTOM_PATH, EsExecutors.PROCESSORS_SETTING,
OsService.REFRESH_INTERVAL_SETTING, ThreadContext.DEFAULT_HEADERS_SETTING,
ProcessService.REFRESH_INTERVAL_SETTING, ESLoggerFactory.LOG_DEFAULT_LEVEL_SETTING,
JvmService.REFRESH_INTERVAL_SETTING, ESLoggerFactory.LOG_LEVEL_SETTING,
FsService.REFRESH_INTERVAL_SETTING, TribeService.BLOCKS_METADATA_SETTING,
JvmGcMonitorService.ENABLED_SETTING, TribeService.BLOCKS_WRITE_SETTING,
JvmGcMonitorService.REFRESH_INTERVAL_SETTING, TribeService.BLOCKS_WRITE_INDICES_SETTING,
JvmGcMonitorService.GC_SETTING, TribeService.BLOCKS_READ_INDICES_SETTING,
PageCacheRecycler.LIMIT_HEAP_SETTING, TribeService.BLOCKS_METADATA_INDICES_SETTING,
PageCacheRecycler.WEIGHT_BYTES_SETTING, TribeService.ON_CONFLICT_SETTING,
PageCacheRecycler.WEIGHT_INT_SETTING, TribeService.TRIBE_NAME_SETTING,
PageCacheRecycler.WEIGHT_LONG_SETTING, NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING,
PageCacheRecycler.WEIGHT_OBJECTS_SETTING, NodeEnvironment.ENABLE_LUCENE_SEGMENT_INFOS_TRACE_SETTING,
PageCacheRecycler.TYPE_SETTING, NodeEnvironment.ADD_NODE_ID_TO_CUSTOM_PATH,
PluginsService.MANDATORY_SETTING, OsService.REFRESH_INTERVAL_SETTING,
BootstrapSettings.SECURITY_MANAGER_ENABLED_SETTING, ProcessService.REFRESH_INTERVAL_SETTING,
BootstrapSettings.SECURITY_FILTER_BAD_DEFAULTS_SETTING, JvmService.REFRESH_INTERVAL_SETTING,
BootstrapSettings.MLOCKALL_SETTING, FsService.REFRESH_INTERVAL_SETTING,
BootstrapSettings.SECCOMP_SETTING, JvmGcMonitorService.ENABLED_SETTING,
BootstrapSettings.CTRLHANDLER_SETTING JvmGcMonitorService.REFRESH_INTERVAL_SETTING,
))); JvmGcMonitorService.GC_SETTING,
PageCacheRecycler.LIMIT_HEAP_SETTING,
PageCacheRecycler.WEIGHT_BYTES_SETTING,
PageCacheRecycler.WEIGHT_INT_SETTING,
PageCacheRecycler.WEIGHT_LONG_SETTING,
PageCacheRecycler.WEIGHT_OBJECTS_SETTING,
PageCacheRecycler.TYPE_SETTING,
PluginsService.MANDATORY_SETTING,
BootstrapSettings.SECURITY_MANAGER_ENABLED_SETTING,
BootstrapSettings.SECURITY_FILTER_BAD_DEFAULTS_SETTING,
BootstrapSettings.MLOCKALL_SETTING,
BootstrapSettings.SECCOMP_SETTING,
BootstrapSettings.CTRLHANDLER_SETTING
)));
} }

View File

@ -25,6 +25,11 @@ import org.elasticsearch.common.transport.PortsRange;
import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.ByteSizeValue;
import java.util.List;
import static java.util.Collections.emptyList;
import static org.elasticsearch.common.settings.Setting.listSetting;
public final class HttpTransportSettings { public final class HttpTransportSettings {
public static final Setting<Boolean> SETTING_CORS_ENABLED = Setting.boolSetting("http.cors.enabled", false, false, Scope.CLUSTER); public static final Setting<Boolean> SETTING_CORS_ENABLED = Setting.boolSetting("http.cors.enabled", false, false, Scope.CLUSTER);
@ -37,6 +42,10 @@ public final class HttpTransportSettings {
public static final Setting<Integer> SETTING_PIPELINING_MAX_EVENTS = Setting.intSetting("http.pipelining.max_events", 10000, false, Scope.CLUSTER); public static final Setting<Integer> SETTING_PIPELINING_MAX_EVENTS = Setting.intSetting("http.pipelining.max_events", 10000, false, Scope.CLUSTER);
public static final Setting<Boolean> SETTING_HTTP_COMPRESSION = Setting.boolSetting("http.compression", false, false, Scope.CLUSTER); public static final Setting<Boolean> SETTING_HTTP_COMPRESSION = Setting.boolSetting("http.compression", false, false, Scope.CLUSTER);
public static final Setting<Integer> SETTING_HTTP_COMPRESSION_LEVEL = Setting.intSetting("http.compression_level", 6, false, Scope.CLUSTER); public static final Setting<Integer> SETTING_HTTP_COMPRESSION_LEVEL = Setting.intSetting("http.compression_level", 6, false, Scope.CLUSTER);
public static final Setting<List<String>> SETTING_HTTP_HOST = listSetting("http.host", emptyList(), s -> s, false, Scope.CLUSTER);
public static final Setting<List<String>> SETTING_HTTP_PUBLISH_HOST = listSetting("http.publish_host", SETTING_HTTP_HOST, s -> s, false, Scope.CLUSTER);
public static final Setting<List<String>> SETTING_HTTP_BIND_HOST = listSetting("http.bind_host", SETTING_HTTP_HOST, s -> s, false, Scope.CLUSTER);
public static final Setting<PortsRange> SETTING_HTTP_PORT = new Setting<PortsRange>("http.port", "9200-9300", PortsRange::new, false, Scope.CLUSTER); public static final Setting<PortsRange> SETTING_HTTP_PORT = new Setting<PortsRange>("http.port", "9200-9300", PortsRange::new, false, Scope.CLUSTER);
public static final Setting<Integer> SETTING_HTTP_PUBLISH_PORT = Setting.intSetting("http.publish_port", 0, 0, false, Scope.CLUSTER); public static final Setting<Integer> SETTING_HTTP_PUBLISH_PORT = Setting.intSetting("http.publish_port", 0, 0, false, Scope.CLUSTER);
public static final Setting<Boolean> SETTING_HTTP_DETAILED_ERRORS_ENABLED = Setting.boolSetting("http.detailed_errors.enabled", true, false, Scope.CLUSTER); public static final Setting<Boolean> SETTING_HTTP_DETAILED_ERRORS_ENABLED = Setting.boolSetting("http.detailed_errors.enabled", true, false, Scope.CLUSTER);

View File

@ -20,13 +20,13 @@
package org.elasticsearch.http.netty; package org.elasticsearch.http.netty;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.netty.NettyUtils; import org.elasticsearch.common.netty.NettyUtils;
import org.elasticsearch.common.netty.OpenChannelsHandler; import org.elasticsearch.common.netty.OpenChannelsHandler;
import org.elasticsearch.common.network.NetworkAddress; import org.elasticsearch.common.network.NetworkAddress;
import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.network.NetworkService;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.BoundTransportAddress; import org.elasticsearch.common.transport.BoundTransportAddress;
import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.InetSocketTransportAddress;
@ -50,8 +50,8 @@ import org.elasticsearch.http.netty.cors.CorsConfigBuilder;
import org.elasticsearch.http.netty.cors.CorsHandler; import org.elasticsearch.http.netty.cors.CorsHandler;
import org.elasticsearch.http.netty.pipelining.HttpPipeliningHandler; import org.elasticsearch.http.netty.pipelining.HttpPipeliningHandler;
import org.elasticsearch.monitor.jvm.JvmInfo; import org.elasticsearch.monitor.jvm.JvmInfo;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.rest.support.RestUtils; import org.elasticsearch.rest.support.RestUtils;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.BindTransportException; import org.elasticsearch.transport.BindTransportException;
import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.AdaptiveReceiveBufferSizePredictorFactory; import org.jboss.netty.channel.AdaptiveReceiveBufferSizePredictorFactory;
@ -81,19 +81,16 @@ import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static org.elasticsearch.common.settings.Setting.boolSetting;
import static org.elasticsearch.common.settings.Setting.byteSizeSetting;
import static org.elasticsearch.common.util.concurrent.EsExecutors.daemonThreadFactory; import static org.elasticsearch.common.util.concurrent.EsExecutors.daemonThreadFactory;
import static org.elasticsearch.common.network.NetworkService.TcpSettings.TCP_BLOCKING;
import static org.elasticsearch.common.network.NetworkService.TcpSettings.TCP_KEEP_ALIVE;
import static org.elasticsearch.common.network.NetworkService.TcpSettings.TCP_NO_DELAY;
import static org.elasticsearch.common.network.NetworkService.TcpSettings.TCP_RECEIVE_BUFFER_SIZE;
import static org.elasticsearch.common.network.NetworkService.TcpSettings.TCP_REUSE_ADDRESS;
import static org.elasticsearch.common.network.NetworkService.TcpSettings.TCP_SEND_BUFFER_SIZE;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ALLOW_CREDENTIALS; import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ALLOW_CREDENTIALS;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ALLOW_HEADERS; import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ALLOW_HEADERS;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ALLOW_METHODS; import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ALLOW_METHODS;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ALLOW_ORIGIN; import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ALLOW_ORIGIN;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ENABLED; import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ENABLED;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_MAX_AGE; import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_MAX_AGE;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_BIND_HOST;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION; import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION_LEVEL; import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION_LEVEL;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_DETAILED_ERRORS_ENABLED; import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_DETAILED_ERRORS_ENABLED;
@ -102,6 +99,7 @@ import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_MAX_CONT
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_MAX_HEADER_SIZE; import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_MAX_HEADER_SIZE;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_MAX_INITIAL_LINE_LENGTH; import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_MAX_INITIAL_LINE_LENGTH;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_PORT; import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_PORT;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_PUBLISH_HOST;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_PUBLISH_PORT; import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_PUBLISH_PORT;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_RESET_COOKIES; import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_RESET_COOKIES;
import static org.elasticsearch.http.HttpTransportSettings.SETTING_PIPELINING; import static org.elasticsearch.http.HttpTransportSettings.SETTING_PIPELINING;
@ -117,6 +115,52 @@ public class NettyHttpServerTransport extends AbstractLifecycleComponent<HttpSer
NettyUtils.setup(); NettyUtils.setup();
} }
public static Setting<ByteSizeValue> SETTING_HTTP_NETTY_MAX_CUMULATION_BUFFER_CAPACITY =
Setting.byteSizeSetting("http.netty.max_cumulation_buffer_capacity", new ByteSizeValue(-1), false, Setting.Scope.CLUSTER);
public static Setting<Integer> SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS =
Setting.intSetting("http.netty.max_composite_buffer_components", -1, false, Setting.Scope.CLUSTER);
public static final Setting<Integer> SETTING_HTTP_WORKER_COUNT = new Setting<>("http.netty.worker_count",
(s) -> Integer.toString(EsExecutors.boundedNumberOfProcessors(s) * 2),
(s) -> Setting.parseInt(s, 1, "http.netty.worker_count"), false, Setting.Scope.CLUSTER);
public static final Setting<Boolean> SETTING_HTTP_TCP_NO_DELAY = boolSetting("http.tcp_no_delay", NetworkService.TcpSettings
.TCP_NO_DELAY, false,
Setting.Scope.CLUSTER);
public static final Setting<Boolean> SETTING_HTTP_TCP_KEEP_ALIVE = boolSetting("http.tcp.keep_alive", NetworkService.TcpSettings
.TCP_KEEP_ALIVE, false,
Setting.Scope.CLUSTER);
public static final Setting<Boolean> SETTING_HTTP_TCP_BLOCKING_SERVER = boolSetting("http.tcp.blocking_server", NetworkService
.TcpSettings.TCP_BLOCKING_SERVER,
false, Setting.Scope.CLUSTER);
public static final Setting<Boolean> SETTING_HTTP_TCP_REUSE_ADDRESS = boolSetting("http.tcp.reuse_address", NetworkService
.TcpSettings.TCP_REUSE_ADDRESS,
false, Setting.Scope.CLUSTER);
public static final Setting<ByteSizeValue> SETTING_HTTP_TCP_SEND_BUFFER_SIZE = Setting.byteSizeSetting("http.tcp.send_buffer_size",
NetworkService.TcpSettings.TCP_SEND_BUFFER_SIZE, false, Setting.Scope.CLUSTER);
public static final Setting<ByteSizeValue> SETTING_HTTP_TCP_RECEIVE_BUFFER_SIZE = Setting.byteSizeSetting("http.tcp" +
".receive_buffer_size", NetworkService.TcpSettings.TCP_RECEIVE_BUFFER_SIZE, false, Setting.Scope.CLUSTER);
public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE = Setting.byteSizeSetting(
"transport.netty.receive_predictor_size",
settings -> {
long defaultReceiverPredictor = 512 * 1024;
if (JvmInfo.jvmInfo().getMem().getDirectMemoryMax().bytes() > 0) {
// we can guess a better default...
long l = (long) ((0.3 * JvmInfo.jvmInfo().getMem().getDirectMemoryMax().bytes()) / SETTING_HTTP_WORKER_COUNT.get
(settings));
defaultReceiverPredictor = Math.min(defaultReceiverPredictor, Math.max(l, 64 * 1024));
}
return new ByteSizeValue(defaultReceiverPredictor).toString();
}, false, Setting.Scope.CLUSTER);
public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MIN = byteSizeSetting("http.netty" +
".receive_predictor_min",
SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE, false, Setting.Scope.CLUSTER);
public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MAX = byteSizeSetting("http.netty" +
".receive_predictor_max",
SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE, false, Setting.Scope.CLUSTER);
protected final NetworkService networkService; protected final NetworkService networkService;
protected final BigArrays bigArrays; protected final BigArrays bigArrays;
@ -175,47 +219,36 @@ public class NettyHttpServerTransport extends AbstractLifecycleComponent<HttpSer
private final CorsConfig corsConfig; private final CorsConfig corsConfig;
@Inject @Inject
@SuppressForbidden(reason = "sets org.jboss.netty.epollBugWorkaround based on netty.epollBugWorkaround")
// TODO: why be confusing like this? just let the user do it with the netty parameter instead!
public NettyHttpServerTransport(Settings settings, NetworkService networkService, BigArrays bigArrays, ThreadPool threadPool) { public NettyHttpServerTransport(Settings settings, NetworkService networkService, BigArrays bigArrays, ThreadPool threadPool) {
super(settings); super(settings);
this.networkService = networkService; this.networkService = networkService;
this.bigArrays = bigArrays; this.bigArrays = bigArrays;
this.threadPool = threadPool; this.threadPool = threadPool;
if (settings.getAsBoolean("netty.epollBugWorkaround", false)) {
System.setProperty("org.jboss.netty.epollBugWorkaround", "true");
}
ByteSizeValue maxContentLength = SETTING_HTTP_MAX_CONTENT_LENGTH.get(settings); ByteSizeValue maxContentLength = SETTING_HTTP_MAX_CONTENT_LENGTH.get(settings);
this.maxChunkSize = SETTING_HTTP_MAX_CHUNK_SIZE.get(settings); this.maxChunkSize = SETTING_HTTP_MAX_CHUNK_SIZE.get(settings);
this.maxHeaderSize = SETTING_HTTP_MAX_HEADER_SIZE.get(settings); this.maxHeaderSize = SETTING_HTTP_MAX_HEADER_SIZE.get(settings);
this.maxInitialLineLength = SETTING_HTTP_MAX_INITIAL_LINE_LENGTH.get(settings); this.maxInitialLineLength = SETTING_HTTP_MAX_INITIAL_LINE_LENGTH.get(settings);
this.resetCookies = SETTING_HTTP_RESET_COOKIES.get(settings); this.resetCookies = SETTING_HTTP_RESET_COOKIES.get(settings);
this.maxCumulationBufferCapacity = settings.getAsBytesSize("http.netty.max_cumulation_buffer_capacity", null); this.maxCumulationBufferCapacity = SETTING_HTTP_NETTY_MAX_CUMULATION_BUFFER_CAPACITY.get(settings);
this.maxCompositeBufferComponents = settings.getAsInt("http.netty.max_composite_buffer_components", -1); this.maxCompositeBufferComponents = SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS.get(settings);
this.workerCount = settings.getAsInt("http.netty.worker_count", EsExecutors.boundedNumberOfProcessors(settings) * 2); this.workerCount = SETTING_HTTP_WORKER_COUNT.get(settings);
this.blockingServer = settings.getAsBoolean("http.netty.http.blocking_server", TCP_BLOCKING.get(settings)); this.blockingServer = SETTING_HTTP_TCP_BLOCKING_SERVER.get(settings);
this.port = SETTING_HTTP_PORT.get(settings); this.port = SETTING_HTTP_PORT.get(settings);
this.bindHosts = settings.getAsArray("http.netty.bind_host", settings.getAsArray("http.bind_host", settings.getAsArray("http.host", null))); this.bindHosts = SETTING_HTTP_BIND_HOST.get(settings).toArray(Strings.EMPTY_ARRAY);
this.publishHosts = settings.getAsArray("http.netty.publish_host", settings.getAsArray("http.publish_host", settings.getAsArray("http.host", null))); this.publishHosts = SETTING_HTTP_PUBLISH_HOST.get(settings).toArray(Strings.EMPTY_ARRAY);
this.publishPort = SETTING_HTTP_PUBLISH_PORT.get(settings); this.publishPort = SETTING_HTTP_PUBLISH_PORT.get(settings);
this.tcpNoDelay = settings.getAsBoolean("http.netty.tcp_no_delay", TCP_NO_DELAY.get(settings)); this.tcpNoDelay = SETTING_HTTP_TCP_NO_DELAY.get(settings);
this.tcpKeepAlive = settings.getAsBoolean("http.netty.tcp_keep_alive", TCP_KEEP_ALIVE.get(settings)); this.tcpKeepAlive = SETTING_HTTP_TCP_KEEP_ALIVE.get(settings);
this.reuseAddress = settings.getAsBoolean("http.netty.reuse_address", TCP_REUSE_ADDRESS.get(settings)); this.reuseAddress = SETTING_HTTP_TCP_REUSE_ADDRESS.get(settings);
this.tcpSendBufferSize = settings.getAsBytesSize("http.netty.tcp_send_buffer_size", TCP_SEND_BUFFER_SIZE.get(settings)); this.tcpSendBufferSize = SETTING_HTTP_TCP_SEND_BUFFER_SIZE.get(settings);
this.tcpReceiveBufferSize = settings.getAsBytesSize("http.netty.tcp_receive_buffer_size", TCP_RECEIVE_BUFFER_SIZE.get(settings)); this.tcpReceiveBufferSize = SETTING_HTTP_TCP_RECEIVE_BUFFER_SIZE.get(settings);
this.detailedErrorsEnabled = SETTING_HTTP_DETAILED_ERRORS_ENABLED.get(settings); this.detailedErrorsEnabled = SETTING_HTTP_DETAILED_ERRORS_ENABLED.get(settings);
long defaultReceiverPredictor = 512 * 1024;
if (JvmInfo.jvmInfo().getMem().getDirectMemoryMax().bytes() > 0) {
// we can guess a better default...
long l = (long) ((0.3 * JvmInfo.jvmInfo().getMem().getDirectMemoryMax().bytes()) / workerCount);
defaultReceiverPredictor = Math.min(defaultReceiverPredictor, Math.max(l, 64 * 1024));
}
// See AdaptiveReceiveBufferSizePredictor#DEFAULT_XXX for default values in netty..., we can use higher ones for us, even fixed one // See AdaptiveReceiveBufferSizePredictor#DEFAULT_XXX for default values in netty..., we can use higher ones for us, even fixed one
ByteSizeValue receivePredictorMin = settings.getAsBytesSize("http.netty.receive_predictor_min", settings.getAsBytesSize("http.netty.receive_predictor_size", new ByteSizeValue(defaultReceiverPredictor))); ByteSizeValue receivePredictorMin = SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MIN.get(settings);
ByteSizeValue receivePredictorMax = settings.getAsBytesSize("http.netty.receive_predictor_max", settings.getAsBytesSize("http.netty.receive_predictor_size", new ByteSizeValue(defaultReceiverPredictor))); ByteSizeValue receivePredictorMax = SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MAX.get(settings);
if (receivePredictorMax.bytes() == receivePredictorMin.bytes()) { if (receivePredictorMax.bytes() == receivePredictorMin.bytes()) {
receiveBufferSizePredictorFactory = new FixedReceiveBufferSizePredictorFactory((int) receivePredictorMax.bytes()); receiveBufferSizePredictorFactory = new FixedReceiveBufferSizePredictorFactory((int) receivePredictorMax.bytes());
} else { } else {
@ -479,7 +512,7 @@ public class NettyHttpServerTransport extends AbstractLifecycleComponent<HttpSer
(int) transport.maxHeaderSize.bytes(), (int) transport.maxHeaderSize.bytes(),
(int) transport.maxChunkSize.bytes() (int) transport.maxChunkSize.bytes()
); );
if (transport.maxCumulationBufferCapacity != null) { if (transport.maxCumulationBufferCapacity.bytes() >= 0) {
if (transport.maxCumulationBufferCapacity.bytes() > Integer.MAX_VALUE) { if (transport.maxCumulationBufferCapacity.bytes() > Integer.MAX_VALUE) {
requestDecoder.setMaxCumulationBufferCapacity(Integer.MAX_VALUE); requestDecoder.setMaxCumulationBufferCapacity(Integer.MAX_VALUE);
} else { } else {