Use an SettingsProperty enumSet
Instead of modifying methods each time we need to add a new behavior for settings, we can simply pass `SettingsProperty... properties` instead. `SettingsProperty` could be defined then: ``` public enum SettingsProperty { Filtered, Dynamic, ClusterScope, NodeScope, IndexScope // HereGoesYours; } ``` Then in setting code, it become much more flexible. TODO: Note that we need to validate SettingsProperty which are added to a Setting as some of them might be mutually exclusive.
This commit is contained in:
parent
08905be2ca
commit
31b5e0888f
|
@ -33,6 +33,7 @@ import org.elasticsearch.cluster.metadata.MetaDataIndexStateService;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
|
@ -46,7 +47,8 @@ public class TransportCloseIndexAction extends TransportMasterNodeAction<CloseIn
|
|||
private final MetaDataIndexStateService indexStateService;
|
||||
private final DestructiveOperations destructiveOperations;
|
||||
private volatile boolean closeIndexEnabled;
|
||||
public static final Setting<Boolean> CLUSTER_INDICES_CLOSE_ENABLE_SETTING = Setting.boolSetting("cluster.indices.close.enable", true, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> CLUSTER_INDICES_CLOSE_ENABLE_SETTING =
|
||||
Setting.boolSetting("cluster.indices.close.enable", true, true, SettingsProperty.ClusterScope);
|
||||
|
||||
@Inject
|
||||
public TransportCloseIndexAction(Settings settings, TransportService transportService, ClusterService clusterService,
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.common.collect.Tuple;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
|
||||
|
@ -39,7 +40,8 @@ import java.util.List;
|
|||
*/
|
||||
public final class AutoCreateIndex {
|
||||
|
||||
public static final Setting<AutoCreate> AUTO_CREATE_INDEX_SETTING = new Setting<>("action.auto_create_index", "true", AutoCreate::new, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<AutoCreate> AUTO_CREATE_INDEX_SETTING =
|
||||
new Setting<>("action.auto_create_index", "true", AutoCreate::new, false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final boolean dynamicMappingDisabled;
|
||||
private final IndexNameExpressionResolver resolver;
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.elasticsearch.common.component.AbstractComponent;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +34,8 @@ public final class DestructiveOperations extends AbstractComponent {
|
|||
/**
|
||||
* Setting which controls whether wildcard usage (*, prefix*, _all) is allowed.
|
||||
*/
|
||||
public static final Setting<Boolean> REQUIRES_NAME_SETTING = Setting.boolSetting("action.destructive_requires_name", false, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> REQUIRES_NAME_SETTING =
|
||||
Setting.boolSetting("action.destructive_requires_name", false, true, SettingsProperty.ClusterScope);
|
||||
private volatile boolean destructiveRequiresName;
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
@ -37,7 +38,8 @@ import java.util.function.Supplier;
|
|||
public abstract class TransportMasterNodeReadAction<Request extends MasterNodeReadRequest<Request>, Response extends ActionResponse>
|
||||
extends TransportMasterNodeAction<Request, Response> {
|
||||
|
||||
public static final Setting<Boolean> FORCE_LOCAL_SETTING = Setting.boolSetting("action.master.force_local", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> FORCE_LOCAL_SETTING =
|
||||
Setting.boolSetting("action.master.force_local", false, false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final boolean forceLocal;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.bootstrap;
|
||||
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Scope;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
|
||||
public final class BootstrapSettings {
|
||||
|
||||
|
@ -29,10 +29,13 @@ public final class BootstrapSettings {
|
|||
|
||||
// TODO: remove this hack when insecure defaults are removed from java
|
||||
public static final Setting<Boolean> SECURITY_FILTER_BAD_DEFAULTS_SETTING =
|
||||
Setting.boolSetting("security.manager.filter_bad_defaults", true, false, Scope.CLUSTER);
|
||||
Setting.boolSetting("security.manager.filter_bad_defaults", true, false, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final Setting<Boolean> MLOCKALL_SETTING = Setting.boolSetting("bootstrap.mlockall", false, false, Scope.CLUSTER);
|
||||
public static final Setting<Boolean> SECCOMP_SETTING = Setting.boolSetting("bootstrap.seccomp", true, false, Scope.CLUSTER);
|
||||
public static final Setting<Boolean> CTRLHANDLER_SETTING = Setting.boolSetting("bootstrap.ctrlhandler", true, false, Scope.CLUSTER);
|
||||
public static final Setting<Boolean> MLOCKALL_SETTING =
|
||||
Setting.boolSetting("bootstrap.mlockall", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> SECCOMP_SETTING =
|
||||
Setting.boolSetting("bootstrap.seccomp", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> CTRLHANDLER_SETTING =
|
||||
Setting.boolSetting("bootstrap.ctrlhandler", true, false, SettingsProperty.ClusterScope);
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.common.lease.Releasable;
|
|||
import org.elasticsearch.common.recycler.AbstractRecyclerC;
|
||||
import org.elasticsearch.common.recycler.Recycler;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.common.util.BigArrays;
|
||||
|
@ -43,13 +44,19 @@ import static org.elasticsearch.common.recycler.Recyclers.none;
|
|||
/** A recycler of fixed-size pages. */
|
||||
public class PageCacheRecycler extends AbstractComponent implements Releasable {
|
||||
|
||||
public static final Setting<Type> TYPE_SETTING = new Setting<>("cache.recycler.page.type", Type.CONCURRENT.name(), Type::parse, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> LIMIT_HEAP_SETTING = Setting.byteSizeSetting("cache.recycler.page.limit.heap", "10%", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Double> WEIGHT_BYTES_SETTING = Setting.doubleSetting("cache.recycler.page.weight.bytes", 1d, 0d, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Double> WEIGHT_LONG_SETTING = Setting.doubleSetting("cache.recycler.page.weight.longs", 1d, 0d, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Double> WEIGHT_INT_SETTING = Setting.doubleSetting("cache.recycler.page.weight.ints", 1d, 0d, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Type> TYPE_SETTING =
|
||||
new Setting<>("cache.recycler.page.type", Type.CONCURRENT.name(), Type::parse, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> LIMIT_HEAP_SETTING =
|
||||
Setting.byteSizeSetting("cache.recycler.page.limit.heap", "10%", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Double> WEIGHT_BYTES_SETTING =
|
||||
Setting.doubleSetting("cache.recycler.page.weight.bytes", 1d, 0d, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Double> WEIGHT_LONG_SETTING =
|
||||
Setting.doubleSetting("cache.recycler.page.weight.longs", 1d, 0d, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Double> WEIGHT_INT_SETTING =
|
||||
Setting.doubleSetting("cache.recycler.page.weight.ints", 1d, 0d, false, SettingsProperty.ClusterScope);
|
||||
// object pages are less useful to us so we give them a lower weight by default
|
||||
public static final Setting<Double> WEIGHT_OBJECTS_SETTING = Setting.doubleSetting("cache.recycler.page.weight.objects", 0.1d, 0d, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Double> WEIGHT_OBJECTS_SETTING =
|
||||
Setting.doubleSetting("cache.recycler.page.weight.objects", 0.1d, 0d, false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final Recycler<byte[]> bytePage;
|
||||
private final Recycler<int[]> intPage;
|
||||
|
|
|
@ -87,6 +87,7 @@ import org.elasticsearch.action.update.UpdateResponse;
|
|||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.lease.Releasable;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -114,7 +115,7 @@ public interface Client extends ElasticsearchClient, Releasable {
|
|||
default:
|
||||
throw new IllegalArgumentException("Can't parse [client.type] must be one of [node, transport]");
|
||||
}
|
||||
}, false, Setting.Scope.CLUSTER);
|
||||
}, false, SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* The admin client that can be used to perform administrative operations.
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
@ -100,10 +101,14 @@ public class TransportClientNodesService extends AbstractComponent {
|
|||
private volatile boolean closed;
|
||||
|
||||
|
||||
public static final Setting<TimeValue> CLIENT_TRANSPORT_NODES_SAMPLER_INTERVAL = Setting.positiveTimeSetting("client.transport.nodes_sampler_interval", timeValueSeconds(5), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> CLIENT_TRANSPORT_PING_TIMEOUT = Setting.positiveTimeSetting("client.transport.ping_timeout", timeValueSeconds(5), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> CLIENT_TRANSPORT_IGNORE_CLUSTER_NAME = Setting.boolSetting("client.transport.ignore_cluster_name", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> CLIENT_TRANSPORT_SNIFF = Setting.boolSetting("client.transport.sniff", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> CLIENT_TRANSPORT_NODES_SAMPLER_INTERVAL =
|
||||
Setting.positiveTimeSetting("client.transport.nodes_sampler_interval", timeValueSeconds(5), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> CLIENT_TRANSPORT_PING_TIMEOUT =
|
||||
Setting.positiveTimeSetting("client.transport.ping_timeout", timeValueSeconds(5), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> CLIENT_TRANSPORT_IGNORE_CLUSTER_NAME =
|
||||
Setting.boolSetting("client.transport.ignore_cluster_name", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> CLIENT_TRANSPORT_SNIFF =
|
||||
Setting.boolSetting("client.transport.sniff", false, false, SettingsProperty.ClusterScope);
|
||||
|
||||
@Inject
|
||||
public TransportClientNodesService(Settings settings, ClusterName clusterName, TransportService transportService,
|
||||
|
|
|
@ -58,6 +58,7 @@ import org.elasticsearch.common.inject.AbstractModule;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.ExtensionPoint;
|
||||
import org.elasticsearch.gateway.GatewayAllocator;
|
||||
|
@ -74,7 +75,8 @@ public class ClusterModule extends AbstractModule {
|
|||
|
||||
public static final String EVEN_SHARD_COUNT_ALLOCATOR = "even_shard";
|
||||
public static final String BALANCED_ALLOCATOR = "balanced"; // default
|
||||
public static final Setting<String> SHARDS_ALLOCATOR_TYPE_SETTING = new Setting<>("cluster.routing.allocation.type", BALANCED_ALLOCATOR, Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> SHARDS_ALLOCATOR_TYPE_SETTING =
|
||||
new Setting<>("cluster.routing.allocation.type", BALANCED_ALLOCATOR, Function.identity(), false, SettingsProperty.ClusterScope);
|
||||
public static final List<Class<? extends AllocationDecider>> DEFAULT_ALLOCATION_DECIDERS =
|
||||
Collections.unmodifiableList(Arrays.asList(
|
||||
SameShardAllocationDecider.class,
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -37,7 +38,7 @@ public class ClusterName implements Streamable {
|
|||
throw new IllegalArgumentException("[cluster.name] must not be empty");
|
||||
}
|
||||
return s;
|
||||
}, false, Setting.Scope.CLUSTER);
|
||||
}, false, SettingsProperty.ClusterScope);
|
||||
|
||||
|
||||
public static final ClusterName DEFAULT = new ClusterName(CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY).intern());
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
||||
|
@ -64,8 +65,11 @@ import java.util.concurrent.TimeUnit;
|
|||
*/
|
||||
public class InternalClusterInfoService extends AbstractComponent implements ClusterInfoService, LocalNodeMasterListener, ClusterStateListener {
|
||||
|
||||
public static final Setting<TimeValue> INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING = Setting.timeSetting("cluster.info.update.interval", TimeValue.timeValueSeconds(30), TimeValue.timeValueSeconds(10), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING = Setting.positiveTimeSetting("cluster.info.update.timeout", TimeValue.timeValueSeconds(15), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING =
|
||||
Setting.timeSetting("cluster.info.update.interval", TimeValue.timeValueSeconds(30), TimeValue.timeValueSeconds(10), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING =
|
||||
Setting.positiveTimeSetting("cluster.info.update.timeout", TimeValue.timeValueSeconds(15), true, SettingsProperty.ClusterScope);
|
||||
|
||||
private volatile TimeValue updateFrequency;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.component.AbstractComponent;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
|
@ -41,7 +42,8 @@ import java.util.concurrent.TimeoutException;
|
|||
*/
|
||||
public class MappingUpdatedAction extends AbstractComponent {
|
||||
|
||||
public static final Setting<TimeValue> INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING = Setting.positiveTimeSetting("indices.mapping.dynamic_timeout", TimeValue.timeValueSeconds(30), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING =
|
||||
Setting.positiveTimeSetting("indices.mapping.dynamic_timeout", TimeValue.timeValueSeconds(30), true, SettingsProperty.ClusterScope);
|
||||
|
||||
private IndicesAdminClient client;
|
||||
private volatile TimeValue dynamicMappingUpdateTimeout;
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.elasticsearch.cluster.metadata;
|
|||
|
||||
import org.elasticsearch.common.Booleans;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
|
||||
/**
|
||||
* This class acts as a functional wrapper around the <tt>index.auto_expand_replicas</tt> setting.
|
||||
|
@ -56,7 +57,7 @@ final class AutoExpandReplicas {
|
|||
}
|
||||
}
|
||||
return new AutoExpandReplicas(min, max, true);
|
||||
}, true, Setting.Scope.INDEX);
|
||||
}, true, SettingsProperty.IndexScope);
|
||||
|
||||
private final int minReplicas;
|
||||
private final int maxReplicas;
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.elasticsearch.common.compress.CompressedXContent;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.loader.SettingsLoader;
|
||||
import org.elasticsearch.common.xcontent.FromXContentBuilder;
|
||||
|
@ -152,28 +153,36 @@ public class IndexMetaData implements Diffable<IndexMetaData>, FromXContentBuild
|
|||
|
||||
public static final String INDEX_SETTING_PREFIX = "index.";
|
||||
public static final String SETTING_NUMBER_OF_SHARDS = "index.number_of_shards";
|
||||
public static final Setting<Integer> INDEX_NUMBER_OF_SHARDS_SETTING = Setting.intSetting(SETTING_NUMBER_OF_SHARDS, 5, 1, false, Setting.Scope.INDEX);
|
||||
public static final Setting<Integer> INDEX_NUMBER_OF_SHARDS_SETTING =
|
||||
Setting.intSetting(SETTING_NUMBER_OF_SHARDS, 5, 1, false, SettingsProperty.IndexScope);
|
||||
public static final String SETTING_NUMBER_OF_REPLICAS = "index.number_of_replicas";
|
||||
public static final Setting<Integer> INDEX_NUMBER_OF_REPLICAS_SETTING = Setting.intSetting(SETTING_NUMBER_OF_REPLICAS, 1, 0, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Integer> INDEX_NUMBER_OF_REPLICAS_SETTING =
|
||||
Setting.intSetting(SETTING_NUMBER_OF_REPLICAS, 1, 0, true, SettingsProperty.IndexScope);
|
||||
public static final String SETTING_SHADOW_REPLICAS = "index.shadow_replicas";
|
||||
public static final Setting<Boolean> INDEX_SHADOW_REPLICAS_SETTING = Setting.boolSetting(SETTING_SHADOW_REPLICAS, false, false, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_SHADOW_REPLICAS_SETTING =
|
||||
Setting.boolSetting(SETTING_SHADOW_REPLICAS, false, false, SettingsProperty.IndexScope);
|
||||
|
||||
public static final String SETTING_SHARED_FILESYSTEM = "index.shared_filesystem";
|
||||
public static final Setting<Boolean> INDEX_SHARED_FILESYSTEM_SETTING = Setting.boolSetting(SETTING_SHARED_FILESYSTEM, false, false, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_SHARED_FILESYSTEM_SETTING =
|
||||
Setting.boolSetting(SETTING_SHARED_FILESYSTEM, false, false, SettingsProperty.IndexScope);
|
||||
|
||||
public static final String SETTING_AUTO_EXPAND_REPLICAS = "index.auto_expand_replicas";
|
||||
public static final Setting<AutoExpandReplicas> INDEX_AUTO_EXPAND_REPLICAS_SETTING = AutoExpandReplicas.SETTING;
|
||||
public static final String SETTING_READ_ONLY = "index.blocks.read_only";
|
||||
public static final Setting<Boolean> INDEX_READ_ONLY_SETTING = Setting.boolSetting(SETTING_READ_ONLY, false, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_READ_ONLY_SETTING =
|
||||
Setting.boolSetting(SETTING_READ_ONLY, false, true, SettingsProperty.IndexScope);
|
||||
|
||||
public static final String SETTING_BLOCKS_READ = "index.blocks.read";
|
||||
public static final Setting<Boolean> INDEX_BLOCKS_READ_SETTING = Setting.boolSetting(SETTING_BLOCKS_READ, false, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_BLOCKS_READ_SETTING =
|
||||
Setting.boolSetting(SETTING_BLOCKS_READ, false, true, SettingsProperty.IndexScope);
|
||||
|
||||
public static final String SETTING_BLOCKS_WRITE = "index.blocks.write";
|
||||
public static final Setting<Boolean> INDEX_BLOCKS_WRITE_SETTING = Setting.boolSetting(SETTING_BLOCKS_WRITE, false, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_BLOCKS_WRITE_SETTING =
|
||||
Setting.boolSetting(SETTING_BLOCKS_WRITE, false, true, SettingsProperty.IndexScope);
|
||||
|
||||
public static final String SETTING_BLOCKS_METADATA = "index.blocks.metadata";
|
||||
public static final Setting<Boolean> INDEX_BLOCKS_METADATA_SETTING = Setting.boolSetting(SETTING_BLOCKS_METADATA, false, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_BLOCKS_METADATA_SETTING =
|
||||
Setting.boolSetting(SETTING_BLOCKS_METADATA, false, true, SettingsProperty.IndexScope);
|
||||
|
||||
public static final String SETTING_VERSION_CREATED = "index.version.created";
|
||||
public static final String SETTING_VERSION_CREATED_STRING = "index.version.created_string";
|
||||
|
@ -182,18 +191,24 @@ public class IndexMetaData implements Diffable<IndexMetaData>, FromXContentBuild
|
|||
public static final String SETTING_VERSION_MINIMUM_COMPATIBLE = "index.version.minimum_compatible";
|
||||
public static final String SETTING_CREATION_DATE = "index.creation_date";
|
||||
public static final String SETTING_PRIORITY = "index.priority";
|
||||
public static final Setting<Integer> INDEX_PRIORITY_SETTING = Setting.intSetting("index.priority", 1, 0, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Integer> INDEX_PRIORITY_SETTING =
|
||||
Setting.intSetting("index.priority", 1, 0, true, SettingsProperty.IndexScope);
|
||||
public static final String SETTING_CREATION_DATE_STRING = "index.creation_date_string";
|
||||
public static final String SETTING_INDEX_UUID = "index.uuid";
|
||||
public static final String SETTING_DATA_PATH = "index.data_path";
|
||||
public static final Setting<String> INDEX_DATA_PATH_SETTING = new Setting<>(SETTING_DATA_PATH, "", Function.identity(), false, Setting.Scope.INDEX);
|
||||
public static final Setting<String> INDEX_DATA_PATH_SETTING =
|
||||
new Setting<>(SETTING_DATA_PATH, "", Function.identity(), false, SettingsProperty.IndexScope);
|
||||
public static final String SETTING_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE = "index.shared_filesystem.recover_on_any_node";
|
||||
public static final Setting<Boolean> INDEX_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE_SETTING = Setting.boolSetting(SETTING_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE, false, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE_SETTING =
|
||||
Setting.boolSetting(SETTING_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE, false, true, SettingsProperty.IndexScope);
|
||||
public static final String INDEX_UUID_NA_VALUE = "_na_";
|
||||
|
||||
public static final Setting<Settings> INDEX_ROUTING_REQUIRE_GROUP_SETTING = Setting.groupSetting("index.routing.allocation.require.", true, Setting.Scope.INDEX);
|
||||
public static final Setting<Settings> INDEX_ROUTING_INCLUDE_GROUP_SETTING = Setting.groupSetting("index.routing.allocation.include.", true, Setting.Scope.INDEX);
|
||||
public static final Setting<Settings> INDEX_ROUTING_EXCLUDE_GROUP_SETTING = Setting.groupSetting("index.routing.allocation.exclude.", true, Setting.Scope.INDEX);
|
||||
public static final Setting<Settings> INDEX_ROUTING_REQUIRE_GROUP_SETTING =
|
||||
Setting.groupSetting("index.routing.allocation.require.", true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Settings> INDEX_ROUTING_INCLUDE_GROUP_SETTING =
|
||||
Setting.groupSetting("index.routing.allocation.include.", true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Settings> INDEX_ROUTING_EXCLUDE_GROUP_SETTING =
|
||||
Setting.groupSetting("index.routing.allocation.exclude.", true, SettingsProperty.IndexScope);
|
||||
|
||||
public static final IndexMetaData PROTO = IndexMetaData.builder("")
|
||||
.settings(Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT))
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.loader.SettingsLoader;
|
||||
import org.elasticsearch.common.xcontent.FromXContentBuilder;
|
||||
|
@ -139,7 +140,8 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData>, Fr
|
|||
}
|
||||
|
||||
|
||||
public static final Setting<Boolean> SETTING_READ_ONLY_SETTING = Setting.boolSetting("cluster.blocks.read_only", false, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> SETTING_READ_ONLY_SETTING =
|
||||
Setting.boolSetting("cluster.blocks.read_only", false, true, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final ClusterBlock CLUSTER_READ_ONLY_BLOCK = new ClusterBlock(6, "cluster read-only (api)", false, false, RestStatus.FORBIDDEN, EnumSet.of(ClusterBlockLevel.WRITE, ClusterBlockLevel.METADATA_WRITE));
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.elasticsearch.common.io.stream.Writeable;
|
|||
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
|
||||
import org.elasticsearch.common.joda.Joda;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
|
@ -44,7 +45,9 @@ public class UnassignedInfo implements ToXContent, Writeable<UnassignedInfo> {
|
|||
public static final FormatDateTimeFormatter DATE_TIME_FORMATTER = Joda.forPattern("dateOptionalTime");
|
||||
private static final TimeValue DEFAULT_DELAYED_NODE_LEFT_TIMEOUT = TimeValue.timeValueMinutes(1);
|
||||
|
||||
public static final Setting<TimeValue> INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING = Setting.timeSetting("index.unassigned.node_left.delayed_timeout", DEFAULT_DELAYED_NODE_LEFT_TIMEOUT, true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING =
|
||||
Setting.timeSetting("index.unassigned.node_left.delayed_timeout", DEFAULT_DELAYED_NODE_LEFT_TIMEOUT, true,
|
||||
SettingsProperty.IndexScope);
|
||||
|
||||
/**
|
||||
* Reason why the shard is in unassigned state.
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.gateway.PriorityComparator;
|
||||
|
||||
|
@ -72,9 +73,12 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING;
|
|||
*/
|
||||
public class BalancedShardsAllocator extends AbstractComponent implements ShardsAllocator {
|
||||
|
||||
public static final Setting<Float> INDEX_BALANCE_FACTOR_SETTING = Setting.floatSetting("cluster.routing.allocation.balance.index", 0.55f, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Float> SHARD_BALANCE_FACTOR_SETTING = Setting.floatSetting("cluster.routing.allocation.balance.shard", 0.45f, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Float> THRESHOLD_SETTING = Setting.floatSetting("cluster.routing.allocation.balance.threshold", 1.0f, 0.0f, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Float> INDEX_BALANCE_FACTOR_SETTING =
|
||||
Setting.floatSetting("cluster.routing.allocation.balance.index", 0.55f, true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Float> SHARD_BALANCE_FACTOR_SETTING =
|
||||
Setting.floatSetting("cluster.routing.allocation.balance.shard", 0.45f, true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Float> THRESHOLD_SETTING =
|
||||
Setting.floatSetting("cluster.routing.allocation.balance.threshold", 1.0f, 0.0f, true, SettingsProperty.ClusterScope);
|
||||
|
||||
private volatile WeightFunction weightFunction;
|
||||
private volatile float threshold;
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.Strings;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -77,8 +78,11 @@ public class AwarenessAllocationDecider extends AllocationDecider {
|
|||
|
||||
public static final String NAME = "awareness";
|
||||
|
||||
public static final Setting<String[]> CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING = new Setting<>("cluster.routing.allocation.awareness.attributes", "", Strings::splitStringByCommaToArray , true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Settings> CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP_SETTING = Setting.groupSetting("cluster.routing.allocation.awareness.force.", true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String[]> CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING =
|
||||
new Setting<>("cluster.routing.allocation.awareness.attributes", "", Strings::splitStringByCommaToArray , true,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static final Setting<Settings> CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP_SETTING =
|
||||
Setting.groupSetting("cluster.routing.allocation.awareness.force.", true, SettingsProperty.ClusterScope);
|
||||
|
||||
private String[] awarenessAttributes;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.Locale;
|
||||
|
@ -48,7 +49,9 @@ import java.util.Locale;
|
|||
public class ClusterRebalanceAllocationDecider extends AllocationDecider {
|
||||
|
||||
public static final String NAME = "cluster_rebalance";
|
||||
public static final Setting<ClusterRebalanceType> CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING = new Setting<>("cluster.routing.allocation.allow_rebalance", ClusterRebalanceType.INDICES_ALL_ACTIVE.name().toLowerCase(Locale.ROOT), ClusterRebalanceType::parseString, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ClusterRebalanceType> CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING =
|
||||
new Setting<>("cluster.routing.allocation.allow_rebalance", ClusterRebalanceType.INDICES_ALL_ACTIVE.name().toLowerCase(Locale.ROOT),
|
||||
ClusterRebalanceType::parseString, true, SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* An enum representation for the configured re-balance type.
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
|
@ -42,7 +43,8 @@ public class ConcurrentRebalanceAllocationDecider extends AllocationDecider {
|
|||
|
||||
public static final String NAME = "concurrent_rebalance";
|
||||
|
||||
public static final Setting<Integer> CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE_SETTING = Setting.intSetting("cluster.routing.allocation.cluster_concurrent_rebalance", 2, -1, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE_SETTING =
|
||||
Setting.intSetting("cluster.routing.allocation.cluster_concurrent_rebalance", 2, -1, true, SettingsProperty.ClusterScope);
|
||||
private volatile int clusterConcurrentRebalance;
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.elasticsearch.common.collect.ImmutableOpenMap;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.common.unit.RatioValue;
|
||||
|
@ -81,11 +82,17 @@ public class DiskThresholdDecider extends AllocationDecider {
|
|||
private volatile boolean enabled;
|
||||
private volatile TimeValue rerouteInterval;
|
||||
|
||||
public static final Setting<Boolean> CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING = Setting.boolSetting("cluster.routing.allocation.disk.threshold_enabled", true, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING = new Setting<>("cluster.routing.allocation.disk.watermark.low", "85%", (s) -> validWatermarkSetting(s, "cluster.routing.allocation.disk.watermark.low"), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING = new Setting<>("cluster.routing.allocation.disk.watermark.high", "90%", (s) -> validWatermarkSetting(s, "cluster.routing.allocation.disk.watermark.high"), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING = Setting.boolSetting("cluster.routing.allocation.disk.include_relocations", true, true, Setting.Scope.CLUSTER);;
|
||||
public static final Setting<TimeValue> CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING = Setting.positiveTimeSetting("cluster.routing.allocation.disk.reroute_interval", TimeValue.timeValueSeconds(60), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING =
|
||||
Setting.boolSetting("cluster.routing.allocation.disk.threshold_enabled", true, true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING =
|
||||
new Setting<>("cluster.routing.allocation.disk.watermark.low", "85%", (s) -> validWatermarkSetting(s, "cluster.routing.allocation.disk.watermark.low"), true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING =
|
||||
new Setting<>("cluster.routing.allocation.disk.watermark.high", "90%", (s) -> validWatermarkSetting(s, "cluster.routing.allocation.disk.watermark.high"), true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING =
|
||||
Setting.boolSetting("cluster.routing.allocation.disk.include_relocations", true, true, SettingsProperty.ClusterScope);;
|
||||
public static final Setting<TimeValue> CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING =
|
||||
Setting.positiveTimeSetting("cluster.routing.allocation.disk.reroute_interval", TimeValue.timeValueSeconds(60), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* Listens for a node to go over the high watermark and kicks off an empty
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.Locale;
|
||||
|
@ -60,11 +61,15 @@ public class EnableAllocationDecider extends AllocationDecider {
|
|||
|
||||
public static final String NAME = "enable";
|
||||
|
||||
public static final Setting<Allocation> CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING = new Setting<>("cluster.routing.allocation.enable", Allocation.ALL.name(), Allocation::parse, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Allocation> INDEX_ROUTING_ALLOCATION_ENABLE_SETTING = new Setting<>("index.routing.allocation.enable", Allocation.ALL.name(), Allocation::parse, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Allocation> CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING =
|
||||
new Setting<>("cluster.routing.allocation.enable", Allocation.ALL.name(), Allocation::parse, true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Allocation> INDEX_ROUTING_ALLOCATION_ENABLE_SETTING =
|
||||
new Setting<>("index.routing.allocation.enable", Allocation.ALL.name(), Allocation::parse, true, SettingsProperty.IndexScope);
|
||||
|
||||
public static final Setting<Rebalance> CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING = new Setting<>("cluster.routing.rebalance.enable", Rebalance.ALL.name(), Rebalance::parse, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Rebalance> INDEX_ROUTING_REBALANCE_ENABLE_SETTING = new Setting<>("index.routing.rebalance.enable", Rebalance.ALL.name(), Rebalance::parse, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Rebalance> CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING =
|
||||
new Setting<>("cluster.routing.rebalance.enable", Rebalance.ALL.name(), Rebalance::parse, true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Rebalance> INDEX_ROUTING_REBALANCE_ENABLE_SETTING =
|
||||
new Setting<>("index.routing.rebalance.enable", Rebalance.ALL.name(), Rebalance::parse, true, SettingsProperty.IndexScope);
|
||||
|
||||
private volatile Rebalance enableRebalance;
|
||||
private volatile Allocation enableAllocation;
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import static org.elasticsearch.cluster.node.DiscoveryNodeFilters.OpType.AND;
|
||||
|
@ -60,9 +61,12 @@ public class FilterAllocationDecider extends AllocationDecider {
|
|||
|
||||
public static final String NAME = "filter";
|
||||
|
||||
public static final Setting<Settings> CLUSTER_ROUTING_REQUIRE_GROUP_SETTING = Setting.groupSetting("cluster.routing.allocation.require.", true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Settings> CLUSTER_ROUTING_INCLUDE_GROUP_SETTING = Setting.groupSetting("cluster.routing.allocation.include.", true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Settings> CLUSTER_ROUTING_EXCLUDE_GROUP_SETTING = Setting.groupSetting("cluster.routing.allocation.exclude.", true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Settings> CLUSTER_ROUTING_REQUIRE_GROUP_SETTING =
|
||||
Setting.groupSetting("cluster.routing.allocation.require.", true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Settings> CLUSTER_ROUTING_INCLUDE_GROUP_SETTING =
|
||||
Setting.groupSetting("cluster.routing.allocation.include.", true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Settings> CLUSTER_ROUTING_EXCLUDE_GROUP_SETTING =
|
||||
Setting.groupSetting("cluster.routing.allocation.exclude.", true, SettingsProperty.ClusterScope);
|
||||
|
||||
private volatile DiscoveryNodeFilters clusterRequireFilters;
|
||||
private volatile DiscoveryNodeFilters clusterIncludeFilters;
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
|
@ -59,13 +60,15 @@ public class ShardsLimitAllocationDecider extends AllocationDecider {
|
|||
* Controls the maximum number of shards per index on a single Elasticsearch
|
||||
* node. Negative values are interpreted as unlimited.
|
||||
*/
|
||||
public static final Setting<Integer> INDEX_TOTAL_SHARDS_PER_NODE_SETTING = Setting.intSetting("index.routing.allocation.total_shards_per_node", -1, -1, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Integer> INDEX_TOTAL_SHARDS_PER_NODE_SETTING =
|
||||
Setting.intSetting("index.routing.allocation.total_shards_per_node", -1, -1, true, SettingsProperty.IndexScope);
|
||||
|
||||
/**
|
||||
* Controls the maximum number of shards per node on a global level.
|
||||
* Negative values are interpreted as unlimited.
|
||||
*/
|
||||
public static final Setting<Integer> CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING = Setting.intSetting("cluster.routing.allocation.total_shards_per_node", -1, -1, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING =
|
||||
Setting.intSetting("cluster.routing.allocation.total_shards_per_node", -1, -1, true, SettingsProperty.ClusterScope);
|
||||
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
|
@ -39,7 +40,8 @@ public class SnapshotInProgressAllocationDecider extends AllocationDecider {
|
|||
/**
|
||||
* Disables relocation of shards that are currently being snapshotted.
|
||||
*/
|
||||
public static final Setting<Boolean> CLUSTER_ROUTING_ALLOCATION_SNAPSHOT_RELOCATION_ENABLED_SETTING = Setting.boolSetting("cluster.routing.allocation.snapshot.relocation_enabled", false, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> CLUSTER_ROUTING_ALLOCATION_SNAPSHOT_RELOCATION_ENABLED_SETTING =
|
||||
Setting.boolSetting("cluster.routing.allocation.snapshot.relocation_enabled", false, true, SettingsProperty.ClusterScope);
|
||||
|
||||
private volatile boolean enableRelocation = false;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
|
@ -50,10 +51,23 @@ public class ThrottlingAllocationDecider extends AllocationDecider {
|
|||
public static final int DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES = 2;
|
||||
public static final int DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES = 4;
|
||||
public static final String NAME = "throttling";
|
||||
public static final Setting<Integer> CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING = new Setting<>("cluster.routing.allocation.node_concurrent_recoveries", Integer.toString(DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES), (s) -> Setting.parseInt(s, 0, "cluster.routing.allocation.node_concurrent_recoveries"), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING = Setting.intSetting("cluster.routing.allocation.node_initial_primaries_recoveries", DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES, 0, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING = new Setting<>("cluster.routing.allocation.node_concurrent_incoming_recoveries", (s) -> CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING.getRaw(s), (s) -> Setting.parseInt(s, 0, "cluster.routing.allocation.node_concurrent_incoming_recoveries"), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING = new Setting<>("cluster.routing.allocation.node_concurrent_outgoing_recoveries", (s) -> CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING.getRaw(s), (s) -> Setting.parseInt(s, 0, "cluster.routing.allocation.node_concurrent_outgoing_recoveries"), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING =
|
||||
new Setting<>("cluster.routing.allocation.node_concurrent_recoveries",
|
||||
Integer.toString(DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES),
|
||||
(s) -> Setting.parseInt(s, 0, "cluster.routing.allocation.node_concurrent_recoveries"), true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING =
|
||||
Setting.intSetting("cluster.routing.allocation.node_initial_primaries_recoveries",
|
||||
DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES, 0, true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING =
|
||||
new Setting<>("cluster.routing.allocation.node_concurrent_incoming_recoveries",
|
||||
(s) -> CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING.getRaw(s),
|
||||
(s) -> Setting.parseInt(s, 0, "cluster.routing.allocation.node_concurrent_incoming_recoveries"), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING =
|
||||
new Setting<>("cluster.routing.allocation.node_concurrent_outgoing_recoveries",
|
||||
(s) -> CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING.getRaw(s),
|
||||
(s) -> Setting.parseInt(s, 0, "cluster.routing.allocation.node_concurrent_outgoing_recoveries"), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
|
||||
private volatile int primariesInitialRecoveries;
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.elasticsearch.common.logging.ESLogger;
|
|||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.text.Text;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
|
@ -93,8 +94,12 @@ import static org.elasticsearch.common.util.concurrent.EsExecutors.daemonThreadF
|
|||
*/
|
||||
public class InternalClusterService extends AbstractLifecycleComponent<ClusterService> implements ClusterService {
|
||||
|
||||
public static final Setting<TimeValue> CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING = Setting.positiveTimeSetting("cluster.service.slow_task_logging_threshold", TimeValue.timeValueSeconds(30), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> CLUSTER_SERVICE_RECONNECT_INTERVAL_SETTING = Setting.positiveTimeSetting("cluster.service.reconnect_interval", TimeValue.timeValueSeconds(10), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING =
|
||||
Setting.positiveTimeSetting("cluster.service.slow_task_logging_threshold", TimeValue.timeValueSeconds(30), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> CLUSTER_SERVICE_RECONNECT_INTERVAL_SETTING =
|
||||
Setting.positiveTimeSetting("cluster.service.reconnect_interval", TimeValue.timeValueSeconds(10), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
public static final String UPDATE_THREAD_NAME = "clusterService#updateTask";
|
||||
private final ThreadPool threadPool;
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.common.logging.log4j.Log4jESLoggerFactory;
|
|||
import org.elasticsearch.common.logging.slf4j.Slf4jESLoggerFactory;
|
||||
import org.elasticsearch.common.settings.AbstractScopedSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.Locale;
|
||||
|
@ -36,8 +37,10 @@ import java.util.regex.Pattern;
|
|||
*/
|
||||
public abstract class ESLoggerFactory {
|
||||
|
||||
public static final Setting<LogLevel> LOG_DEFAULT_LEVEL_SETTING = new Setting<>("logger.level", LogLevel.INFO.name(), LogLevel::parse, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<LogLevel> LOG_LEVEL_SETTING = Setting.dynamicKeySetting("logger.", LogLevel.INFO.name(), LogLevel::parse, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<LogLevel> LOG_DEFAULT_LEVEL_SETTING =
|
||||
new Setting<>("logger.level", LogLevel.INFO.name(), LogLevel::parse, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<LogLevel> LOG_LEVEL_SETTING =
|
||||
Setting.dynamicKeySetting("logger.", LogLevel.INFO.name(), LogLevel::parse, true, SettingsProperty.ClusterScope);
|
||||
|
||||
private static volatile ESLoggerFactory defaultFactory = new JdkESLoggerFactory();
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.Setting.Scope;
|
||||
import org.elasticsearch.common.util.ExtensionPoint;
|
||||
import org.elasticsearch.http.HttpServer;
|
||||
import org.elasticsearch.http.HttpServerTransport;
|
||||
|
@ -155,10 +155,12 @@ public class NetworkModule extends AbstractModule {
|
|||
public static final String LOCAL_TRANSPORT = "local";
|
||||
public static final String NETTY_TRANSPORT = "netty";
|
||||
|
||||
public static final Setting<String> HTTP_TYPE_SETTING = Setting.simpleString("http.type", false, Scope.CLUSTER);
|
||||
public static final Setting<Boolean> HTTP_ENABLED = Setting.boolSetting("http.enabled", true, false, Scope.CLUSTER);
|
||||
public static final Setting<String> TRANSPORT_SERVICE_TYPE_SETTING = Setting.simpleString("transport.service.type", false, Scope.CLUSTER);
|
||||
public static final Setting<String> TRANSPORT_TYPE_SETTING = Setting.simpleString("transport.type", false, Scope.CLUSTER);
|
||||
public static final Setting<String> HTTP_TYPE_SETTING = Setting.simpleString("http.type", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> HTTP_ENABLED = Setting.boolSetting("http.enabled", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> TRANSPORT_SERVICE_TYPE_SETTING =
|
||||
Setting.simpleString("transport.service.type", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> TRANSPORT_TYPE_SETTING =
|
||||
Setting.simpleString("transport.type", false, SettingsProperty.ClusterScope);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.common.network;
|
|||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
@ -43,24 +44,33 @@ public class NetworkService extends AbstractComponent {
|
|||
/** By default, we bind to loopback interfaces */
|
||||
public static final String DEFAULT_NETWORK_HOST = "_local_";
|
||||
|
||||
public static final Setting<List<String>> GLOBAL_NETWORK_HOST_SETTING = Setting.listSetting("network.host", Arrays.asList(DEFAULT_NETWORK_HOST),
|
||||
s -> s, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<List<String>> GLOBAL_NETWORK_BINDHOST_SETTING = Setting.listSetting("network.bind_host", GLOBAL_NETWORK_HOST_SETTING,
|
||||
s -> s, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<List<String>> GLOBAL_NETWORK_PUBLISHHOST_SETTING = Setting.listSetting("network.publish_host", GLOBAL_NETWORK_HOST_SETTING,
|
||||
s -> s, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> NETWORK_SERVER = Setting.boolSetting("network.server", true, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<List<String>> GLOBAL_NETWORK_HOST_SETTING =
|
||||
Setting.listSetting("network.host", Arrays.asList(DEFAULT_NETWORK_HOST), s -> s, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<List<String>> GLOBAL_NETWORK_BINDHOST_SETTING =
|
||||
Setting.listSetting("network.bind_host", GLOBAL_NETWORK_HOST_SETTING, s -> s, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<List<String>> GLOBAL_NETWORK_PUBLISHHOST_SETTING =
|
||||
Setting.listSetting("network.publish_host", GLOBAL_NETWORK_HOST_SETTING, s -> s, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> NETWORK_SERVER = Setting.boolSetting("network.server", true, false, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final class TcpSettings {
|
||||
public static final Setting<Boolean> TCP_NO_DELAY = Setting.boolSetting("network.tcp.no_delay", true, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_KEEP_ALIVE = Setting.boolSetting("network.tcp.keep_alive", true, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_REUSE_ADDRESS = Setting.boolSetting("network.tcp.reuse_address", NetworkUtils.defaultReuseAddress(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> TCP_SEND_BUFFER_SIZE = Setting.byteSizeSetting("network.tcp.send_buffer_size", new ByteSizeValue(-1), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> TCP_RECEIVE_BUFFER_SIZE = Setting.byteSizeSetting("network.tcp.receive_buffer_size", new ByteSizeValue(-1), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_BLOCKING = Setting.boolSetting("network.tcp.blocking", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_BLOCKING_SERVER = Setting.boolSetting("network.tcp.blocking_server", TCP_BLOCKING, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_BLOCKING_CLIENT = Setting.boolSetting("network.tcp.blocking_client", TCP_BLOCKING, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> TCP_CONNECT_TIMEOUT = Setting.timeSetting("network.tcp.connect_timeout", new TimeValue(30, TimeUnit.SECONDS), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_NO_DELAY =
|
||||
Setting.boolSetting("network.tcp.no_delay", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> TCP_KEEP_ALIVE =
|
||||
Setting.boolSetting("network.tcp.keep_alive", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> TCP_REUSE_ADDRESS =
|
||||
Setting.boolSetting("network.tcp.reuse_address", NetworkUtils.defaultReuseAddress(), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> TCP_SEND_BUFFER_SIZE =
|
||||
Setting.byteSizeSetting("network.tcp.send_buffer_size", new ByteSizeValue(-1), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> TCP_RECEIVE_BUFFER_SIZE =
|
||||
Setting.byteSizeSetting("network.tcp.receive_buffer_size", new ByteSizeValue(-1), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> TCP_BLOCKING =
|
||||
Setting.boolSetting("network.tcp.blocking", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> TCP_BLOCKING_SERVER =
|
||||
Setting.boolSetting("network.tcp.blocking_server", TCP_BLOCKING, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> TCP_BLOCKING_CLIENT =
|
||||
Setting.boolSetting("network.tcp.blocking_client", TCP_BLOCKING, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> TCP_CONNECT_TIMEOUT =
|
||||
Setting.timeSetting("network.tcp.connect_timeout", new TimeValue(30, TimeUnit.SECONDS), false, SettingsProperty.ClusterScope);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.common.settings;
|
|||
import org.elasticsearch.ExceptionsHelper;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.util.set.Sets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -45,19 +44,19 @@ public abstract class AbstractScopedSettings extends AbstractComponent {
|
|||
private final List<SettingUpdater<?>> settingUpdaters = new CopyOnWriteArrayList<>();
|
||||
private final Map<String, Setting<?>> complexMatchers;
|
||||
private final Map<String, Setting<?>> keySettings;
|
||||
private final Setting.Scope scope;
|
||||
private final Setting.SettingsProperty scope;
|
||||
private static final Pattern KEY_PATTERN = Pattern.compile("^(?:[-\\w]+[.])*[-\\w]+$");
|
||||
private static final Pattern GROUP_KEY_PATTERN = Pattern.compile("^(?:[-\\w]+[.])+$");
|
||||
|
||||
protected AbstractScopedSettings(Settings settings, Set<Setting<?>> settingsSet, Setting.Scope scope) {
|
||||
protected AbstractScopedSettings(Settings settings, Set<Setting<?>> settingsSet, Setting.SettingsProperty scope) {
|
||||
super(settings);
|
||||
this.lastSettingsApplied = Settings.EMPTY;
|
||||
this.scope = scope;
|
||||
Map<String, Setting<?>> complexMatchers = new HashMap<>();
|
||||
Map<String, Setting<?>> keySettings = new HashMap<>();
|
||||
for (Setting<?> setting : settingsSet) {
|
||||
if (setting.getScope() != scope) {
|
||||
throw new IllegalArgumentException("Setting must be a " + scope + " setting but was: " + setting.getScope());
|
||||
if (setting.getProperties().contains(scope) == false) {
|
||||
throw new IllegalArgumentException("Setting must be a " + scope + " setting but has: " + setting.getProperties());
|
||||
}
|
||||
if (isValidKey(setting.getKey()) == false && (setting.isGroupSetting() && isValidGroupKey(setting.getKey())) == false) {
|
||||
throw new IllegalArgumentException("illegal settings key: [" + setting.getKey() + "]");
|
||||
|
@ -92,7 +91,7 @@ public abstract class AbstractScopedSettings extends AbstractComponent {
|
|||
return GROUP_KEY_PATTERN.matcher(key).matches();
|
||||
}
|
||||
|
||||
public Setting.Scope getScope() {
|
||||
public Setting.SettingsProperty getScope() {
|
||||
return this.scope;
|
||||
}
|
||||
|
||||
|
@ -325,8 +324,9 @@ public abstract class AbstractScopedSettings extends AbstractComponent {
|
|||
* Returns the value for the given setting.
|
||||
*/
|
||||
public <T> T get(Setting<T> setting) {
|
||||
if (setting.getScope() != scope) {
|
||||
throw new IllegalArgumentException("settings scope doesn't match the setting scope [" + this.scope + "] != [" + setting.getScope() + "]");
|
||||
if (setting.getProperties().contains(scope) == false) {
|
||||
throw new IllegalArgumentException("settings scope doesn't match the setting scope [" + this.scope + "] not in [" +
|
||||
setting.getProperties() + "]");
|
||||
}
|
||||
if (get(setting.getKey()) == null) {
|
||||
throw new IllegalArgumentException("setting " + setting.getKey() + " has not been registered");
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.elasticsearch.cluster.service.InternalClusterService;
|
|||
import org.elasticsearch.common.logging.ESLoggerFactory;
|
||||
import org.elasticsearch.common.network.NetworkModule;
|
||||
import org.elasticsearch.common.network.NetworkService;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.discovery.DiscoveryModule;
|
||||
|
@ -102,7 +103,7 @@ import java.util.function.Predicate;
|
|||
*/
|
||||
public final class ClusterSettings extends AbstractScopedSettings {
|
||||
public ClusterSettings(Settings nodeSettings, Set<Setting<?>> settingsSet) {
|
||||
super(nodeSettings, settingsSet, Setting.Scope.CLUSTER);
|
||||
super(nodeSettings, settingsSet, SettingsProperty.ClusterScope);
|
||||
addSettingsUpdater(new LoggingSettingUpdater(nodeSettings));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData;
|
|||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.ShardsLimitAllocationDecider;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.gateway.PrimaryShardAllocator;
|
||||
import org.elasticsearch.index.IndexModule;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
|
@ -49,7 +50,7 @@ import java.util.function.Predicate;
|
|||
|
||||
/**
|
||||
* Encapsulates all valid index level settings.
|
||||
* @see org.elasticsearch.common.settings.Setting.Scope#INDEX
|
||||
* @see org.elasticsearch.common.settings.Setting.SettingsProperty#IndexScope
|
||||
*/
|
||||
public final class IndexScopedSettings extends AbstractScopedSettings {
|
||||
|
||||
|
@ -134,15 +135,15 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
|
|||
EngineConfig.INDEX_CODEC_SETTING,
|
||||
IndexWarmer.INDEX_NORMS_LOADING_SETTING,
|
||||
// this sucks but we can't really validate all the analyzers/similarity in here
|
||||
Setting.groupSetting("index.similarity.", false, Setting.Scope.INDEX), // this allows similarity settings to be passed
|
||||
Setting.groupSetting("index.analysis.", false, Setting.Scope.INDEX) // this allows analysis settings to be passed
|
||||
Setting.groupSetting("index.similarity.", false, SettingsProperty.IndexScope), // this allows similarity settings to be passed
|
||||
Setting.groupSetting("index.analysis.", false, SettingsProperty.IndexScope) // this allows analysis settings to be passed
|
||||
|
||||
)));
|
||||
|
||||
public static final IndexScopedSettings DEFAULT_SCOPED_SETTINGS = new IndexScopedSettings(Settings.EMPTY, IndexScopedSettings.BUILT_IN_INDEX_SETTINGS);
|
||||
|
||||
public IndexScopedSettings(Settings settings, Set<Setting<?>> settingsSet) {
|
||||
super(settings, settingsSet, Setting.Scope.INDEX);
|
||||
super(settings, settingsSet, SettingsProperty.IndexScope);
|
||||
}
|
||||
|
||||
private IndexScopedSettings(Settings settings, IndexScopedSettings other, IndexMetaData metaData) {
|
||||
|
|
|
@ -35,6 +35,8 @@ import org.elasticsearch.common.xcontent.XContentType;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.BiConsumer;
|
||||
|
@ -50,7 +52,7 @@ import java.util.stream.Collectors;
|
|||
* together with {@link AbstractScopedSettings}. This class contains several utility methods that makes it straight forward
|
||||
* to add settings for the majority of the cases. For instance a simple boolean settings can be defined like this:
|
||||
* <pre>{@code
|
||||
* public static final Setting<Boolean>; MY_BOOLEAN = Setting.boolSetting("my.bool.setting", true, false, Scope.CLUSTER);}
|
||||
* public static final Setting<Boolean>; MY_BOOLEAN = Setting.boolSetting("my.bool.setting", true, false, SettingsProperty.ClusterScope);}
|
||||
* </pre>
|
||||
* To retrieve the value of the setting a {@link Settings} object can be passed directly to the {@link Setting#get(Settings)} method.
|
||||
* <pre>
|
||||
|
@ -61,29 +63,26 @@ import java.util.stream.Collectors;
|
|||
* public enum Color {
|
||||
* RED, GREEN, BLUE;
|
||||
* }
|
||||
* public static final Setting<Color> MY_BOOLEAN = new Setting<>("my.color.setting", Color.RED.toString(), Color::valueOf, false, Scope.CLUSTER);
|
||||
* public static final Setting<Color> MY_BOOLEAN =
|
||||
* new Setting<>("my.color.setting", Color.RED.toString(), Color::valueOf, false, SettingsProperty.ClusterScope);
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class Setting<T> extends ToXContentToBytes {
|
||||
|
||||
public enum SettingsProperty {
|
||||
Filtered,
|
||||
Dynamic,
|
||||
ClusterScope,
|
||||
NodeScope,
|
||||
IndexScope;
|
||||
}
|
||||
|
||||
private final String key;
|
||||
protected final Function<Settings, String> defaultValue;
|
||||
private final Function<String, T> parser;
|
||||
private final boolean dynamic;
|
||||
private final Scope scope;
|
||||
private final boolean filtered;
|
||||
|
||||
/**
|
||||
* Creates a new Setting instance, unfiltered
|
||||
* @param key the settings key for this setting.
|
||||
* @param defaultValue a default value function that returns the default values string representation.
|
||||
* @param parser a parser that parses the string rep into a complex datatype.
|
||||
* @param dynamic true iff this setting can be dynamically updateable
|
||||
* @param scope the scope of this setting
|
||||
*/
|
||||
public Setting(String key, Function<Settings, String> defaultValue, Function<String, T> parser, boolean dynamic, Scope scope) {
|
||||
this(key, defaultValue, parser, dynamic, scope, false);
|
||||
}
|
||||
private final EnumSet<SettingsProperty> properties;
|
||||
|
||||
/**
|
||||
* Creates a new Setting instance
|
||||
|
@ -91,30 +90,32 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
* @param defaultValue a default value function that returns the default values string representation.
|
||||
* @param parser a parser that parses the string rep into a complex datatype.
|
||||
* @param dynamic true iff this setting can be dynamically updateable
|
||||
* @param scope the scope of this setting
|
||||
* @param filtered true if this setting should be filtered
|
||||
* @param properties properties for this setting like scope, filtering...
|
||||
*/
|
||||
public Setting(String key, Function<Settings, String> defaultValue, Function<String, T> parser, boolean dynamic, Scope scope,
|
||||
boolean filtered) {
|
||||
public Setting(String key, Function<Settings, String> defaultValue, Function<String, T> parser, boolean dynamic,
|
||||
SettingsProperty... properties) {
|
||||
assert parser.apply(defaultValue.apply(Settings.EMPTY)) != null || this.isGroupSetting(): "parser returned null";
|
||||
this.key = key;
|
||||
this.defaultValue = defaultValue;
|
||||
this.parser = parser;
|
||||
this.dynamic = dynamic;
|
||||
this.scope = scope;
|
||||
this.filtered = filtered;
|
||||
if (properties.length == 0) {
|
||||
this.properties = EnumSet.of(SettingsProperty.NodeScope);
|
||||
} else {
|
||||
this.properties = EnumSet.copyOf(Arrays.asList(properties));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Setting instance, unfiltered
|
||||
* Creates a new Setting instance
|
||||
* @param key the settings key for this setting.
|
||||
* @param fallBackSetting a setting to fall back to if the current setting is not set.
|
||||
* @param defaultValue a default value.
|
||||
* @param parser a parser that parses the string rep into a complex datatype.
|
||||
* @param dynamic true iff this setting can be dynamically updateable
|
||||
* @param scope the scope of this setting
|
||||
* @param properties properties for this setting like scope, filtering...
|
||||
*/
|
||||
public Setting(String key, Setting<T> fallBackSetting, Function<String, T> parser, boolean dynamic, Scope scope) {
|
||||
this(key, fallBackSetting, parser, dynamic, scope, false);
|
||||
public Setting(String key, String defaultValue, Function<String, T> parser, boolean dynamic, SettingsProperty... properties) {
|
||||
this(key, s -> defaultValue, parser, dynamic, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,11 +124,10 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
* @param fallBackSetting a setting to fall back to if the current setting is not set.
|
||||
* @param parser a parser that parses the string rep into a complex datatype.
|
||||
* @param dynamic true iff this setting can be dynamically updateable
|
||||
* @param scope the scope of this setting
|
||||
* @param filtered true if this setting should be filtered
|
||||
* @param properties properties for this setting like scope, filtering...
|
||||
*/
|
||||
public Setting(String key, Setting<T> fallBackSetting, Function<String, T> parser, boolean dynamic, Scope scope, boolean filtered) {
|
||||
this(key, fallBackSetting::getRaw, parser, dynamic, scope, filtered);
|
||||
public Setting(String key, Setting<T> fallBackSetting, Function<String, T> parser, boolean dynamic, SettingsProperty... properties) {
|
||||
this(key, fallBackSetting::getRaw, parser, dynamic, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,17 +149,39 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the settings scope
|
||||
* Returns the setting properties
|
||||
* @see SettingsProperty
|
||||
*/
|
||||
public final Scope getScope() {
|
||||
return scope;
|
||||
public EnumSet<SettingsProperty> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if this setting must be filtered, otherwise <code>false</code>
|
||||
*/
|
||||
public boolean isFiltered() {
|
||||
return filtered;
|
||||
return properties.contains(SettingsProperty.Filtered);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if this setting has a cluster scope, otherwise <code>false</code>
|
||||
*/
|
||||
public boolean hasClusterScope() {
|
||||
return properties.contains(SettingsProperty.ClusterScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if this setting has an index scope, otherwise <code>false</code>
|
||||
*/
|
||||
public boolean hasIndexScope() {
|
||||
return properties.contains(SettingsProperty.IndexScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if this setting has an index scope, otherwise <code>false</code>
|
||||
*/
|
||||
public boolean hasNodeScope() {
|
||||
return properties.contains(SettingsProperty.NodeScope);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,7 +260,7 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
public final XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject();
|
||||
builder.field("key", key);
|
||||
builder.field("type", scope.name());
|
||||
builder.field("properties", properties);
|
||||
builder.field("dynamic", dynamic);
|
||||
builder.field("is_group_setting", isGroupSetting());
|
||||
builder.field("default", defaultValue.apply(Settings.EMPTY));
|
||||
|
@ -261,14 +283,6 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The settings scope - settings can either be cluster settings or per index settings.
|
||||
*/
|
||||
public enum Scope {
|
||||
CLUSTER,
|
||||
INDEX;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a new updater with a noop validator.
|
||||
*/
|
||||
|
@ -366,50 +380,35 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
}
|
||||
|
||||
|
||||
public Setting(String key, String defaultValue, Function<String, T> parser, boolean dynamic, Scope scope) {
|
||||
this(key, defaultValue, parser, dynamic, scope, false);
|
||||
public static Setting<Float> floatSetting(String key, float defaultValue, boolean dynamic, SettingsProperty... properties) {
|
||||
return new Setting<>(key, (s) -> Float.toString(defaultValue), Float::parseFloat, dynamic, properties);
|
||||
}
|
||||
|
||||
public Setting(String key, String defaultValue, Function<String, T> parser, boolean dynamic, Scope scope, boolean filtered) {
|
||||
this(key, (s) -> defaultValue, parser, dynamic, scope, filtered);
|
||||
}
|
||||
|
||||
public static Setting<Float> floatSetting(String key, float defaultValue, boolean dynamic, Scope scope) {
|
||||
return new Setting<>(key, (s) -> Float.toString(defaultValue), Float::parseFloat, dynamic, scope);
|
||||
}
|
||||
|
||||
public static Setting<Float> floatSetting(String key, float defaultValue, float minValue, boolean dynamic, Scope scope) {
|
||||
public static Setting<Float> floatSetting(String key, float defaultValue, float minValue, boolean dynamic, SettingsProperty... properties) {
|
||||
return new Setting<>(key, (s) -> Float.toString(defaultValue), (s) -> {
|
||||
float value = Float.parseFloat(s);
|
||||
if (value < minValue) {
|
||||
throw new IllegalArgumentException("Failed to parse value [" + s + "] for setting [" + key + "] must be >= " + minValue);
|
||||
}
|
||||
return value;
|
||||
}, dynamic, scope);
|
||||
}, dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<Integer> intSetting(String key, int defaultValue, int minValue, int maxValue, boolean dynamic, Scope scope) {
|
||||
return new Setting<>(key, (s) -> Integer.toString(defaultValue), (s) -> parseInt(s, minValue, maxValue, key), dynamic, scope);
|
||||
public static Setting<Integer> intSetting(String key, int defaultValue, int minValue, int maxValue, boolean dynamic,
|
||||
SettingsProperty... properties) {
|
||||
return new Setting<>(key, (s) -> Integer.toString(defaultValue), (s) -> parseInt(s, minValue, maxValue, key), dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<Integer> intSetting(String key, int defaultValue, int minValue, boolean dynamic, Scope scope) {
|
||||
return new Setting<>(key, (s) -> Integer.toString(defaultValue), (s) -> parseInt(s, minValue, key), dynamic, scope);
|
||||
public static Setting<Integer> intSetting(String key, int defaultValue, int minValue, boolean dynamic, SettingsProperty... properties) {
|
||||
return new Setting<>(key, (s) -> Integer.toString(defaultValue), (s) -> parseInt(s, minValue, key), dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<Long> longSetting(String key, long defaultValue, long minValue, boolean dynamic, Scope scope) {
|
||||
return longSetting(key, defaultValue, minValue, dynamic, scope, false);
|
||||
public static Setting<Long> longSetting(String key, long defaultValue, long minValue, boolean dynamic, SettingsProperty... properties) {
|
||||
return new Setting<>(key, (s) -> Long.toString(defaultValue), (s) -> parseLong(s, minValue, key), dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<Long> longSetting(String key, long defaultValue, long minValue, boolean dynamic, Scope scope, boolean filtered) {
|
||||
return new Setting<>(key, (s) -> Long.toString(defaultValue), (s) -> parseLong(s, minValue, key), dynamic, scope, filtered);
|
||||
}
|
||||
|
||||
public static Setting<String> simpleString(String key, boolean dynamic, Scope scope) {
|
||||
return simpleString(key, dynamic, scope, false);
|
||||
}
|
||||
|
||||
public static Setting<String> simpleString(String key, boolean dynamic, Scope scope, boolean filtered) {
|
||||
return new Setting<>(key, s -> "", Function.identity(), dynamic, scope, filtered);
|
||||
public static Setting<String> simpleString(String key, boolean dynamic, SettingsProperty... properties) {
|
||||
return new Setting<>(key, s -> "", Function.identity(), dynamic, properties);
|
||||
}
|
||||
|
||||
public static int parseInt(String s, int minValue, String key) {
|
||||
|
@ -435,55 +434,58 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
return value;
|
||||
}
|
||||
|
||||
public static Setting<Integer> intSetting(String key, int defaultValue, boolean dynamic, Scope scope) {
|
||||
return intSetting(key, defaultValue, Integer.MIN_VALUE, dynamic, scope);
|
||||
public static Setting<Integer> intSetting(String key, int defaultValue, boolean dynamic, SettingsProperty... properties) {
|
||||
return intSetting(key, defaultValue, Integer.MIN_VALUE, dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<Boolean> boolSetting(String key, boolean defaultValue, boolean dynamic, Scope scope) {
|
||||
return boolSetting(key, defaultValue, dynamic, scope, false);
|
||||
public static Setting<Boolean> boolSetting(String key, boolean defaultValue, boolean dynamic, SettingsProperty... properties) {
|
||||
return new Setting<>(key, (s) -> Boolean.toString(defaultValue), Booleans::parseBooleanExact, dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<Boolean> boolSetting(String key, boolean defaultValue, boolean dynamic, Scope scope, boolean filtered) {
|
||||
return new Setting<>(key, (s) -> Boolean.toString(defaultValue), Booleans::parseBooleanExact, dynamic, scope, filtered);
|
||||
public static Setting<Boolean> boolSetting(String key, Setting<Boolean> fallbackSetting, boolean dynamic,
|
||||
SettingsProperty... properties) {
|
||||
return new Setting<>(key, fallbackSetting, Booleans::parseBooleanExact, dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<Boolean> boolSetting(String key, Setting<Boolean> fallbackSetting, boolean dynamic, Scope scope) {
|
||||
return new Setting<>(key, fallbackSetting, Booleans::parseBooleanExact, dynamic, scope);
|
||||
public static Setting<ByteSizeValue> byteSizeSetting(String key, String percentage, boolean dynamic, SettingsProperty... properties) {
|
||||
return new Setting<>(key, (s) -> percentage, (s) -> MemorySizeValue.parseBytesSizeValueOrHeapRatio(s, key), dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<ByteSizeValue> byteSizeSetting(String key, String percentage, boolean dynamic, Scope scope) {
|
||||
return new Setting<>(key, (s) -> percentage, (s) -> MemorySizeValue.parseBytesSizeValueOrHeapRatio(s, key), dynamic, scope);
|
||||
public static Setting<ByteSizeValue> byteSizeSetting(String key, ByteSizeValue value, boolean dynamic, SettingsProperty... properties) {
|
||||
return byteSizeSetting(key, (s) -> value.toString(), dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<ByteSizeValue> byteSizeSetting(String key, ByteSizeValue value, boolean dynamic, Scope scope) {
|
||||
return byteSizeSetting(key, (s) -> value.toString(), dynamic, scope);
|
||||
public static Setting<ByteSizeValue> byteSizeSetting(String key, Setting<ByteSizeValue> fallbackSettings, boolean dynamic,
|
||||
SettingsProperty... properties) {
|
||||
return byteSizeSetting(key, fallbackSettings::getRaw, dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<ByteSizeValue> byteSizeSetting(String key, Setting<ByteSizeValue> fallbackSettings, boolean dynamic, Scope scope) {
|
||||
return byteSizeSetting(key, fallbackSettings::getRaw, dynamic, scope);
|
||||
public static Setting<ByteSizeValue> byteSizeSetting(String key, Function<Settings, String> defaultValue, boolean dynamic,
|
||||
SettingsProperty... properties) {
|
||||
return new Setting<>(key, defaultValue, (s) -> ByteSizeValue.parseBytesSizeValue(s, key), dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<ByteSizeValue> byteSizeSetting(String key, Function<Settings, String> defaultValue, boolean dynamic, Scope scope) {
|
||||
return new Setting<>(key, defaultValue, (s) -> ByteSizeValue.parseBytesSizeValue(s, key), dynamic, scope);
|
||||
public static Setting<TimeValue> positiveTimeSetting(String key, TimeValue defaultValue, boolean dynamic, SettingsProperty... properties) {
|
||||
return timeSetting(key, defaultValue, TimeValue.timeValueMillis(0), dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<TimeValue> positiveTimeSetting(String key, TimeValue defaultValue, boolean dynamic, Scope scope) {
|
||||
return timeSetting(key, defaultValue, TimeValue.timeValueMillis(0), dynamic, scope);
|
||||
public static <T> Setting<List<T>> listSetting(String key, List<String> defaultStringValue, Function<String, T> singleValueParser,
|
||||
boolean dynamic, SettingsProperty... properties) {
|
||||
return listSetting(key, (s) -> defaultStringValue, singleValueParser, dynamic, properties);
|
||||
}
|
||||
|
||||
public static <T> Setting<List<T>> listSetting(String key, List<String> defaultStringValue, Function<String, T> singleValueParser, boolean dynamic, Scope scope) {
|
||||
return listSetting(key, (s) -> defaultStringValue, singleValueParser, dynamic, scope);
|
||||
public static <T> Setting<List<T>> listSetting(String key, Setting<List<T>> fallbackSetting, Function<String, T> singleValueParser,
|
||||
boolean dynamic, SettingsProperty... properties) {
|
||||
return listSetting(key, (s) -> parseableStringToList(fallbackSetting.getRaw(s)), singleValueParser, dynamic, properties);
|
||||
}
|
||||
|
||||
public static <T> Setting<List<T>> listSetting(String key, Setting<List<T>> fallbackSetting, Function<String, T> singleValueParser, boolean dynamic, Scope scope) {
|
||||
return listSetting(key, (s) -> parseableStringToList(fallbackSetting.getRaw(s)), singleValueParser, dynamic, scope);
|
||||
}
|
||||
|
||||
public static <T> Setting<List<T>> listSetting(String key, Function<Settings, List<String>> defaultStringValue, Function<String, T> singleValueParser, boolean dynamic, Scope scope) {
|
||||
public static <T> Setting<List<T>> listSetting(String key, Function<Settings, List<String>> defaultStringValue,
|
||||
Function<String, T> singleValueParser, boolean dynamic, SettingsProperty... properties) {
|
||||
Function<String, List<T>> parser = (s) ->
|
||||
parseableStringToList(s).stream().map(singleValueParser).collect(Collectors.toList());
|
||||
|
||||
return new Setting<List<T>>(key, (s) -> arrayToParsableString(defaultStringValue.apply(s).toArray(Strings.EMPTY_ARRAY)), parser, dynamic, scope) {
|
||||
return new Setting<List<T>>(key, (s) -> arrayToParsableString(defaultStringValue.apply(s).toArray(Strings.EMPTY_ARRAY)), parser,
|
||||
dynamic, properties) {
|
||||
private final Pattern pattern = Pattern.compile(Pattern.quote(key)+"(\\.\\d+)?");
|
||||
@Override
|
||||
public String getRaw(Settings settings) {
|
||||
|
@ -537,11 +539,11 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
}
|
||||
}
|
||||
|
||||
public static Setting<Settings> groupSetting(String key, boolean dynamic, Scope scope) {
|
||||
public static Setting<Settings> groupSetting(String key, boolean dynamic, SettingsProperty... properties) {
|
||||
if (key.endsWith(".") == false) {
|
||||
throw new IllegalArgumentException("key must end with a '.'");
|
||||
}
|
||||
return new Setting<Settings>(key, "", (s) -> null, dynamic, scope) {
|
||||
return new Setting<Settings>(key, "", (s) -> null, dynamic, properties) {
|
||||
|
||||
@Override
|
||||
public boolean isGroupSetting() {
|
||||
|
@ -600,36 +602,40 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
};
|
||||
}
|
||||
|
||||
public static Setting<TimeValue> timeSetting(String key, Function<Settings, String> defaultValue, TimeValue minValue, boolean dynamic, Scope scope) {
|
||||
public static Setting<TimeValue> timeSetting(String key, Function<Settings, String> defaultValue, TimeValue minValue, boolean dynamic,
|
||||
SettingsProperty... properties) {
|
||||
return new Setting<>(key, defaultValue, (s) -> {
|
||||
TimeValue timeValue = TimeValue.parseTimeValue(s, null, key);
|
||||
if (timeValue.millis() < minValue.millis()) {
|
||||
throw new IllegalArgumentException("Failed to parse value [" + s + "] for setting [" + key + "] must be >= " + minValue);
|
||||
}
|
||||
return timeValue;
|
||||
}, dynamic, scope);
|
||||
}, dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<TimeValue> timeSetting(String key, TimeValue defaultValue, TimeValue minValue, boolean dynamic, Scope scope) {
|
||||
return timeSetting(key, (s) -> defaultValue.getStringRep(), minValue, dynamic, scope);
|
||||
public static Setting<TimeValue> timeSetting(String key, TimeValue defaultValue, TimeValue minValue, boolean dynamic,
|
||||
SettingsProperty... properties) {
|
||||
return timeSetting(key, (s) -> defaultValue.getStringRep(), minValue, dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<TimeValue> timeSetting(String key, TimeValue defaultValue, boolean dynamic, Scope scope) {
|
||||
return new Setting<>(key, (s) -> defaultValue.toString(), (s) -> TimeValue.parseTimeValue(s, key), dynamic, scope);
|
||||
public static Setting<TimeValue> timeSetting(String key, TimeValue defaultValue, boolean dynamic, SettingsProperty... properties) {
|
||||
return new Setting<>(key, (s) -> defaultValue.toString(), (s) -> TimeValue.parseTimeValue(s, key), dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<TimeValue> timeSetting(String key, Setting<TimeValue> fallbackSetting, boolean dynamic, Scope scope) {
|
||||
return new Setting<>(key, fallbackSetting::getRaw, (s) -> TimeValue.parseTimeValue(s, key), dynamic, scope);
|
||||
public static Setting<TimeValue> timeSetting(String key, Setting<TimeValue> fallbackSetting, boolean dynamic,
|
||||
SettingsProperty... properties) {
|
||||
return new Setting<>(key, fallbackSetting::getRaw, (s) -> TimeValue.parseTimeValue(s, key), dynamic, properties);
|
||||
}
|
||||
|
||||
public static Setting<Double> doubleSetting(String key, double defaultValue, double minValue, boolean dynamic, Scope scope) {
|
||||
public static Setting<Double> doubleSetting(String key, double defaultValue, double minValue, boolean dynamic,
|
||||
SettingsProperty... properties) {
|
||||
return new Setting<>(key, (s) -> Double.toString(defaultValue), (s) -> {
|
||||
final double d = Double.parseDouble(s);
|
||||
if (d < minValue) {
|
||||
throw new IllegalArgumentException("Failed to parse value [" + s + "] for setting [" + key + "] must be >= " + minValue);
|
||||
}
|
||||
return d;
|
||||
}, dynamic, scope);
|
||||
}, dynamic, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -650,8 +656,9 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
* can easily be added with this setting. Yet, dynamic key settings don't support updaters our of the box unless {@link #getConcreteSetting(String)}
|
||||
* is used to pull the updater.
|
||||
*/
|
||||
public static <T> Setting<T> dynamicKeySetting(String key, String defaultValue, Function<String, T> parser, boolean dynamic, Scope scope) {
|
||||
return new Setting<T>(key, defaultValue, parser, dynamic, scope) {
|
||||
public static <T> Setting<T> dynamicKeySetting(String key, String defaultValue, Function<String, T> parser, boolean dynamic,
|
||||
SettingsProperty... properties) {
|
||||
return new Setting<T>(key, defaultValue, parser, dynamic, properties) {
|
||||
|
||||
@Override
|
||||
boolean isGroupSetting() {
|
||||
|
@ -671,7 +678,7 @@ public class Setting<T> extends ToXContentToBytes {
|
|||
@Override
|
||||
public Setting<T> getConcreteSetting(String key) {
|
||||
if (match(key)) {
|
||||
return new Setting<>(key, defaultValue, parser, dynamic, scope);
|
||||
return new Setting<>(key, defaultValue, parser, dynamic, properties);
|
||||
} else {
|
||||
throw new IllegalArgumentException("key must match setting but didn't ["+key +"]");
|
||||
}
|
||||
|
|
|
@ -76,19 +76,17 @@ public class SettingsModule extends AbstractModule {
|
|||
registerSettingsFilter(setting.getKey());
|
||||
}
|
||||
}
|
||||
switch (setting.getScope()) {
|
||||
case CLUSTER:
|
||||
if (clusterSettings.containsKey(setting.getKey())) {
|
||||
throw new IllegalArgumentException("Cannot register setting [" + setting.getKey() + "] twice");
|
||||
}
|
||||
clusterSettings.put(setting.getKey(), setting);
|
||||
break;
|
||||
case INDEX:
|
||||
if (indexSettings.containsKey(setting.getKey())) {
|
||||
throw new IllegalArgumentException("Cannot register setting [" + setting.getKey() + "] twice");
|
||||
}
|
||||
indexSettings.put(setting.getKey(), setting);
|
||||
break;
|
||||
if (setting.hasClusterScope()) {
|
||||
if (clusterSettings.containsKey(setting.getKey())) {
|
||||
throw new IllegalArgumentException("Cannot register setting [" + setting.getKey() + "] twice");
|
||||
}
|
||||
clusterSettings.put(setting.getKey(), setting);
|
||||
}
|
||||
if (setting.hasIndexScope()) {
|
||||
if (indexSettings.containsKey(setting.getKey())) {
|
||||
throw new IllegalArgumentException("Cannot register setting [" + setting.getKey() + "] twice");
|
||||
}
|
||||
indexSettings.put(setting.getKey(), setting);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,11 +108,11 @@ public class SettingsModule extends AbstractModule {
|
|||
* Check if a setting has already been registered
|
||||
*/
|
||||
public boolean exists(Setting<?> setting) {
|
||||
switch (setting.getScope()) {
|
||||
case CLUSTER:
|
||||
return clusterSettings.containsKey(setting.getKey());
|
||||
case INDEX:
|
||||
return indexSettings.containsKey(setting.getKey());
|
||||
if (setting.hasClusterScope()) {
|
||||
return clusterSettings.containsKey(setting.getKey());
|
||||
}
|
||||
if (setting.hasIndexScope()) {
|
||||
return indexSettings.containsKey(setting.getKey());
|
||||
}
|
||||
throw new IllegalArgumentException("setting scope is unknown. This should never happen!");
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.elasticsearch.common.util.concurrent;
|
||||
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -41,7 +42,8 @@ public class EsExecutors {
|
|||
* Settings key to manually set the number of available processors.
|
||||
* This is used to adjust thread pools sizes etc. per node.
|
||||
*/
|
||||
public static final Setting<Integer> PROCESSORS_SETTING = Setting.intSetting("processors", Math.min(32, Runtime.getRuntime().availableProcessors()), 1, false, Setting.Scope.CLUSTER) ;
|
||||
public static final Setting<Integer> PROCESSORS_SETTING =
|
||||
Setting.intSetting("processors", Math.min(32, Runtime.getRuntime().availableProcessors()), 1, false, SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* Returns the number of processors available but at most <tt>32</tt>.
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
@ -63,7 +64,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
public final class ThreadContext implements Closeable, Writeable<ThreadContext.ThreadContextStruct>{
|
||||
|
||||
public static final String PREFIX = "request.headers";
|
||||
public static final Setting<Settings> DEFAULT_HEADERS_SETTING = Setting.groupSetting(PREFIX + ".", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Settings> DEFAULT_HEADERS_SETTING =
|
||||
Setting.groupSetting(PREFIX + ".", false, SettingsProperty.ClusterScope);
|
||||
private final Map<String, String> defaultHeader;
|
||||
private static final ThreadContextStruct DEFAULT_CONTEXT = new ThreadContextStruct(Collections.emptyMap());
|
||||
private final ContextThreadLocal threadLocal;
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
import org.elasticsearch.common.inject.multibindings.Multibinder;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.ExtensionPoint;
|
||||
import org.elasticsearch.discovery.local.LocalDiscovery;
|
||||
|
@ -44,10 +45,11 @@ import java.util.function.Function;
|
|||
*/
|
||||
public class DiscoveryModule extends AbstractModule {
|
||||
|
||||
public static final Setting<String> DISCOVERY_TYPE_SETTING = new Setting<>("discovery.type",
|
||||
settings -> DiscoveryNode.localNode(settings) ? "local" : "zen", Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> ZEN_MASTER_SERVICE_TYPE_SETTING = new Setting<>("discovery.zen.masterservice.type",
|
||||
"zen", Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> DISCOVERY_TYPE_SETTING =
|
||||
new Setting<>("discovery.type", settings -> DiscoveryNode.localNode(settings) ? "local" : "zen", Function.identity(), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> ZEN_MASTER_SERVICE_TYPE_SETTING =
|
||||
new Setting<>("discovery.zen.masterservice.type", "zen", Function.identity(), false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final Settings settings;
|
||||
private final List<Class<? extends UnicastHostsProvider>> unicastHostProviders = new ArrayList<>();
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.Strings;
|
|||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
||||
|
@ -40,8 +41,11 @@ import java.util.concurrent.TimeUnit;
|
|||
*/
|
||||
public class DiscoveryService extends AbstractLifecycleComponent<DiscoveryService> {
|
||||
|
||||
public static final Setting<TimeValue> INITIAL_STATE_TIMEOUT_SETTING = Setting.positiveTimeSetting("discovery.initial_state_timeout", TimeValue.timeValueSeconds(30), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Long> DISCOVERY_SEED_SETTING = Setting.longSetting("discovery.id.seed", 0L, Long.MIN_VALUE, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INITIAL_STATE_TIMEOUT_SETTING =
|
||||
Setting.positiveTimeSetting("discovery.initial_state_timeout", TimeValue.timeValueSeconds(30), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static final Setting<Long> DISCOVERY_SEED_SETTING =
|
||||
Setting.longSetting("discovery.id.seed", 0L, Long.MIN_VALUE, false, SettingsProperty.ClusterScope);
|
||||
|
||||
private static class InitialStateListener implements InitialStateDiscoveryListener {
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.common.component.AbstractComponent;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
|
@ -43,15 +44,21 @@ public class DiscoverySettings extends AbstractComponent {
|
|||
* sets the timeout for a complete publishing cycle, including both sending and committing. the master
|
||||
* will continue to process the next cluster state update after this time has elapsed
|
||||
**/
|
||||
public static final Setting<TimeValue> PUBLISH_TIMEOUT_SETTING = Setting.positiveTimeSetting("discovery.zen.publish_timeout", TimeValue.timeValueSeconds(30), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> PUBLISH_TIMEOUT_SETTING =
|
||||
Setting.positiveTimeSetting("discovery.zen.publish_timeout", TimeValue.timeValueSeconds(30), true, SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* sets the timeout for receiving enough acks for a specific cluster state and committing it. failing
|
||||
* to receive responses within this window will cause the cluster state change to be rejected.
|
||||
*/
|
||||
public static final Setting<TimeValue> COMMIT_TIMEOUT_SETTING = new Setting<>("discovery.zen.commit_timeout", (s) -> PUBLISH_TIMEOUT_SETTING.getRaw(s), (s) -> TimeValue.parseTimeValue(s, TimeValue.timeValueSeconds(30), "discovery.zen.commit_timeout"), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ClusterBlock> NO_MASTER_BLOCK_SETTING = new Setting<>("discovery.zen.no_master_block", "write", DiscoverySettings::parseNoMasterBlock, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> PUBLISH_DIFF_ENABLE_SETTING = Setting.boolSetting("discovery.zen.publish_diff.enable", true, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> COMMIT_TIMEOUT_SETTING =
|
||||
new Setting<>("discovery.zen.commit_timeout", (s) -> PUBLISH_TIMEOUT_SETTING.getRaw(s),
|
||||
(s) -> TimeValue.parseTimeValue(s, TimeValue.timeValueSeconds(30), "discovery.zen.commit_timeout"), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static final Setting<ClusterBlock> NO_MASTER_BLOCK_SETTING =
|
||||
new Setting<>("discovery.zen.no_master_block", "write", DiscoverySettings::parseNoMasterBlock, true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> PUBLISH_DIFF_ENABLE_SETTING =
|
||||
Setting.boolSetting("discovery.zen.publish_diff.enable", true, true, SettingsProperty.ClusterScope);
|
||||
|
||||
private volatile ClusterBlock noMasterBlock;
|
||||
private volatile TimeValue publishTimeout;
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.discovery.Discovery;
|
||||
|
@ -89,17 +90,28 @@ import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
|
|||
*/
|
||||
public class ZenDiscovery extends AbstractLifecycleComponent<Discovery> implements Discovery, PingContextProvider {
|
||||
|
||||
public final static Setting<TimeValue> PING_TIMEOUT_SETTING = Setting.positiveTimeSetting("discovery.zen.ping_timeout", timeValueSeconds(3), false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<TimeValue> JOIN_TIMEOUT_SETTING = Setting.timeSetting("discovery.zen.join_timeout",
|
||||
settings -> TimeValue.timeValueMillis(PING_TIMEOUT_SETTING.get(settings).millis() * 20).toString(), TimeValue.timeValueMillis(0), false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<Integer> JOIN_RETRY_ATTEMPTS_SETTING = Setting.intSetting("discovery.zen.join_retry_attempts", 3, 1, false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<TimeValue> JOIN_RETRY_DELAY_SETTING = Setting.positiveTimeSetting("discovery.zen.join_retry_delay", TimeValue.timeValueMillis(100), false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<Integer> MAX_PINGS_FROM_ANOTHER_MASTER_SETTING = Setting.intSetting("discovery.zen.max_pings_from_another_master", 3, 1, false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<Boolean> SEND_LEAVE_REQUEST_SETTING = Setting.boolSetting("discovery.zen.send_leave_request", true, false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<Boolean> MASTER_ELECTION_FILTER_CLIENT_SETTING = Setting.boolSetting("discovery.zen.master_election.filter_client", true, false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<TimeValue> MASTER_ELECTION_WAIT_FOR_JOINS_TIMEOUT_SETTING = Setting.timeSetting("discovery.zen.master_election.wait_for_joins_timeout",
|
||||
settings -> TimeValue.timeValueMillis(JOIN_TIMEOUT_SETTING.get(settings).millis() / 2).toString(), TimeValue.timeValueMillis(0), false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<Boolean> MASTER_ELECTION_FILTER_DATA_SETTING = Setting.boolSetting("discovery.zen.master_election.filter_data", false, false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<TimeValue> PING_TIMEOUT_SETTING =
|
||||
Setting.positiveTimeSetting("discovery.zen.ping_timeout", timeValueSeconds(3), false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<TimeValue> JOIN_TIMEOUT_SETTING =
|
||||
Setting.timeSetting("discovery.zen.join_timeout",
|
||||
settings -> TimeValue.timeValueMillis(PING_TIMEOUT_SETTING.get(settings).millis() * 20).toString(),
|
||||
TimeValue.timeValueMillis(0), false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<Integer> JOIN_RETRY_ATTEMPTS_SETTING =
|
||||
Setting.intSetting("discovery.zen.join_retry_attempts", 3, 1, false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<TimeValue> JOIN_RETRY_DELAY_SETTING =
|
||||
Setting.positiveTimeSetting("discovery.zen.join_retry_delay", TimeValue.timeValueMillis(100), false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<Integer> MAX_PINGS_FROM_ANOTHER_MASTER_SETTING =
|
||||
Setting.intSetting("discovery.zen.max_pings_from_another_master", 3, 1, false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<Boolean> SEND_LEAVE_REQUEST_SETTING =
|
||||
Setting.boolSetting("discovery.zen.send_leave_request", true, false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<Boolean> MASTER_ELECTION_FILTER_CLIENT_SETTING =
|
||||
Setting.boolSetting("discovery.zen.master_election.filter_client", true, false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<TimeValue> MASTER_ELECTION_WAIT_FOR_JOINS_TIMEOUT_SETTING =
|
||||
Setting.timeSetting("discovery.zen.master_election.wait_for_joins_timeout",
|
||||
settings -> TimeValue.timeValueMillis(JOIN_TIMEOUT_SETTING.get(settings).millis() / 2).toString(), TimeValue.timeValueMillis(0),
|
||||
false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<Boolean> MASTER_ELECTION_FILTER_DATA_SETTING =
|
||||
Setting.boolSetting("discovery.zen.master_election.filter_data", false, false, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final String DISCOVERY_REJOIN_ACTION_NAME = "internal:discovery/zen/rejoin";
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.CollectionUtils;
|
||||
|
||||
|
@ -40,7 +41,8 @@ import java.util.List;
|
|||
*/
|
||||
public class ElectMasterService extends AbstractComponent {
|
||||
|
||||
public static final Setting<Integer> DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING = Setting.intSetting("discovery.zen.minimum_master_nodes", -1, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING =
|
||||
Setting.intSetting("discovery.zen.minimum_master_nodes", -1, true, SettingsProperty.ClusterScope);
|
||||
|
||||
// This is the minimum version a master needs to be on, otherwise it gets ignored
|
||||
// This is based on the minimum compatible version of the current version this node is on
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.elasticsearch.cluster.ClusterName;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Scope;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
|
@ -37,11 +37,16 @@ import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
|
|||
*/
|
||||
public abstract class FaultDetection extends AbstractComponent {
|
||||
|
||||
public static final Setting<Boolean> CONNECT_ON_NETWORK_DISCONNECT_SETTING = Setting.boolSetting("discovery.zen.fd.connect_on_network_disconnect", false, false, Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> PING_INTERVAL_SETTING = Setting.positiveTimeSetting("discovery.zen.fd.ping_interval", timeValueSeconds(1), false, Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> PING_TIMEOUT_SETTING = Setting.timeSetting("discovery.zen.fd.ping_timeout", timeValueSeconds(30), false, Scope.CLUSTER);
|
||||
public static final Setting<Integer> PING_RETRIES_SETTING = Setting.intSetting("discovery.zen.fd.ping_retries", 3, false, Scope.CLUSTER);
|
||||
public static final Setting<Boolean> REGISTER_CONNECTION_LISTENER_SETTING = Setting.boolSetting("discovery.zen.fd.register_connection_listener", true, false, Scope.CLUSTER);
|
||||
public static final Setting<Boolean> CONNECT_ON_NETWORK_DISCONNECT_SETTING =
|
||||
Setting.boolSetting("discovery.zen.fd.connect_on_network_disconnect", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> PING_INTERVAL_SETTING =
|
||||
Setting.positiveTimeSetting("discovery.zen.fd.ping_interval", timeValueSeconds(1), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> PING_TIMEOUT_SETTING =
|
||||
Setting.timeSetting("discovery.zen.fd.ping_timeout", timeValueSeconds(30), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> PING_RETRIES_SETTING =
|
||||
Setting.intSetting("discovery.zen.fd.ping_retries", 3, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> REGISTER_CONNECTION_LISTENER_SETTING =
|
||||
Setting.boolSetting("discovery.zen.fd.register_connection_listener", true, false, SettingsProperty.ClusterScope);
|
||||
|
||||
protected final ThreadPool threadPool;
|
||||
protected final ClusterName clusterName;
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
@ -86,8 +87,11 @@ import static org.elasticsearch.discovery.zen.ping.ZenPing.PingResponse.readPing
|
|||
public class UnicastZenPing extends AbstractLifecycleComponent<ZenPing> implements ZenPing {
|
||||
|
||||
public static final String ACTION_NAME = "internal:discovery/zen/unicast";
|
||||
public static final Setting<List<String>> DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING = Setting.listSetting("discovery.zen.ping.unicast.hosts", Collections.emptyList(), Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING = Setting.intSetting("discovery.zen.ping.unicast.concurrent_connects", 10, 0, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<List<String>> DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING =
|
||||
Setting.listSetting("discovery.zen.ping.unicast.hosts", Collections.emptyList(), Function.identity(), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING =
|
||||
Setting.intSetting("discovery.zen.ping.unicast.concurrent_connects", 10, 0, false, SettingsProperty.ClusterScope);
|
||||
|
||||
// these limits are per-address
|
||||
public static final int LIMIT_FOREIGN_PORTS_COUNT = 1;
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.elasticsearch.cluster.ClusterName;
|
|||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.io.PathUtils;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -46,15 +47,18 @@ import static org.elasticsearch.common.Strings.cleanPath;
|
|||
// TODO: move PathUtils to be package-private here instead of
|
||||
// public+forbidden api!
|
||||
public class Environment {
|
||||
public static final Setting<String> PATH_HOME_SETTING = Setting.simpleString("path.home", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> PATH_CONF_SETTING = Setting.simpleString("path.conf", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> PATH_SCRIPTS_SETTING = Setting.simpleString("path.scripts", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<List<String>> PATH_DATA_SETTING = Setting.listSetting("path.data", Collections.emptyList(), Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> PATH_LOGS_SETTING = Setting.simpleString("path.logs", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> PATH_PLUGINS_SETTING = Setting.simpleString("path.plugins", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<List<String>> PATH_REPO_SETTING = Setting.listSetting("path.repo", Collections.emptyList(), Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> PATH_SHARED_DATA_SETTING = Setting.simpleString("path.shared_data", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> PIDFILE_SETTING = Setting.simpleString("pidfile", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> PATH_HOME_SETTING = Setting.simpleString("path.home", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> PATH_CONF_SETTING = Setting.simpleString("path.conf", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> PATH_SCRIPTS_SETTING = Setting.simpleString("path.scripts", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<List<String>> PATH_DATA_SETTING =
|
||||
Setting.listSetting("path.data", Collections.emptyList(), Function.identity(), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> PATH_LOGS_SETTING = Setting.simpleString("path.logs", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> PATH_PLUGINS_SETTING = Setting.simpleString("path.plugins", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<List<String>> PATH_REPO_SETTING =
|
||||
Setting.listSetting("path.repo", Collections.emptyList(), Function.identity(), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> PATH_SHARED_DATA_SETTING =
|
||||
Setting.simpleString("path.shared_data", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> PIDFILE_SETTING = Setting.simpleString("pidfile", false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final Settings settings;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.elasticsearch.common.component.AbstractComponent;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.io.FileSystemUtils;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Scope;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
@ -136,19 +136,19 @@ public class NodeEnvironment extends AbstractComponent implements Closeable {
|
|||
* Maximum number of data nodes that should run in an environment.
|
||||
*/
|
||||
public static final Setting<Integer> MAX_LOCAL_STORAGE_NODES_SETTING = Setting.intSetting("node.max_local_storage_nodes", 50, 1, false,
|
||||
Scope.CLUSTER);
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* If true automatically append node id to custom data paths.
|
||||
*/
|
||||
public static final Setting<Boolean> ADD_NODE_ID_TO_CUSTOM_PATH = Setting.boolSetting("node.add_id_to_custom_path", true, false,
|
||||
Scope.CLUSTER);
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* If true the [verbose] SegmentInfos.infoStream logging is sent to System.out.
|
||||
*/
|
||||
public static final Setting<Boolean> ENABLE_LUCENE_SEGMENT_INFOS_TRACE_SETTING = Setting
|
||||
.boolSetting("node.enable_lucene_segment_infos_trace", false, false, Scope.CLUSTER);
|
||||
.boolSetting("node.enable_lucene_segment_infos_trace", false, false, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final String NODES_FOLDER = "nodes";
|
||||
public static final String INDICES_FOLDER = "indices";
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
|||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.discovery.Discovery;
|
||||
|
@ -52,20 +53,20 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
*/
|
||||
public class GatewayService extends AbstractLifecycleComponent<GatewayService> implements ClusterStateListener {
|
||||
|
||||
public static final Setting<Integer> EXPECTED_NODES_SETTING = Setting.intSetting(
|
||||
"gateway.expected_nodes", -1, -1, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> EXPECTED_DATA_NODES_SETTING = Setting.intSetting(
|
||||
"gateway.expected_data_nodes", -1, -1, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> EXPECTED_MASTER_NODES_SETTING = Setting.intSetting(
|
||||
"gateway.expected_master_nodes", -1, -1, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> RECOVER_AFTER_TIME_SETTING = Setting.positiveTimeSetting(
|
||||
"gateway.recover_after_time", TimeValue.timeValueMillis(0), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> RECOVER_AFTER_NODES_SETTING = Setting.intSetting(
|
||||
"gateway.recover_after_nodes", -1, -1, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> RECOVER_AFTER_DATA_NODES_SETTING = Setting.intSetting(
|
||||
"gateway.recover_after_data_nodes", -1, -1, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> RECOVER_AFTER_MASTER_NODES_SETTING = Setting.intSetting(
|
||||
"gateway.recover_after_master_nodes", 0, 0, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> EXPECTED_NODES_SETTING =
|
||||
Setting.intSetting("gateway.expected_nodes", -1, -1, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> EXPECTED_DATA_NODES_SETTING =
|
||||
Setting.intSetting("gateway.expected_data_nodes", -1, -1, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> EXPECTED_MASTER_NODES_SETTING =
|
||||
Setting.intSetting("gateway.expected_master_nodes", -1, -1, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> RECOVER_AFTER_TIME_SETTING =
|
||||
Setting.positiveTimeSetting("gateway.recover_after_time", TimeValue.timeValueMillis(0), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> RECOVER_AFTER_NODES_SETTING =
|
||||
Setting.intSetting("gateway.recover_after_nodes", -1, -1, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> RECOVER_AFTER_DATA_NODES_SETTING =
|
||||
Setting.intSetting("gateway.recover_after_data_nodes", -1, -1, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> RECOVER_AFTER_MASTER_NODES_SETTING =
|
||||
Setting.intSetting("gateway.recover_after_master_nodes", 0, 0, false, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final ClusterBlock STATE_NOT_RECOVERED_BLOCK = new ClusterBlock(1, "state not recovered / initialized", true, true, RestStatus.SERVICE_UNAVAILABLE, ClusterBlockLevel.ALL);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.Decision;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.gateway.TransportNodesListGatewayStartedShards.NodeGatewayStartedShards;
|
||||
import org.elasticsearch.index.shard.ShardStateMetaData;
|
||||
|
@ -67,9 +68,13 @@ public abstract class PrimaryShardAllocator extends AbstractComponent {
|
|||
}
|
||||
};
|
||||
|
||||
public static final Setting<String> NODE_INITIAL_SHARDS_SETTING = new Setting<>("gateway.initial_shards", (settings) -> settings.get("gateway.local.initial_shards", "quorum"), INITIAL_SHARDS_PARSER, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> NODE_INITIAL_SHARDS_SETTING =
|
||||
new Setting<>("gateway.initial_shards", (settings) -> settings.get("gateway.local.initial_shards", "quorum"), INITIAL_SHARDS_PARSER,
|
||||
true, SettingsProperty.ClusterScope);
|
||||
@Deprecated
|
||||
public static final Setting<String> INDEX_RECOVERY_INITIAL_SHARDS_SETTING = new Setting<>("index.recovery.initial_shards", (settings) -> NODE_INITIAL_SHARDS_SETTING.get(settings) , INITIAL_SHARDS_PARSER, true, Setting.Scope.INDEX);
|
||||
public static final Setting<String> INDEX_RECOVERY_INITIAL_SHARDS_SETTING =
|
||||
new Setting<>("index.recovery.initial_shards", (settings) -> NODE_INITIAL_SHARDS_SETTING.get(settings) , INITIAL_SHARDS_PARSER, true,
|
||||
SettingsProperty.IndexScope);
|
||||
|
||||
public PrimaryShardAllocator(Settings settings) {
|
||||
super(settings);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.http;
|
||||
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Scope;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.transport.PortsRange;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
@ -32,30 +32,51 @@ import static org.elasticsearch.common.settings.Setting.listSetting;
|
|||
|
||||
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<String> SETTING_CORS_ALLOW_ORIGIN = new Setting<String>("http.cors.allow-origin", "", (value) -> value, false, Scope.CLUSTER);
|
||||
public static final Setting<Integer> SETTING_CORS_MAX_AGE = Setting.intSetting("http.cors.max-age", 1728000, false, Scope.CLUSTER);
|
||||
public static final Setting<String> SETTING_CORS_ALLOW_METHODS = new Setting<String>("http.cors.allow-methods", "OPTIONS, HEAD, GET, POST, PUT, DELETE", (value) -> value, false, Scope.CLUSTER);
|
||||
public static final Setting<String> SETTING_CORS_ALLOW_HEADERS = new Setting<String>("http.cors.allow-headers", "X-Requested-With, Content-Type, Content-Length", (value) -> value, false, Scope.CLUSTER);
|
||||
public static final Setting<Boolean> SETTING_CORS_ALLOW_CREDENTIALS = Setting.boolSetting("http.cors.allow-credentials", false, false, Scope.CLUSTER);
|
||||
public static final Setting<Boolean> SETTING_PIPELINING = Setting.boolSetting("http.pipelining", true, 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<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<Boolean> SETTING_CORS_ENABLED =
|
||||
Setting.boolSetting("http.cors.enabled", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> SETTING_CORS_ALLOW_ORIGIN =
|
||||
new Setting<String>("http.cors.allow-origin", "", (value) -> value, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> SETTING_CORS_MAX_AGE =
|
||||
Setting.intSetting("http.cors.max-age", 1728000, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> SETTING_CORS_ALLOW_METHODS =
|
||||
new Setting<String>("http.cors.allow-methods", "OPTIONS, HEAD, GET, POST, PUT, DELETE", (value) -> value, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> SETTING_CORS_ALLOW_HEADERS =
|
||||
new Setting<String>("http.cors.allow-headers", "X-Requested-With, Content-Type, Content-Length", (value) -> value, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> SETTING_CORS_ALLOW_CREDENTIALS =
|
||||
Setting.boolSetting("http.cors.allow-credentials", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> SETTING_PIPELINING =
|
||||
Setting.boolSetting("http.pipelining", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> SETTING_PIPELINING_MAX_EVENTS =
|
||||
Setting.intSetting("http.pipelining.max_events", 10000, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> SETTING_HTTP_COMPRESSION =
|
||||
Setting.boolSetting("http.compression", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> SETTING_HTTP_COMPRESSION_LEVEL =
|
||||
Setting.intSetting("http.compression_level", 6, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<List<String>> SETTING_HTTP_HOST =
|
||||
listSetting("http.host", emptyList(), s -> s, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<List<String>> SETTING_HTTP_PUBLISH_HOST =
|
||||
listSetting("http.publish_host", SETTING_HTTP_HOST, s -> s, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<List<String>> SETTING_HTTP_BIND_HOST =
|
||||
listSetting("http.bind_host", SETTING_HTTP_HOST, s -> s, false, SettingsProperty.ClusterScope);
|
||||
|
||||
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<Boolean> SETTING_HTTP_DETAILED_ERRORS_ENABLED = Setting.boolSetting("http.detailed_errors.enabled", true, false, Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> SETTING_HTTP_MAX_CONTENT_LENGTH = Setting.byteSizeSetting("http.max_content_length", new ByteSizeValue(100, ByteSizeUnit.MB), false, Scope.CLUSTER) ;
|
||||
public static final Setting<ByteSizeValue> SETTING_HTTP_MAX_CHUNK_SIZE = Setting.byteSizeSetting("http.max_chunk_size", new ByteSizeValue(8, ByteSizeUnit.KB), false, Scope.CLUSTER) ;
|
||||
public static final Setting<ByteSizeValue> SETTING_HTTP_MAX_HEADER_SIZE = Setting.byteSizeSetting("http.max_header_size", new ByteSizeValue(8, ByteSizeUnit.KB), false, Scope.CLUSTER) ;
|
||||
public static final Setting<ByteSizeValue> SETTING_HTTP_MAX_INITIAL_LINE_LENGTH = Setting.byteSizeSetting("http.max_initial_line_length", new ByteSizeValue(4, ByteSizeUnit.KB), false, Scope.CLUSTER) ;
|
||||
public static final Setting<PortsRange> SETTING_HTTP_PORT =
|
||||
new Setting<PortsRange>("http.port", "9200-9300", PortsRange::new, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> SETTING_HTTP_PUBLISH_PORT =
|
||||
Setting.intSetting("http.publish_port", 0, 0, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> SETTING_HTTP_DETAILED_ERRORS_ENABLED =
|
||||
Setting.boolSetting("http.detailed_errors.enabled", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> SETTING_HTTP_MAX_CONTENT_LENGTH =
|
||||
Setting.byteSizeSetting("http.max_content_length", new ByteSizeValue(100, ByteSizeUnit.MB), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> SETTING_HTTP_MAX_CHUNK_SIZE =
|
||||
Setting.byteSizeSetting("http.max_chunk_size", new ByteSizeValue(8, ByteSizeUnit.KB), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> SETTING_HTTP_MAX_HEADER_SIZE =
|
||||
Setting.byteSizeSetting("http.max_header_size", new ByteSizeValue(8, ByteSizeUnit.KB), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> SETTING_HTTP_MAX_INITIAL_LINE_LENGTH =
|
||||
Setting.byteSizeSetting("http.max_initial_line_length", new ByteSizeValue(4, ByteSizeUnit.KB), false, SettingsProperty.ClusterScope);
|
||||
// don't reset cookies by default, since I don't think we really need to
|
||||
// note, parsing cookies was fixed in netty 3.5.1 regarding stack allocation, but still, currently, we don't need cookies
|
||||
public static final Setting<Boolean> SETTING_HTTP_RESET_COOKIES = Setting.boolSetting("http.reset_cookies", false, false, Scope.CLUSTER);
|
||||
public static final Setting<Boolean> SETTING_HTTP_RESET_COOKIES =
|
||||
Setting.boolSetting("http.reset_cookies", false, false, SettingsProperty.ClusterScope);
|
||||
|
||||
private HttpTransportSettings() {
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.common.netty.OpenChannelsHandler;
|
|||
import org.elasticsearch.common.network.NetworkAddress;
|
||||
import org.elasticsearch.common.network.NetworkService;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.BoundTransportAddress;
|
||||
import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
||||
|
@ -116,33 +117,32 @@ public class NettyHttpServerTransport extends AbstractLifecycleComponent<HttpSer
|
|||
}
|
||||
|
||||
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);
|
||||
Setting.byteSizeSetting("http.netty.max_cumulation_buffer_capacity", new ByteSizeValue(-1), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static Setting<Integer> SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS =
|
||||
Setting.intSetting("http.netty.max_composite_buffer_components", -1, false, Setting.Scope.CLUSTER);
|
||||
Setting.intSetting("http.netty.max_composite_buffer_components", -1, false, SettingsProperty.ClusterScope);
|
||||
|
||||
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);
|
||||
(s) -> Setting.parseInt(s, 1, "http.netty.worker_count"), false, SettingsProperty.ClusterScope);
|
||||
|
||||
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<Boolean> SETTING_HTTP_TCP_NO_DELAY =
|
||||
boolSetting("http.tcp_no_delay", NetworkService.TcpSettings.TCP_NO_DELAY, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> SETTING_HTTP_TCP_KEEP_ALIVE =
|
||||
boolSetting("http.tcp.keep_alive", NetworkService.TcpSettings.TCP_KEEP_ALIVE, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> SETTING_HTTP_TCP_BLOCKING_SERVER =
|
||||
boolSetting("http.tcp.blocking_server", NetworkService.TcpSettings.TCP_BLOCKING_SERVER, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> SETTING_HTTP_TCP_REUSE_ADDRESS =
|
||||
boolSetting("http.tcp.reuse_address", NetworkService.TcpSettings.TCP_REUSE_ADDRESS, false, SettingsProperty.ClusterScope);
|
||||
|
||||
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",
|
||||
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,
|
||||
SettingsProperty.ClusterScope);
|
||||
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,
|
||||
SettingsProperty.ClusterScope);
|
||||
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) {
|
||||
|
@ -152,13 +152,13 @@ public class NettyHttpServerTransport extends AbstractLifecycleComponent<HttpSer
|
|||
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);
|
||||
}, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MIN =
|
||||
byteSizeSetting("http.netty.receive_predictor_min", SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE, false,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MAX =
|
||||
byteSizeSetting("http.netty.receive_predictor_max", SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE, false,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
|
||||
protected final NetworkService networkService;
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.index;
|
|||
import org.apache.lucene.util.SetOnce;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.index.analysis.AnalysisRegistry;
|
||||
|
@ -65,13 +66,16 @@ import java.util.function.Function;
|
|||
*/
|
||||
public final class IndexModule {
|
||||
|
||||
public static final Setting<String> INDEX_STORE_TYPE_SETTING = new Setting<>("index.store.type", "", Function.identity(), false, Setting.Scope.INDEX);
|
||||
public static final Setting<String> INDEX_STORE_TYPE_SETTING =
|
||||
new Setting<>("index.store.type", "", Function.identity(), false, SettingsProperty.IndexScope);
|
||||
public static final String SIMILARITY_SETTINGS_PREFIX = "index.similarity";
|
||||
public static final String INDEX_QUERY_CACHE = "index";
|
||||
public static final String NONE_QUERY_CACHE = "none";
|
||||
public static final Setting<String> INDEX_QUERY_CACHE_TYPE_SETTING = new Setting<>("index.queries.cache.type", INDEX_QUERY_CACHE, Function.identity(), false, Setting.Scope.INDEX);
|
||||
public static final Setting<String> INDEX_QUERY_CACHE_TYPE_SETTING =
|
||||
new Setting<>("index.queries.cache.type", INDEX_QUERY_CACHE, Function.identity(), false, SettingsProperty.IndexScope);
|
||||
// for test purposes only
|
||||
public static final Setting<Boolean> INDEX_QUERY_CACHE_EVERYTHING_SETTING = Setting.boolSetting("index.queries.cache.everything", false, false, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_QUERY_CACHE_EVERYTHING_SETTING =
|
||||
Setting.boolSetting("index.queries.cache.everything", false, false, SettingsProperty.IndexScope);
|
||||
private final IndexSettings indexSettings;
|
||||
private final IndexStoreConfig indexStoreConfig;
|
||||
private final AnalysisRegistry analysisRegistry;
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.common.logging.Loggers;
|
|||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
@ -36,7 +37,6 @@ import org.elasticsearch.index.translog.Translog;
|
|||
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
@ -50,15 +50,26 @@ import java.util.function.Predicate;
|
|||
*/
|
||||
public final class IndexSettings {
|
||||
|
||||
public static final Setting<String> DEFAULT_FIELD_SETTING = new Setting<>("index.query.default_field", AllFieldMapper.NAME, Function.identity(), false, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> QUERY_STRING_LENIENT_SETTING = Setting.boolSetting("index.query_string.lenient", false, false, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> QUERY_STRING_ANALYZE_WILDCARD = Setting.boolSetting("indices.query.query_string.analyze_wildcard", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> QUERY_STRING_ALLOW_LEADING_WILDCARD = Setting.boolSetting("indices.query.query_string.allowLeadingWildcard", true, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> ALLOW_UNMAPPED = Setting.boolSetting("index.query.parse.allow_unmapped_fields", true, false, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_TRANSLOG_SYNC_INTERVAL_SETTING = Setting.timeSetting("index.translog.sync_interval", TimeValue.timeValueSeconds(5), TimeValue.timeValueMillis(100), false, Setting.Scope.INDEX);
|
||||
public static final Setting<Translog.Durability> INDEX_TRANSLOG_DURABILITY_SETTING = new Setting<>("index.translog.durability", Translog.Durability.REQUEST.name(), (value) -> Translog.Durability.valueOf(value.toUpperCase(Locale.ROOT)), true, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_WARMER_ENABLED_SETTING = Setting.boolSetting("index.warmer.enabled", true, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_TTL_DISABLE_PURGE_SETTING = Setting.boolSetting("index.ttl.disable_purge", false, true, Setting.Scope.INDEX);
|
||||
public static final Setting<String> DEFAULT_FIELD_SETTING =
|
||||
new Setting<>("index.query.default_field", AllFieldMapper.NAME, Function.identity(), false, SettingsProperty.IndexScope);
|
||||
public static final Setting<Boolean> QUERY_STRING_LENIENT_SETTING =
|
||||
Setting.boolSetting("index.query_string.lenient", false, false, SettingsProperty.IndexScope);
|
||||
public static final Setting<Boolean> QUERY_STRING_ANALYZE_WILDCARD =
|
||||
Setting.boolSetting("indices.query.query_string.analyze_wildcard", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> QUERY_STRING_ALLOW_LEADING_WILDCARD =
|
||||
Setting.boolSetting("indices.query.query_string.allowLeadingWildcard", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> ALLOW_UNMAPPED =
|
||||
Setting.boolSetting("index.query.parse.allow_unmapped_fields", true, false, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_TRANSLOG_SYNC_INTERVAL_SETTING =
|
||||
Setting.timeSetting("index.translog.sync_interval", TimeValue.timeValueSeconds(5), TimeValue.timeValueMillis(100), false,
|
||||
SettingsProperty.IndexScope);
|
||||
public static final Setting<Translog.Durability> INDEX_TRANSLOG_DURABILITY_SETTING =
|
||||
new Setting<>("index.translog.durability", Translog.Durability.REQUEST.name(),
|
||||
(value) -> Translog.Durability.valueOf(value.toUpperCase(Locale.ROOT)), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Boolean> INDEX_WARMER_ENABLED_SETTING =
|
||||
Setting.boolSetting("index.warmer.enabled", true, true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Boolean> INDEX_TTL_DISABLE_PURGE_SETTING =
|
||||
Setting.boolSetting("index.ttl.disable_purge", false, true, SettingsProperty.IndexScope);
|
||||
public static final Setting<String> INDEX_CHECK_ON_STARTUP = new Setting<>("index.shard.check_on_startup", "false", (s) -> {
|
||||
switch(s) {
|
||||
case "false":
|
||||
|
@ -69,7 +80,7 @@ public final class IndexSettings {
|
|||
default:
|
||||
throw new IllegalArgumentException("unknown value for [index.shard.check_on_startup] must be one of [true, false, fix, checksum] but was: " + s);
|
||||
}
|
||||
}, false, Setting.Scope.INDEX);
|
||||
}, false, SettingsProperty.IndexScope);
|
||||
|
||||
/**
|
||||
* Index setting describing the maximum value of from + size on a query.
|
||||
|
@ -79,10 +90,15 @@ public final class IndexSettings {
|
|||
* safely. 1,000,000 is probably way to high for any cluster to set
|
||||
* safely.
|
||||
*/
|
||||
public static final Setting<Integer> MAX_RESULT_WINDOW_SETTING = Setting.intSetting("index.max_result_window", 10000, 1, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Integer> MAX_RESULT_WINDOW_SETTING =
|
||||
Setting.intSetting("index.max_result_window", 10000, 1, true, SettingsProperty.IndexScope);
|
||||
public static final TimeValue DEFAULT_REFRESH_INTERVAL = new TimeValue(1, TimeUnit.SECONDS);
|
||||
public static final Setting<TimeValue> INDEX_REFRESH_INTERVAL_SETTING = Setting.timeSetting("index.refresh_interval", DEFAULT_REFRESH_INTERVAL, new TimeValue(-1, TimeUnit.MILLISECONDS), true, Setting.Scope.INDEX);
|
||||
public static final Setting<ByteSizeValue> INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING = Setting.byteSizeSetting("index.translog.flush_threshold_size", new ByteSizeValue(512, ByteSizeUnit.MB), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_REFRESH_INTERVAL_SETTING =
|
||||
Setting.timeSetting("index.refresh_interval", DEFAULT_REFRESH_INTERVAL, new TimeValue(-1, TimeUnit.MILLISECONDS), true,
|
||||
SettingsProperty.IndexScope);
|
||||
public static final Setting<ByteSizeValue> INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING =
|
||||
Setting.byteSizeSetting("index.translog.flush_threshold_size", new ByteSizeValue(512, ByteSizeUnit.MB), true,
|
||||
SettingsProperty.IndexScope);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -90,7 +106,9 @@ public final class IndexSettings {
|
|||
* This setting is realtime updateable
|
||||
*/
|
||||
public static final TimeValue DEFAULT_GC_DELETES = TimeValue.timeValueSeconds(60);
|
||||
public static final Setting<TimeValue> INDEX_GC_DELETES_SETTING = Setting.timeSetting("index.gc_deletes", DEFAULT_GC_DELETES, new TimeValue(-1, TimeUnit.MILLISECONDS), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_GC_DELETES_SETTING =
|
||||
Setting.timeSetting("index.gc_deletes", DEFAULT_GC_DELETES, new TimeValue(-1, TimeUnit.MILLISECONDS), true,
|
||||
SettingsProperty.IndexScope);
|
||||
|
||||
private final Index index;
|
||||
private final Version version;
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.lucene.index.LeafReaderContext;
|
|||
import org.apache.lucene.index.NumericDocValues;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.engine.Engine;
|
||||
|
@ -56,7 +57,7 @@ public final class IndexWarmer extends AbstractComponent {
|
|||
|
||||
public static final Setting<MappedFieldType.Loading> INDEX_NORMS_LOADING_SETTING = new Setting<>("index.norms.loading",
|
||||
MappedFieldType.Loading.LAZY.toString(), (s) -> MappedFieldType.Loading.parse(s, MappedFieldType.Loading.LAZY),
|
||||
false, Setting.Scope.INDEX);
|
||||
false, SettingsProperty.IndexScope);
|
||||
private final List<Listener> listeners;
|
||||
|
||||
IndexWarmer(Settings settings, ThreadPool threadPool, Listener... listeners) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.common.Strings;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||
import org.elasticsearch.index.engine.Engine;
|
||||
|
@ -54,12 +55,23 @@ public final class IndexingSlowLog implements IndexingOperationListener {
|
|||
private final ESLogger deleteLogger;
|
||||
|
||||
private static final String INDEX_INDEXING_SLOWLOG_PREFIX = "index.indexing.slowlog";
|
||||
public static final Setting<TimeValue> INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_WARN_SETTING = Setting.timeSetting(INDEX_INDEXING_SLOWLOG_PREFIX +".threshold.index.warn", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_INFO_SETTING = Setting.timeSetting(INDEX_INDEXING_SLOWLOG_PREFIX +".threshold.index.info", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG_SETTING = Setting.timeSetting(INDEX_INDEXING_SLOWLOG_PREFIX +".threshold.index.debug", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_TRACE_SETTING = Setting.timeSetting(INDEX_INDEXING_SLOWLOG_PREFIX +".threshold.index.trace", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_INDEXING_SLOWLOG_REFORMAT_SETTING = Setting.boolSetting(INDEX_INDEXING_SLOWLOG_PREFIX +".reformat", true, true, Setting.Scope.INDEX);
|
||||
public static final Setting<SlowLogLevel> INDEX_INDEXING_SLOWLOG_LEVEL_SETTING = new Setting<>(INDEX_INDEXING_SLOWLOG_PREFIX +".level", SlowLogLevel.TRACE.name(), SlowLogLevel::parse, true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_WARN_SETTING =
|
||||
Setting.timeSetting(INDEX_INDEXING_SLOWLOG_PREFIX +".threshold.index.warn", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_INFO_SETTING =
|
||||
Setting.timeSetting(INDEX_INDEXING_SLOWLOG_PREFIX +".threshold.index.info", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG_SETTING =
|
||||
Setting.timeSetting(INDEX_INDEXING_SLOWLOG_PREFIX +".threshold.index.debug", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_TRACE_SETTING =
|
||||
Setting.timeSetting(INDEX_INDEXING_SLOWLOG_PREFIX +".threshold.index.trace", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Boolean> INDEX_INDEXING_SLOWLOG_REFORMAT_SETTING =
|
||||
Setting.boolSetting(INDEX_INDEXING_SLOWLOG_PREFIX +".reformat", true, true, SettingsProperty.IndexScope);
|
||||
public static final Setting<SlowLogLevel> INDEX_INDEXING_SLOWLOG_LEVEL_SETTING =
|
||||
new Setting<>(INDEX_INDEXING_SLOWLOG_PREFIX +".level", SlowLogLevel.TRACE.name(), SlowLogLevel::parse, true,
|
||||
SettingsProperty.IndexScope);
|
||||
/**
|
||||
* Reads how much of the source to log. The user can specify any value they
|
||||
* like and numbers are interpreted the maximum number of characters to log
|
||||
|
@ -72,7 +84,7 @@ public final class IndexingSlowLog implements IndexingOperationListener {
|
|||
} catch (NumberFormatException e) {
|
||||
return Booleans.parseBoolean(value, true) ? Integer.MAX_VALUE : 0;
|
||||
}
|
||||
}, true, Setting.Scope.INDEX);
|
||||
}, true, SettingsProperty.IndexScope);
|
||||
|
||||
IndexingSlowLog(IndexSettings indexSettings) {
|
||||
this(indexSettings, Loggers.getLogger(INDEX_INDEXING_SLOWLOG_PREFIX + ".index"),
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.lucene.index.TieredMergePolicy;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
||||
|
@ -126,15 +127,27 @@ public final class MergePolicyConfig {
|
|||
public static final ByteSizeValue DEFAULT_MAX_MERGED_SEGMENT = new ByteSizeValue(5, ByteSizeUnit.GB);
|
||||
public static final double DEFAULT_SEGMENTS_PER_TIER = 10.0d;
|
||||
public static final double DEFAULT_RECLAIM_DELETES_WEIGHT = 2.0d;
|
||||
public static final Setting<Double> INDEX_COMPOUND_FORMAT_SETTING = new Setting<>("index.compound_format", Double.toString(TieredMergePolicy.DEFAULT_NO_CFS_RATIO), MergePolicyConfig::parseNoCFSRatio, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Double> INDEX_COMPOUND_FORMAT_SETTING =
|
||||
new Setting<>("index.compound_format", Double.toString(TieredMergePolicy.DEFAULT_NO_CFS_RATIO), MergePolicyConfig::parseNoCFSRatio,
|
||||
true, SettingsProperty.IndexScope);
|
||||
|
||||
public static final Setting<Double> INDEX_MERGE_POLICY_EXPUNGE_DELETES_ALLOWED_SETTING = Setting.doubleSetting("index.merge.policy.expunge_deletes_allowed", DEFAULT_EXPUNGE_DELETES_ALLOWED, 0.0d, true, Setting.Scope.INDEX);
|
||||
public static final Setting<ByteSizeValue> INDEX_MERGE_POLICY_FLOOR_SEGMENT_SETTING = Setting.byteSizeSetting("index.merge.policy.floor_segment", DEFAULT_FLOOR_SEGMENT, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Integer> INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_SETTING = Setting.intSetting("index.merge.policy.max_merge_at_once", DEFAULT_MAX_MERGE_AT_ONCE, 2, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Integer> INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT_SETTING = Setting.intSetting("index.merge.policy.max_merge_at_once_explicit", DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT, 2, true, Setting.Scope.INDEX);
|
||||
public static final Setting<ByteSizeValue> INDEX_MERGE_POLICY_MAX_MERGED_SEGMENT_SETTING = Setting.byteSizeSetting("index.merge.policy.max_merged_segment", DEFAULT_MAX_MERGED_SEGMENT, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Double> INDEX_MERGE_POLICY_SEGMENTS_PER_TIER_SETTING = Setting.doubleSetting("index.merge.policy.segments_per_tier", DEFAULT_SEGMENTS_PER_TIER, 2.0d, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Double> INDEX_MERGE_POLICY_RECLAIM_DELETES_WEIGHT_SETTING = Setting.doubleSetting("index.merge.policy.reclaim_deletes_weight", DEFAULT_RECLAIM_DELETES_WEIGHT, 0.0d, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Double> INDEX_MERGE_POLICY_EXPUNGE_DELETES_ALLOWED_SETTING =
|
||||
Setting.doubleSetting("index.merge.policy.expunge_deletes_allowed", DEFAULT_EXPUNGE_DELETES_ALLOWED, 0.0d, true,
|
||||
SettingsProperty.IndexScope);
|
||||
public static final Setting<ByteSizeValue> INDEX_MERGE_POLICY_FLOOR_SEGMENT_SETTING =
|
||||
Setting.byteSizeSetting("index.merge.policy.floor_segment", DEFAULT_FLOOR_SEGMENT, true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Integer> INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_SETTING =
|
||||
Setting.intSetting("index.merge.policy.max_merge_at_once", DEFAULT_MAX_MERGE_AT_ONCE, 2, true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Integer> INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT_SETTING =
|
||||
Setting.intSetting("index.merge.policy.max_merge_at_once_explicit", DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT, 2, true,
|
||||
SettingsProperty.IndexScope);
|
||||
public static final Setting<ByteSizeValue> INDEX_MERGE_POLICY_MAX_MERGED_SEGMENT_SETTING =
|
||||
Setting.byteSizeSetting("index.merge.policy.max_merged_segment", DEFAULT_MAX_MERGED_SEGMENT, true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Double> INDEX_MERGE_POLICY_SEGMENTS_PER_TIER_SETTING =
|
||||
Setting.doubleSetting("index.merge.policy.segments_per_tier", DEFAULT_SEGMENTS_PER_TIER, 2.0d, true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Double> INDEX_MERGE_POLICY_RECLAIM_DELETES_WEIGHT_SETTING =
|
||||
Setting.doubleSetting("index.merge.policy.reclaim_deletes_weight", DEFAULT_RECLAIM_DELETES_WEIGHT, 0.0d, true,
|
||||
SettingsProperty.IndexScope);
|
||||
public static final String INDEX_MERGE_ENABLED = "index.merge.enabled"; // don't convert to Setting<> and register... we only set this in tests and register via a plugin
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.index;
|
|||
|
||||
import org.apache.lucene.index.ConcurrentMergeScheduler;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
||||
|
||||
/**
|
||||
|
@ -51,9 +52,17 @@ import org.elasticsearch.common.util.concurrent.EsExecutors;
|
|||
*/
|
||||
public final class MergeSchedulerConfig {
|
||||
|
||||
public static final Setting<Integer> MAX_THREAD_COUNT_SETTING = new Setting<>("index.merge.scheduler.max_thread_count", (s) -> Integer.toString(Math.max(1, Math.min(4, EsExecutors.boundedNumberOfProcessors(s) / 2))), (s) -> Setting.parseInt(s, 1, "index.merge.scheduler.max_thread_count"), true, Setting.Scope.INDEX);
|
||||
public static final Setting<Integer> MAX_MERGE_COUNT_SETTING = new Setting<>("index.merge.scheduler.max_merge_count", (s) -> Integer.toString(MAX_THREAD_COUNT_SETTING.get(s) + 5), (s) -> Setting.parseInt(s, 1, "index.merge.scheduler.max_merge_count"), true, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> AUTO_THROTTLE_SETTING = Setting.boolSetting("index.merge.scheduler.auto_throttle", true, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Integer> MAX_THREAD_COUNT_SETTING =
|
||||
new Setting<>("index.merge.scheduler.max_thread_count",
|
||||
(s) -> Integer.toString(Math.max(1, Math.min(4, EsExecutors.boundedNumberOfProcessors(s) / 2))),
|
||||
(s) -> Setting.parseInt(s, 1, "index.merge.scheduler.max_thread_count"), true,
|
||||
SettingsProperty.IndexScope);
|
||||
public static final Setting<Integer> MAX_MERGE_COUNT_SETTING =
|
||||
new Setting<>("index.merge.scheduler.max_merge_count",
|
||||
(s) -> Integer.toString(MAX_THREAD_COUNT_SETTING.get(s) + 5),
|
||||
(s) -> Setting.parseInt(s, 1, "index.merge.scheduler.max_merge_count"), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Boolean> AUTO_THROTTLE_SETTING =
|
||||
Setting.boolSetting("index.merge.scheduler.auto_throttle", true, true, SettingsProperty.IndexScope);
|
||||
|
||||
private volatile boolean autoThrottle;
|
||||
private volatile int maxThreadCount;
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.elasticsearch.common.Strings;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
|
@ -50,16 +51,35 @@ public final class SearchSlowLog {
|
|||
private final ESLogger fetchLogger;
|
||||
|
||||
private static final String INDEX_SEARCH_SLOWLOG_PREFIX = "index.search.slowlog";
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_WARN_SETTING = Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.query.warn", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_INFO_SETTING = Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.query.info", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_DEBUG_SETTING = Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.query.debug", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_TRACE_SETTING = Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.query.trace", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_WARN_SETTING = Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.fetch.warn", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_INFO_SETTING = Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.fetch.info", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_DEBUG_SETTING = Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.fetch.debug", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_TRACE_SETTING = Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.fetch.trace", TimeValue.timeValueNanos(-1), TimeValue.timeValueMillis(-1), true, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_SEARCH_SLOWLOG_REFORMAT = Setting.boolSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".reformat", true, true, Setting.Scope.INDEX);
|
||||
public static final Setting<SlowLogLevel> INDEX_SEARCH_SLOWLOG_LEVEL = new Setting<>(INDEX_SEARCH_SLOWLOG_PREFIX + ".level", SlowLogLevel.TRACE.name(), SlowLogLevel::parse, true, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_WARN_SETTING =
|
||||
Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.query.warn", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_INFO_SETTING =
|
||||
Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.query.info", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_DEBUG_SETTING =
|
||||
Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.query.debug", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_TRACE_SETTING =
|
||||
Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.query.trace", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_WARN_SETTING =
|
||||
Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.fetch.warn", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_INFO_SETTING =
|
||||
Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.fetch.info", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_DEBUG_SETTING =
|
||||
Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.fetch.debug", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<TimeValue> INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_TRACE_SETTING =
|
||||
Setting.timeSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".threshold.fetch.trace", TimeValue.timeValueNanos(-1),
|
||||
TimeValue.timeValueMillis(-1), true, SettingsProperty.IndexScope);
|
||||
public static final Setting<Boolean> INDEX_SEARCH_SLOWLOG_REFORMAT =
|
||||
Setting.boolSetting(INDEX_SEARCH_SLOWLOG_PREFIX + ".reformat", true, true, SettingsProperty.IndexScope);
|
||||
public static final Setting<SlowLogLevel> INDEX_SEARCH_SLOWLOG_LEVEL =
|
||||
new Setting<>(INDEX_SEARCH_SLOWLOG_PREFIX + ".level", SlowLogLevel.TRACE.name(), SlowLogLevel::parse, true,
|
||||
SettingsProperty.IndexScope);
|
||||
|
||||
public SearchSlowLog(IndexSettings indexSettings) {
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class NamedAnalyzer extends DelegatingAnalyzerWrapper {
|
|||
public String toString() {
|
||||
return "analyzer name[" + name + "], analyzer [" + analyzer + "]";
|
||||
}
|
||||
|
||||
|
||||
/** It is an error if this is ever used, it means we screwed up! */
|
||||
static final ReuseStrategy ERROR_STRATEGY = new Analyzer.ReuseStrategy() {
|
||||
@Override
|
||||
|
|
|
@ -56,4 +56,4 @@ public class NumericDoubleAnalyzer extends NumericAnalyzer<NumericDoubleTokenize
|
|||
protected NumericDoubleTokenizer createNumericTokenizer(char[] buffer) throws IOException {
|
||||
return new NumericDoubleTokenizer(precisionStep, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,4 +56,4 @@ public class NumericFloatAnalyzer extends NumericAnalyzer<NumericFloatTokenizer>
|
|||
protected NumericFloatTokenizer createNumericTokenizer(char[] buffer) throws IOException {
|
||||
return new NumericFloatTokenizer(precisionStep, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,4 +56,4 @@ public class NumericLongAnalyzer extends NumericAnalyzer<NumericLongTokenizer> {
|
|||
protected NumericLongTokenizer createNumericTokenizer(char[] buffer) throws IOException {
|
||||
return new NumericLongTokenizer(precisionStep, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.elasticsearch.common.cache.RemovalListener;
|
|||
import org.elasticsearch.common.cache.RemovalNotification;
|
||||
import org.elasticsearch.common.lucene.search.Queries;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.AbstractIndexComponent;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
|
@ -70,7 +71,8 @@ import java.util.concurrent.Executor;
|
|||
*/
|
||||
public final class BitsetFilterCache extends AbstractIndexComponent implements LeafReader.CoreClosedListener, RemovalListener<Object, Cache<Query, BitsetFilterCache.Value>>, Closeable {
|
||||
|
||||
public static final Setting<Boolean> INDEX_LOAD_RANDOM_ACCESS_FILTERS_EAGERLY_SETTING = Setting.boolSetting("index.load_fixed_bitset_filters_eagerly", true, false, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_LOAD_RANDOM_ACCESS_FILTERS_EAGERLY_SETTING =
|
||||
Setting.boolSetting("index.load_fixed_bitset_filters_eagerly", true, false, SettingsProperty.IndexScope);
|
||||
|
||||
private final boolean loadRandomAccessFiltersEagerly;
|
||||
private final Cache<Object, Cache<Query, Value>> loadedFilters;
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.lucene.search.QueryCache;
|
|||
import org.apache.lucene.search.QueryCachingPolicy;
|
||||
import org.apache.lucene.search.similarities.Similarity;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
@ -83,7 +84,7 @@ public final class EngineConfig {
|
|||
}
|
||||
return s;
|
||||
}
|
||||
}, false, Setting.Scope.INDEX);
|
||||
}, false, SettingsProperty.IndexScope);
|
||||
|
||||
/** if set to true the engine will start even if the translog id in the commit point can not be found */
|
||||
public static final String INDEX_FORCE_NEW_TRANSLOG = "index.engine.force_new_translog";
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.ExceptionsHelper;
|
|||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.index.AbstractIndexComponent;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.index.fielddata.plain.AbstractGeoPointDVIndexFieldData;
|
||||
|
@ -66,7 +67,7 @@ public class IndexFieldDataService extends AbstractIndexComponent implements Clo
|
|||
default:
|
||||
throw new IllegalArgumentException("failed to parse [" + s + "] must be one of [node,node]");
|
||||
}
|
||||
}, false, Setting.Scope.INDEX);
|
||||
}, false, SettingsProperty.IndexScope);
|
||||
|
||||
private static final IndexFieldData.Builder MISSING_DOC_VALUES_BUILDER = (indexProperties, fieldType, cache, breakerService, mapperService1) -> {
|
||||
throw new IllegalStateException("Can't load fielddata on [" + fieldType.name()
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.elasticsearch.common.Nullable;
|
|||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||
|
@ -49,8 +50,10 @@ import java.util.Map;
|
|||
import java.util.stream.StreamSupport;
|
||||
|
||||
public abstract class FieldMapper extends Mapper implements Cloneable {
|
||||
public static final Setting<Boolean> IGNORE_MALFORMED_SETTING = Setting.boolSetting("index.mapping.ignore_malformed", false, false, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> COERCE_SETTING = Setting.boolSetting("index.mapping.coerce", false, false, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> IGNORE_MALFORMED_SETTING =
|
||||
Setting.boolSetting("index.mapping.ignore_malformed", false, false, SettingsProperty.IndexScope);
|
||||
public static final Setting<Boolean> COERCE_SETTING =
|
||||
Setting.boolSetting("index.mapping.coerce", false, false, SettingsProperty.IndexScope);
|
||||
public abstract static class Builder<T extends Builder, Y extends FieldMapper> extends Mapper.Builder<T, Y> {
|
||||
|
||||
protected final MappedFieldType fieldType;
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.ElasticsearchGenerationException;
|
|||
import org.elasticsearch.common.compress.CompressedXContent;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.index.AbstractIndexComponent;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.index.analysis.AnalysisService;
|
||||
|
@ -81,9 +82,11 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
|||
}
|
||||
|
||||
public static final String DEFAULT_MAPPING = "_default_";
|
||||
public static final Setting<Long> INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING = Setting.longSetting("index.mapping.nested_fields.limit", 50L, 0, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Long> INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING =
|
||||
Setting.longSetting("index.mapping.nested_fields.limit", 50L, 0, true, SettingsProperty.IndexScope);
|
||||
public static final boolean INDEX_MAPPER_DYNAMIC_DEFAULT = true;
|
||||
public static final Setting<Boolean> INDEX_MAPPER_DYNAMIC_SETTING = Setting.boolSetting("index.mapper.dynamic", INDEX_MAPPER_DYNAMIC_DEFAULT, false, Setting.Scope.INDEX);
|
||||
public static final Setting<Boolean> INDEX_MAPPER_DYNAMIC_SETTING =
|
||||
Setting.boolSetting("index.mapper.dynamic", INDEX_MAPPER_DYNAMIC_DEFAULT, false, SettingsProperty.IndexScope);
|
||||
private static ObjectHashSet<String> META_FIELDS = ObjectHashSet.from(
|
||||
"_uid", "_id", "_type", "_all", "_parent", "_routing", "_index",
|
||||
"_size", "_timestamp", "_ttl"
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.lucene.search.Query;
|
|||
import org.apache.lucene.util.BytesRef;
|
||||
import org.elasticsearch.common.Explicit;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.Fuzziness;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -52,7 +53,9 @@ import java.util.List;
|
|||
*
|
||||
*/
|
||||
public abstract class NumberFieldMapper extends FieldMapper implements AllFieldMapper.IncludeInAll {
|
||||
private static final Setting<Boolean> COERCE_SETTING = Setting.boolSetting("index.mapping.coerce", true, false, Setting.Scope.INDEX); // this is private since it has a different default
|
||||
// this is private since it has a different default
|
||||
private static final Setting<Boolean> COERCE_SETTING =
|
||||
Setting.boolSetting("index.mapping.coerce", true, false, SettingsProperty.IndexScope);
|
||||
|
||||
public static class Defaults {
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.common.bytes.BytesReference;
|
|||
import org.elasticsearch.common.metrics.CounterMetric;
|
||||
import org.elasticsearch.common.metrics.MeanMetric;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
@ -61,7 +62,8 @@ import java.util.concurrent.TimeUnit;
|
|||
*/
|
||||
public final class PercolatorQueriesRegistry extends AbstractIndexShardComponent implements Closeable {
|
||||
|
||||
public final static Setting<Boolean> INDEX_MAP_UNMAPPED_FIELDS_AS_STRING_SETTING = Setting.boolSetting("index.percolator.map_unmapped_fields_as_string", false, false, Setting.Scope.INDEX);
|
||||
public final static Setting<Boolean> INDEX_MAP_UNMAPPED_FIELDS_AS_STRING_SETTING =
|
||||
Setting.boolSetting("index.percolator.map_unmapped_fields_as_string", false, false, SettingsProperty.IndexScope);
|
||||
|
||||
private final ConcurrentMap<BytesRef, Query> percolateQueries = ConcurrentCollections.newConcurrentMapWithAggressiveConcurrency();
|
||||
private final QueryShardContext queryShardContext;
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.lucene.util.Constants;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.metrics.CounterMetric;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.set.Sets;
|
||||
import org.elasticsearch.index.IndexModule;
|
||||
|
@ -60,7 +61,7 @@ public class FsDirectoryService extends DirectoryService implements StoreRateLim
|
|||
default:
|
||||
throw new IllegalArgumentException("unrecognized [index.store.fs.fs_lock] \"" + s + "\": must be native or simple");
|
||||
}
|
||||
}, false, Setting.Scope.INDEX);
|
||||
}, false, SettingsProperty.IndexScope);
|
||||
private final CounterMetric rateLimitingTimeInNanos = new CounterMetric();
|
||||
private final ShardPath path;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.index.store;
|
|||
|
||||
import org.apache.lucene.store.StoreRateLimiting;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.index.AbstractIndexComponent;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
|
@ -29,8 +30,10 @@ import org.elasticsearch.index.shard.ShardPath;
|
|||
*
|
||||
*/
|
||||
public class IndexStore extends AbstractIndexComponent {
|
||||
public static final Setting<IndexRateLimitingType> INDEX_STORE_THROTTLE_TYPE_SETTING = new Setting<>("index.store.throttle.type", "none", IndexRateLimitingType::fromString, true, Setting.Scope.INDEX) ;
|
||||
public static final Setting<ByteSizeValue> INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC_SETTING = Setting.byteSizeSetting("index.store.throttle.max_bytes_per_sec", new ByteSizeValue(0), true, Setting.Scope.INDEX);
|
||||
public static final Setting<IndexRateLimitingType> INDEX_STORE_THROTTLE_TYPE_SETTING =
|
||||
new Setting<>("index.store.throttle.type", "none", IndexRateLimitingType::fromString, true, SettingsProperty.IndexScope);
|
||||
public static final Setting<ByteSizeValue> INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC_SETTING =
|
||||
Setting.byteSizeSetting("index.store.throttle.max_bytes_per_sec", new ByteSizeValue(0), true, SettingsProperty.IndexScope);
|
||||
|
||||
protected final IndexStoreConfig indexStoreConfig;
|
||||
private final StoreRateLimiting rateLimiting = new StoreRateLimiting();
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.lucene.store.StoreRateLimiting;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
||||
|
@ -36,11 +37,14 @@ public class IndexStoreConfig {
|
|||
/**
|
||||
* Configures the node / cluster level throttle type. See {@link StoreRateLimiting.Type}.
|
||||
*/
|
||||
public static final Setting<StoreRateLimiting.Type> INDICES_STORE_THROTTLE_TYPE_SETTING = new Setting<>("indices.store.throttle.type", StoreRateLimiting.Type.NONE.name(),StoreRateLimiting.Type::fromString, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<StoreRateLimiting.Type> INDICES_STORE_THROTTLE_TYPE_SETTING =
|
||||
new Setting<>("indices.store.throttle.type", StoreRateLimiting.Type.NONE.name(),StoreRateLimiting.Type::fromString, true,
|
||||
SettingsProperty.ClusterScope);
|
||||
/**
|
||||
* Configures the node / cluster level throttle intensity. The default is <tt>10240 MB</tt>
|
||||
*/
|
||||
public static final Setting<ByteSizeValue> INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC_SETTING = Setting.byteSizeSetting("indices.store.throttle.max_bytes_per_sec", new ByteSizeValue(0), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC_SETTING =
|
||||
Setting.byteSizeSetting("indices.store.throttle.max_bytes_per_sec", new ByteSizeValue(0), true, SettingsProperty.ClusterScope);
|
||||
private volatile StoreRateLimiting.Type rateLimitingType;
|
||||
private volatile ByteSizeValue rateLimitingThrottle;
|
||||
private final StoreRateLimiting rateLimiting = new StoreRateLimiting();
|
||||
|
|
|
@ -62,6 +62,7 @@ import org.elasticsearch.common.lucene.Lucene;
|
|||
import org.elasticsearch.common.lucene.store.ByteArrayIndexInput;
|
||||
import org.elasticsearch.common.lucene.store.InputStreamIndexInput;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.Callback;
|
||||
|
@ -129,7 +130,8 @@ public class Store extends AbstractIndexShardComponent implements Closeable, Ref
|
|||
static final int VERSION_START = 0;
|
||||
static final int VERSION = VERSION_WRITE_THROWABLE;
|
||||
static final String CORRUPTED = "corrupted_";
|
||||
public static final Setting<TimeValue> INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING = Setting.timeSetting("index.store.stats_refresh_interval", TimeValue.timeValueSeconds(10), false, Setting.Scope.INDEX);
|
||||
public static final Setting<TimeValue> INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING =
|
||||
Setting.timeSetting("index.store.stats_refresh_interval", TimeValue.timeValueSeconds(10), false, SettingsProperty.IndexScope);
|
||||
|
||||
private final AtomicBoolean isClosed = new AtomicBoolean(false);
|
||||
private final StoreDirectory directory;
|
||||
|
|
|
@ -30,10 +30,9 @@ import org.apache.lucene.search.QueryCachingPolicy;
|
|||
import org.apache.lucene.search.Scorer;
|
||||
import org.apache.lucene.search.Weight;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.lucene.ShardCoreKeyMap;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Scope;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.index.cache.query.QueryCacheStats;
|
||||
|
@ -50,9 +49,9 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
public class IndicesQueryCache extends AbstractComponent implements QueryCache, Closeable {
|
||||
|
||||
public static final Setting<ByteSizeValue> INDICES_CACHE_QUERY_SIZE_SETTING = Setting.byteSizeSetting(
|
||||
"indices.queries.cache.size", "10%", false, Scope.CLUSTER);
|
||||
"indices.queries.cache.size", "10%", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> INDICES_CACHE_QUERY_COUNT_SETTING = Setting.intSetting(
|
||||
"indices.queries.cache.count", 10000, 1, false, Scope.CLUSTER);
|
||||
"indices.queries.cache.count", 10000, 1, false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final LRUQueryCache cache;
|
||||
private final ShardCoreKeyMap shardKeyMap = new ShardCoreKeyMap();
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.elasticsearch.common.cache.RemovalNotification;
|
|||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.lucene.index.ElasticsearchDirectoryReader;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
@ -68,12 +69,12 @@ public final class IndicesRequestCache extends AbstractComponent implements Remo
|
|||
* A setting to enable or disable request caching on an index level. Its dynamic by default
|
||||
* since we are checking on the cluster state IndexMetaData always.
|
||||
*/
|
||||
public static final Setting<Boolean> INDEX_CACHE_REQUEST_ENABLED_SETTING = Setting.boolSetting("index.requests.cache.enable",
|
||||
false, true, Setting.Scope.INDEX);
|
||||
public static final Setting<ByteSizeValue> INDICES_CACHE_QUERY_SIZE = Setting.byteSizeSetting("indices.requests.cache.size", "1%",
|
||||
false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INDICES_CACHE_QUERY_EXPIRE = Setting.positiveTimeSetting("indices.requests.cache.expire",
|
||||
new TimeValue(0), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> INDEX_CACHE_REQUEST_ENABLED_SETTING =
|
||||
Setting.boolSetting("index.requests.cache.enable", false, true, SettingsProperty.IndexScope);
|
||||
public static final Setting<ByteSizeValue> INDICES_CACHE_QUERY_SIZE =
|
||||
Setting.byteSizeSetting("indices.requests.cache.size", "1%", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> INDICES_CACHE_QUERY_EXPIRE =
|
||||
Setting.positiveTimeSetting("indices.requests.cache.expire", new TimeValue(0), false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final ConcurrentMap<CleanupKey, Boolean> registeredClosedListeners = ConcurrentCollections.newConcurrentMap();
|
||||
private final Set<CleanupKey> keysToClean = ConcurrentCollections.newConcurrentSet();
|
||||
|
|
|
@ -47,6 +47,7 @@ import org.elasticsearch.common.logging.ESLogger;
|
|||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
||||
|
@ -115,7 +116,8 @@ import static org.elasticsearch.common.util.CollectionUtils.arrayAsArrayList;
|
|||
public class IndicesService extends AbstractLifecycleComponent<IndicesService> implements Iterable<IndexService>, IndexService.ShardStoreDeleter {
|
||||
|
||||
public static final String INDICES_SHARDS_CLOSED_TIMEOUT = "indices.shards_closed_timeout";
|
||||
public static final Setting<TimeValue> INDICES_CACHE_CLEAN_INTERVAL_SETTING = Setting.positiveTimeSetting("indices.cache.cleanup_interval", TimeValue.timeValueMinutes(1), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INDICES_CACHE_CLEAN_INTERVAL_SETTING =
|
||||
Setting.positiveTimeSetting("indices.cache.cleanup_interval", TimeValue.timeValueMinutes(1), false, SettingsProperty.ClusterScope);
|
||||
private final PluginsService pluginsService;
|
||||
private final NodeEnvironment nodeEnv;
|
||||
private final TimeValue shardsClosedTimeout;
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.ElasticsearchException;
|
|||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.io.FileSystemUtils;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.env.Environment;
|
||||
|
||||
|
@ -71,9 +72,12 @@ import java.util.function.Function;
|
|||
*/
|
||||
public class HunspellService extends AbstractComponent {
|
||||
|
||||
public final static Setting<Boolean> HUNSPELL_LAZY_LOAD = Setting.boolSetting("indices.analysis.hunspell.dictionary.lazy", Boolean.FALSE, false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<Boolean> HUNSPELL_IGNORE_CASE = Setting.boolSetting("indices.analysis.hunspell.dictionary.ignore_case", Boolean.FALSE, false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<Settings> HUNSPELL_DICTIONARY_OPTIONS = Setting.groupSetting("indices.analysis.hunspell.dictionary.", false, Setting.Scope.CLUSTER);
|
||||
public final static Setting<Boolean> HUNSPELL_LAZY_LOAD =
|
||||
Setting.boolSetting("indices.analysis.hunspell.dictionary.lazy", Boolean.FALSE, false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<Boolean> HUNSPELL_IGNORE_CASE =
|
||||
Setting.boolSetting("indices.analysis.hunspell.dictionary.ignore_case", Boolean.FALSE, false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<Settings> HUNSPELL_DICTIONARY_OPTIONS =
|
||||
Setting.groupSetting("indices.analysis.hunspell.dictionary.", false, SettingsProperty.ClusterScope);
|
||||
private final ConcurrentHashMap<String, Dictionary> dictionaries = new ConcurrentHashMap<>();
|
||||
private final Map<String, Dictionary> knownDictionaries;
|
||||
private final boolean defaultIgnoreCase;
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
||||
|
@ -46,15 +47,22 @@ public class HierarchyCircuitBreakerService extends CircuitBreakerService {
|
|||
|
||||
private final ConcurrentMap<String, CircuitBreaker> breakers = new ConcurrentHashMap();
|
||||
|
||||
public static final Setting<ByteSizeValue> TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING = Setting.byteSizeSetting("indices.breaker.total.limit", "70%", true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING =
|
||||
Setting.byteSizeSetting("indices.breaker.total.limit", "70%", true, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final Setting<ByteSizeValue> FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING = Setting.byteSizeSetting("indices.breaker.fielddata.limit", "60%", true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Double> FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING = Setting.doubleSetting("indices.breaker.fielddata.overhead", 1.03d, 0.0d, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<CircuitBreaker.Type> FIELDDATA_CIRCUIT_BREAKER_TYPE_SETTING = new Setting<>("indices.breaker.fielddata.type", "memory", CircuitBreaker.Type::parseValue, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING =
|
||||
Setting.byteSizeSetting("indices.breaker.fielddata.limit", "60%", true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Double> FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING =
|
||||
Setting.doubleSetting("indices.breaker.fielddata.overhead", 1.03d, 0.0d, true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<CircuitBreaker.Type> FIELDDATA_CIRCUIT_BREAKER_TYPE_SETTING =
|
||||
new Setting<>("indices.breaker.fielddata.type", "memory", CircuitBreaker.Type::parseValue, false, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final Setting<ByteSizeValue> REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING = Setting.byteSizeSetting("indices.breaker.request.limit", "40%", true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Double> REQUEST_CIRCUIT_BREAKER_OVERHEAD_SETTING = Setting.doubleSetting("indices.breaker.request.overhead", 1.0d, 0.0d, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<CircuitBreaker.Type> REQUEST_CIRCUIT_BREAKER_TYPE_SETTING = new Setting<>("indices.breaker.request.type", "memory", CircuitBreaker.Type::parseValue, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING =
|
||||
Setting.byteSizeSetting("indices.breaker.request.limit", "40%", true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Double> REQUEST_CIRCUIT_BREAKER_OVERHEAD_SETTING =
|
||||
Setting.doubleSetting("indices.breaker.request.overhead", 1.0d, 0.0d, true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<CircuitBreaker.Type> REQUEST_CIRCUIT_BREAKER_TYPE_SETTING =
|
||||
new Setting<>("indices.breaker.request.type", "memory", CircuitBreaker.Type::parseValue, false, SettingsProperty.ClusterScope);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.elasticsearch.common.lease.Releasable;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.lucene.index.ElasticsearchDirectoryReader;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.index.Index;
|
||||
|
@ -52,7 +53,8 @@ import java.util.function.ToLongBiFunction;
|
|||
*/
|
||||
public class IndicesFieldDataCache extends AbstractComponent implements RemovalListener<IndicesFieldDataCache.Key, Accountable>, Releasable{
|
||||
|
||||
public static final Setting<ByteSizeValue> INDICES_FIELDDATA_CACHE_SIZE_KEY = Setting.byteSizeSetting("indices.fielddata.cache.size", new ByteSizeValue(-1), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> INDICES_FIELDDATA_CACHE_SIZE_KEY =
|
||||
Setting.byteSizeSetting("indices.fielddata.cache.size", new ByteSizeValue(-1), false, SettingsProperty.ClusterScope);
|
||||
private final IndexFieldDataCache.Listener indicesFieldDataCacheListener;
|
||||
private final Cache<Key, Accountable> cache;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.common.component.AbstractComponent;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
@ -32,31 +33,45 @@ import org.elasticsearch.common.unit.TimeValue;
|
|||
|
||||
public class RecoverySettings extends AbstractComponent {
|
||||
|
||||
public static final Setting<ByteSizeValue> INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING = Setting.byteSizeSetting("indices.recovery.max_bytes_per_sec", new ByteSizeValue(40, ByteSizeUnit.MB), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING =
|
||||
Setting.byteSizeSetting("indices.recovery.max_bytes_per_sec", new ByteSizeValue(40, ByteSizeUnit.MB), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* how long to wait before retrying after issues cause by cluster state syncing between nodes
|
||||
* i.e., local node is not yet known on remote node, remote shard not yet started etc.
|
||||
*/
|
||||
public static final Setting<TimeValue> INDICES_RECOVERY_RETRY_DELAY_STATE_SYNC_SETTING = Setting.positiveTimeSetting("indices.recovery.retry_delay_state_sync", TimeValue.timeValueMillis(500), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INDICES_RECOVERY_RETRY_DELAY_STATE_SYNC_SETTING =
|
||||
Setting.positiveTimeSetting("indices.recovery.retry_delay_state_sync", TimeValue.timeValueMillis(500), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
/** how long to wait before retrying after network related issues */
|
||||
public static final Setting<TimeValue> INDICES_RECOVERY_RETRY_DELAY_NETWORK_SETTING = Setting.positiveTimeSetting("indices.recovery.retry_delay_network", TimeValue.timeValueSeconds(5), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INDICES_RECOVERY_RETRY_DELAY_NETWORK_SETTING =
|
||||
Setting.positiveTimeSetting("indices.recovery.retry_delay_network", TimeValue.timeValueSeconds(5), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
/** timeout value to use for requests made as part of the recovery process */
|
||||
public static final Setting<TimeValue> INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT_SETTING = Setting.positiveTimeSetting("indices.recovery.internal_action_timeout", TimeValue.timeValueMinutes(15), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT_SETTING =
|
||||
Setting.positiveTimeSetting("indices.recovery.internal_action_timeout", TimeValue.timeValueMinutes(15), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* timeout value to use for requests made as part of the recovery process that are expected to take long time.
|
||||
* defaults to twice `indices.recovery.internal_action_timeout`.
|
||||
*/
|
||||
public static final Setting<TimeValue> INDICES_RECOVERY_INTERNAL_LONG_ACTION_TIMEOUT_SETTING = Setting.timeSetting("indices.recovery.internal_action_long_timeout", (s) -> TimeValue.timeValueMillis(INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT_SETTING.get(s).millis() * 2).toString(), TimeValue.timeValueSeconds(0), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INDICES_RECOVERY_INTERNAL_LONG_ACTION_TIMEOUT_SETTING =
|
||||
Setting.timeSetting("indices.recovery.internal_action_long_timeout",
|
||||
(s) -> TimeValue.timeValueMillis(INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT_SETTING.get(s).millis() * 2).toString(),
|
||||
TimeValue.timeValueSeconds(0), true, SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* recoveries that don't show any activity for more then this interval will be failed.
|
||||
* defaults to `indices.recovery.internal_action_long_timeout`
|
||||
*/
|
||||
public static final Setting<TimeValue> INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING = Setting.timeSetting("indices.recovery.recovery_activity_timeout", (s) -> INDICES_RECOVERY_INTERNAL_LONG_ACTION_TIMEOUT_SETTING.getRaw(s) , TimeValue.timeValueSeconds(0), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING =
|
||||
Setting.timeSetting("indices.recovery.recovery_activity_timeout",
|
||||
(s) -> INDICES_RECOVERY_INTERNAL_LONG_ACTION_TIMEOUT_SETTING.getRaw(s) , TimeValue.timeValueSeconds(0), true,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
public static final ByteSizeValue DEFAULT_CHUNK_SIZE = new ByteSizeValue(512, ByteSizeUnit.KB);
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
||||
|
@ -69,7 +70,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
public class IndicesStore extends AbstractComponent implements ClusterStateListener, Closeable {
|
||||
|
||||
// TODO this class can be foled into either IndicesService and partially into IndicesClusterStateService there is no need for a separate public service
|
||||
public static final Setting<TimeValue> INDICES_STORE_DELETE_SHARD_TIMEOUT = Setting.positiveTimeSetting("indices.store.delete.shard.timeout", new TimeValue(30, TimeUnit.SECONDS), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INDICES_STORE_DELETE_SHARD_TIMEOUT =
|
||||
Setting.positiveTimeSetting("indices.store.delete.shard.timeout", new TimeValue(30, TimeUnit.SECONDS), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
public static final String ACTION_SHARD_EXISTS = "internal:index/shard/exists";
|
||||
private static final EnumSet<IndexShardState> ACTIVE_STATES = EnumSet.of(IndexShardState.STARTED, IndexShardState.RELOCATED);
|
||||
private final IndicesService indicesService;
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.lucene.uid.Versions;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
||||
|
@ -67,7 +68,8 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||
*/
|
||||
public class IndicesTTLService extends AbstractLifecycleComponent<IndicesTTLService> {
|
||||
|
||||
public static final Setting<TimeValue> INDICES_TTL_INTERVAL_SETTING = Setting.positiveTimeSetting("indices.ttl.interval", TimeValue.timeValueSeconds(60), true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> INDICES_TTL_INTERVAL_SETTING =
|
||||
Setting.positiveTimeSetting("indices.ttl.interval", TimeValue.timeValueSeconds(60), true, SettingsProperty.ClusterScope);
|
||||
|
||||
private final ClusterService clusterService;
|
||||
private final IndicesService indicesService;
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.monitor.fs;
|
|||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.SingleObjectCache;
|
||||
|
@ -37,7 +38,8 @@ public class FsService extends AbstractComponent {
|
|||
private final SingleObjectCache<FsInfo> fsStatsCache;
|
||||
|
||||
public final static Setting<TimeValue> REFRESH_INTERVAL_SETTING =
|
||||
Setting.timeSetting("monitor.fs.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false, Setting.Scope.CLUSTER);
|
||||
Setting.timeSetting("monitor.fs.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
public FsService(Settings settings, NodeEnvironment nodeEnvironment) throws IOException {
|
||||
super(settings);
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.monitor.jvm;
|
|||
|
||||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Scope;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.FutureUtils;
|
||||
|
@ -47,12 +47,14 @@ public class JvmGcMonitorService extends AbstractLifecycleComponent<JvmGcMonitor
|
|||
|
||||
private volatile ScheduledFuture scheduledFuture;
|
||||
|
||||
public final static Setting<Boolean> ENABLED_SETTING = Setting.boolSetting("monitor.jvm.gc.enabled", true, false, Scope.CLUSTER);
|
||||
public final static Setting<Boolean> ENABLED_SETTING =
|
||||
Setting.boolSetting("monitor.jvm.gc.enabled", true, false, SettingsProperty.ClusterScope);
|
||||
public final static Setting<TimeValue> REFRESH_INTERVAL_SETTING =
|
||||
Setting.timeSetting("monitor.jvm.gc.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false, Scope.CLUSTER);
|
||||
Setting.timeSetting("monitor.jvm.gc.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
private static String GC_COLLECTOR_PREFIX = "monitor.jvm.gc.collector.";
|
||||
public final static Setting<Settings> GC_SETTING = Setting.groupSetting(GC_COLLECTOR_PREFIX, false, Scope.CLUSTER);
|
||||
public final static Setting<Settings> GC_SETTING = Setting.groupSetting(GC_COLLECTOR_PREFIX, false, SettingsProperty.ClusterScope);
|
||||
|
||||
static class GcThreshold {
|
||||
public final String name;
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.monitor.jvm;
|
|||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
||||
|
@ -36,7 +37,8 @@ public class JvmService extends AbstractComponent {
|
|||
private JvmStats jvmStats;
|
||||
|
||||
public final static Setting<TimeValue> REFRESH_INTERVAL_SETTING =
|
||||
Setting.timeSetting("monitor.jvm.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false, Setting.Scope.CLUSTER);
|
||||
Setting.timeSetting("monitor.jvm.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
public JvmService(Settings settings) {
|
||||
super(settings);
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.monitor.os;
|
|||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.SingleObjectCache;
|
||||
|
@ -38,7 +39,8 @@ public class OsService extends AbstractComponent {
|
|||
private SingleObjectCache<OsStats> osStatsCache;
|
||||
|
||||
public final static Setting<TimeValue> REFRESH_INTERVAL_SETTING =
|
||||
Setting.timeSetting("monitor.os.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false, Setting.Scope.CLUSTER);
|
||||
Setting.timeSetting("monitor.os.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
public OsService(Settings settings) {
|
||||
super(settings);
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.monitor.process;
|
|||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.SingleObjectCache;
|
||||
|
@ -35,7 +36,8 @@ public final class ProcessService extends AbstractComponent {
|
|||
private final SingleObjectCache<ProcessStats> processStatsCache;
|
||||
|
||||
public final static Setting<TimeValue> REFRESH_INTERVAL_SETTING =
|
||||
Setting.timeSetting("monitor.process.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false, Setting.Scope.CLUSTER);
|
||||
Setting.timeSetting("monitor.process.refresh_interval", TimeValue.timeValueSeconds(1), TimeValue.timeValueSeconds(1), false,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
public ProcessService(Settings settings) {
|
||||
super(settings);
|
||||
|
|
|
@ -49,6 +49,7 @@ import org.elasticsearch.common.network.NetworkModule;
|
|||
import org.elasticsearch.common.network.NetworkService;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
import org.elasticsearch.common.settings.SettingsModule;
|
||||
|
@ -124,17 +125,23 @@ import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
|||
*/
|
||||
public class Node implements Closeable {
|
||||
|
||||
public static final Setting<Boolean> WRITE_PORTS_FIELD_SETTING = Setting.boolSetting("node.portsfile", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> NODE_CLIENT_SETTING = Setting.boolSetting("node.client", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> NODE_DATA_SETTING = Setting.boolSetting("node.data", true, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> NODE_MASTER_SETTING = Setting.boolSetting("node.master", true, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> NODE_LOCAL_SETTING = Setting.boolSetting("node.local", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> NODE_MODE_SETTING = new Setting<>("node.mode", "network", Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> NODE_INGEST_SETTING = Setting.boolSetting("node.ingest", true, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> NODE_NAME_SETTING = Setting.simpleString("node.name", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> WRITE_PORTS_FIELD_SETTING =
|
||||
Setting.boolSetting("node.portsfile", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> NODE_CLIENT_SETTING =
|
||||
Setting.boolSetting("node.client", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> NODE_DATA_SETTING = Setting.boolSetting("node.data", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> NODE_MASTER_SETTING =
|
||||
Setting.boolSetting("node.master", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> NODE_LOCAL_SETTING =
|
||||
Setting.boolSetting("node.local", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> NODE_MODE_SETTING =
|
||||
new Setting<>("node.mode", "network", Function.identity(), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> NODE_INGEST_SETTING =
|
||||
Setting.boolSetting("node.ingest", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> NODE_NAME_SETTING = Setting.simpleString("node.name", false, SettingsProperty.ClusterScope);
|
||||
// this sucks that folks can mistype client etc and get away with it.
|
||||
// TODO: we should move this to node.attribute.${name} = ${value} instead.
|
||||
public static final Setting<Settings> NODE_ATTRIBUTES = Setting.groupSetting("node.", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Settings> NODE_ATTRIBUTES = Setting.groupSetting("node.", false, SettingsProperty.ClusterScope);
|
||||
|
||||
|
||||
private static final String CLIENT_TYPE = "node";
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.common.Strings;
|
|||
import org.elasticsearch.common.cli.Terminal;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsException;
|
||||
import org.elasticsearch.env.Environment;
|
||||
|
@ -57,7 +58,8 @@ public class InternalSettingsPreparer {
|
|||
|
||||
public static final String SECRET_PROMPT_VALUE = "${prompt.secret}";
|
||||
public static final String TEXT_PROMPT_VALUE = "${prompt.text}";
|
||||
public static final Setting<Boolean> IGNORE_SYSTEM_PROPERTIES_SETTING = Setting.boolSetting("config.ignore_system_properties", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> IGNORE_SYSTEM_PROPERTIES_SETTING =
|
||||
Setting.boolSetting("config.ignore_system_properties", false, false, SettingsProperty.ClusterScope);
|
||||
|
||||
/**
|
||||
* Prepares the settings by gathering all elasticsearch system properties and setting defaults.
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.elasticsearch.common.io.FileSystemUtils;
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.IndexModule;
|
||||
|
||||
|
@ -71,7 +72,8 @@ public class PluginsService extends AbstractComponent {
|
|||
*/
|
||||
private final List<Tuple<PluginInfo, Plugin>> plugins;
|
||||
private final PluginsAndModules info;
|
||||
public static final Setting<List<String>> MANDATORY_SETTING = Setting.listSetting("plugin.mandatory", Collections.emptyList(), Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<List<String>> MANDATORY_SETTING =
|
||||
Setting.listSetting("plugin.mandatory", Collections.emptyList(), Function.identity(), false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final Map<Plugin, List<OnModuleReference>> onModuleReferences;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.common.blobstore.BlobStore;
|
|||
import org.elasticsearch.common.blobstore.fs.FsBlobStore;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.index.snapshots.IndexShardRepository;
|
||||
|
@ -51,12 +52,17 @@ public class FsRepository extends BlobStoreRepository {
|
|||
|
||||
public final static String TYPE = "fs";
|
||||
|
||||
public static final Setting<String> LOCATION_SETTING = new Setting<>("location", "", Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> REPOSITORIES_LOCATION_SETTING = new Setting<>("repositories.fs.location", LOCATION_SETTING, Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> CHUNK_SIZE_SETTING = Setting.byteSizeSetting("chunk_size", "-1", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> REPOSITORIES_CHUNK_SIZE_SETTING = Setting.byteSizeSetting("repositories.fs.chunk_size", "-1", false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> COMPRESS_SETTING = Setting.boolSetting("compress", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> REPOSITORIES_COMPRESS_SETTING = Setting.boolSetting("repositories.fs.compress", false, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<String> LOCATION_SETTING =
|
||||
new Setting<>("location", "", Function.identity(), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> REPOSITORIES_LOCATION_SETTING =
|
||||
new Setting<>("repositories.fs.location", LOCATION_SETTING, Function.identity(), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> CHUNK_SIZE_SETTING =
|
||||
Setting.byteSizeSetting("chunk_size", "-1", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> REPOSITORIES_CHUNK_SIZE_SETTING =
|
||||
Setting.byteSizeSetting("repositories.fs.chunk_size", "-1", false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> COMPRESS_SETTING = Setting.boolSetting("compress", false, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> REPOSITORIES_COMPRESS_SETTING =
|
||||
Setting.boolSetting("repositories.fs.compress", false, false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final FsBlobStore blobStore;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.common.blobstore.BlobStore;
|
|||
import org.elasticsearch.common.blobstore.url.URLBlobStore;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.util.URIPattern;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.index.snapshots.IndexShardRepository;
|
||||
|
@ -55,19 +56,24 @@ public class URLRepository extends BlobStoreRepository {
|
|||
|
||||
public final static String TYPE = "url";
|
||||
|
||||
public static final Setting<List<String>> SUPPORTED_PROTOCOLS_SETTING = Setting.listSetting("repositories.url.supported_protocols",
|
||||
Arrays.asList("http", "https", "ftp", "file", "jar"), Function.identity(), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<List<String>> SUPPORTED_PROTOCOLS_SETTING =
|
||||
Setting.listSetting("repositories.url.supported_protocols", Arrays.asList("http", "https", "ftp", "file", "jar"),
|
||||
Function.identity(), false, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final Setting<List<URIPattern>> ALLOWED_URLS_SETTING = Setting.listSetting("repositories.url.allowed_urls",
|
||||
Collections.emptyList(), URIPattern::new, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<List<URIPattern>> ALLOWED_URLS_SETTING =
|
||||
Setting.listSetting("repositories.url.allowed_urls", Collections.emptyList(), URIPattern::new, false,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
public static final Setting<URL> URL_SETTING = new Setting<>("url", "http:", URLRepository::parseURL, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<URL> REPOSITORIES_URL_SETTING = new Setting<>("repositories.url.url", (s) -> s.get("repositories.uri.url", "http:"),
|
||||
URLRepository::parseURL, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<URL> URL_SETTING =
|
||||
new Setting<>("url", "http:", URLRepository::parseURL, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<URL> REPOSITORIES_URL_SETTING =
|
||||
new Setting<>("repositories.url.url", (s) -> s.get("repositories.uri.url", "http:"), URLRepository::parseURL, false,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
public static final Setting<Boolean> LIST_DIRECTORIES_SETTING = Setting.boolSetting("list_directories", true, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> REPOSITORIES_LIST_DIRECTORIES_SETTING = Setting.boolSetting("repositories.uri.list_directories", true,
|
||||
false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> LIST_DIRECTORIES_SETTING =
|
||||
Setting.boolSetting("list_directories", true, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> REPOSITORIES_LIST_DIRECTORIES_SETTING =
|
||||
Setting.boolSetting("repositories.uri.list_directories", true, false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final List<String> supportedProtocols;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.elasticsearch.client.Client;
|
|||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +35,8 @@ import org.elasticsearch.common.settings.Settings;
|
|||
* {@link org.elasticsearch.rest.RestController#registerRelevantHeaders(String...)}
|
||||
*/
|
||||
public abstract class BaseRestHandler extends AbstractComponent implements RestHandler {
|
||||
public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX = Setting.boolSetting("rest.action.multi.allow_explicit_index", true, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX =
|
||||
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, false, SettingsProperty.ClusterScope);
|
||||
private final Client client;
|
||||
protected final ParseFieldMatcher parseFieldMatcher;
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.elasticsearch.common.io.Streams;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
||||
|
@ -84,10 +85,13 @@ public class ScriptService extends AbstractComponent implements Closeable {
|
|||
|
||||
static final String DISABLE_DYNAMIC_SCRIPTING_SETTING = "script.disable_dynamic";
|
||||
|
||||
public static final Setting<Integer> SCRIPT_CACHE_SIZE_SETTING = Setting.intSetting("script.cache.max_size", 100, 0, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> SCRIPT_CACHE_EXPIRE_SETTING = Setting.positiveTimeSetting("script.cache.expire", TimeValue.timeValueMillis(0), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> SCRIPT_CACHE_SIZE_SETTING =
|
||||
Setting.intSetting("script.cache.max_size", 100, 0, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> SCRIPT_CACHE_EXPIRE_SETTING =
|
||||
Setting.positiveTimeSetting("script.cache.expire", TimeValue.timeValueMillis(0), false, SettingsProperty.ClusterScope);
|
||||
public static final String SCRIPT_INDEX = ".scripts";
|
||||
public static final Setting<Boolean> SCRIPT_AUTO_RELOAD_ENABLED_SETTING = Setting.boolSetting("script.auto_reload_enabled", true, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> SCRIPT_AUTO_RELOAD_ENABLED_SETTING =
|
||||
Setting.boolSetting("script.auto_reload_enabled", true, false, SettingsProperty.ClusterScope);
|
||||
|
||||
private final String defaultLang;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.script;
|
|||
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -45,7 +46,7 @@ public class ScriptSettings {
|
|||
scriptType.getDefaultScriptMode().getMode(),
|
||||
ScriptMode::parse,
|
||||
false,
|
||||
Setting.Scope.CLUSTER));
|
||||
SettingsProperty.ClusterScope));
|
||||
}
|
||||
SCRIPT_TYPE_SETTING_MAP = Collections.unmodifiableMap(scriptTypeSettingMap);
|
||||
}
|
||||
|
@ -66,7 +67,7 @@ public class ScriptSettings {
|
|||
throw new IllegalArgumentException("unregistered default language [" + setting + "]");
|
||||
}
|
||||
return setting;
|
||||
}, false, Setting.Scope.CLUSTER);
|
||||
}, false, SettingsProperty.ClusterScope);
|
||||
}
|
||||
|
||||
private static Map<ScriptContext, Setting<ScriptMode>> contextSettings(ScriptContextRegistry scriptContextRegistry) {
|
||||
|
@ -77,7 +78,7 @@ public class ScriptSettings {
|
|||
ScriptMode.OFF.getMode(),
|
||||
ScriptMode::parse,
|
||||
false,
|
||||
Setting.Scope.CLUSTER
|
||||
SettingsProperty.ClusterScope
|
||||
));
|
||||
}
|
||||
return scriptContextSettingMap;
|
||||
|
@ -138,7 +139,7 @@ public class ScriptSettings {
|
|||
defaultSetting,
|
||||
ScriptMode::parse,
|
||||
false,
|
||||
Setting.Scope.CLUSTER);
|
||||
SettingsProperty.ClusterScope);
|
||||
scriptModeSettings.add(setting);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.BigArrays;
|
||||
|
@ -106,11 +107,14 @@ import static org.elasticsearch.common.unit.TimeValue.timeValueMinutes;
|
|||
public class SearchService extends AbstractLifecycleComponent<SearchService> implements IndexEventListener {
|
||||
|
||||
// we can have 5 minutes here, since we make sure to clean with search requests and when shard/index closes
|
||||
public static final Setting<TimeValue> DEFAULT_KEEPALIVE_SETTING = Setting.positiveTimeSetting("search.default_keep_alive", timeValueMinutes(5), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> KEEPALIVE_INTERVAL_SETTING = Setting.positiveTimeSetting("search.keep_alive_interval", timeValueMinutes(1), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> DEFAULT_KEEPALIVE_SETTING =
|
||||
Setting.positiveTimeSetting("search.default_keep_alive", timeValueMinutes(5), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> KEEPALIVE_INTERVAL_SETTING =
|
||||
Setting.positiveTimeSetting("search.keep_alive_interval", timeValueMinutes(1), false, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final TimeValue NO_TIMEOUT = timeValueMillis(-1);
|
||||
public static final Setting<TimeValue> DEFAULT_SEARCH_TIMEOUT_SETTING = Setting.timeSetting("search.default_search_timeout", NO_TIMEOUT, true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> DEFAULT_SEARCH_TIMEOUT_SETTING =
|
||||
Setting.timeSetting("search.default_search_timeout", NO_TIMEOUT, true, SettingsProperty.ClusterScope);
|
||||
|
||||
|
||||
private final ThreadPool threadPool;
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsException;
|
||||
import org.elasticsearch.common.unit.SizeValue;
|
||||
|
@ -188,7 +189,8 @@ public class ThreadPool extends AbstractComponent implements Closeable {
|
|||
}
|
||||
}
|
||||
|
||||
public static final Setting<Settings> THREADPOOL_GROUP_SETTING = Setting.groupSetting("threadpool.", true, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Settings> THREADPOOL_GROUP_SETTING =
|
||||
Setting.groupSetting("threadpool.", true, SettingsProperty.ClusterScope);
|
||||
|
||||
private volatile Map<String, ExecutorHolder> executors;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.transport;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.transport.BoundTransportAddress;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
|
||||
|
@ -35,7 +36,7 @@ import java.util.Map;
|
|||
public interface Transport extends LifecycleComponent<Transport> {
|
||||
|
||||
|
||||
Setting<Boolean> TRANSPORT_TCP_COMPRESS = Setting.boolSetting("transport.tcp.compress", false, false, Setting.Scope.CLUSTER);
|
||||
Setting<Boolean> TRANSPORT_TCP_COMPRESS = Setting.boolSetting("transport.tcp.compress", false, false, SettingsProperty.ClusterScope);
|
||||
|
||||
void transportServiceAdapter(TransportServiceAdapter service);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.elasticsearch.common.metrics.MeanMetric;
|
|||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Scope;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.BoundTransportAddress;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
|
@ -98,10 +98,11 @@ public class TransportService extends AbstractLifecycleComponent<TransportServic
|
|||
|
||||
// tracer log
|
||||
|
||||
public static final Setting<List<String>> TRACE_LOG_INCLUDE_SETTING = listSetting("transport.tracer.include", emptyList(),
|
||||
Function.identity(), true, Scope.CLUSTER);
|
||||
public static final Setting<List<String>> TRACE_LOG_EXCLUDE_SETTING = listSetting("transport.tracer.exclude",
|
||||
Arrays.asList("internal:discovery/zen/fd*", TransportLivenessAction.NAME), Function.identity(), true, Scope.CLUSTER);
|
||||
public static final Setting<List<String>> TRACE_LOG_INCLUDE_SETTING =
|
||||
listSetting("transport.tracer.include", emptyList(), Function.identity(), true, SettingsProperty.ClusterScope);
|
||||
public static final Setting<List<String>> TRACE_LOG_EXCLUDE_SETTING =
|
||||
listSetting("transport.tracer.exclude", Arrays.asList("internal:discovery/zen/fd*", TransportLivenessAction.NAME),
|
||||
Function.identity(), true, SettingsProperty.ClusterScope);
|
||||
|
||||
private final ESLogger tracerLog;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.elasticsearch.transport;
|
||||
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Scope;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -35,13 +35,19 @@ import static org.elasticsearch.common.settings.Setting.listSetting;
|
|||
*/
|
||||
final public class TransportSettings {
|
||||
|
||||
public static final Setting<List<String>> HOST = listSetting("transport.host", emptyList(), s -> s, false, Scope.CLUSTER);
|
||||
public static final Setting<List<String>> PUBLISH_HOST = listSetting("transport.publish_host", HOST, s -> s, false, Scope.CLUSTER);
|
||||
public static final Setting<List<String>> BIND_HOST = listSetting("transport.bind_host", HOST, s -> s, false, Scope.CLUSTER);
|
||||
public static final Setting<String> PORT = new Setting<>("transport.tcp.port", "9300-9400", s -> s, false, Scope.CLUSTER);
|
||||
public static final Setting<Integer> PUBLISH_PORT = intSetting("transport.publish_port", -1, -1, false, Scope.CLUSTER);
|
||||
public static final Setting<List<String>> HOST =
|
||||
listSetting("transport.host", emptyList(), s -> s, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<List<String>> PUBLISH_HOST =
|
||||
listSetting("transport.publish_host", HOST, s -> s, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<List<String>> BIND_HOST =
|
||||
listSetting("transport.bind_host", HOST, s -> s, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<String> PORT =
|
||||
new Setting<>("transport.tcp.port", "9300-9400", s -> s, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> PUBLISH_PORT =
|
||||
intSetting("transport.publish_port", -1, -1, false, SettingsProperty.ClusterScope);
|
||||
public static final String DEFAULT_PROFILE = "default";
|
||||
public static final Setting<Settings> TRANSPORT_PROFILES_SETTING = groupSetting("transport.profiles.", true, Scope.CLUSTER);
|
||||
public static final Setting<Settings> TRANSPORT_PROFILES_SETTING =
|
||||
groupSetting("transport.profiles.", true, SettingsProperty.ClusterScope);
|
||||
|
||||
private TransportSettings() {
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.elasticsearch.common.network.NetworkService;
|
|||
import org.elasticsearch.common.network.NetworkService.TcpSettings;
|
||||
import org.elasticsearch.common.network.NetworkUtils;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Scope;
|
||||
import org.elasticsearch.common.settings.Setting.SettingsProperty;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.BoundTransportAddress;
|
||||
import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
||||
|
@ -147,40 +147,46 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
public static final String TRANSPORT_CLIENT_WORKER_THREAD_NAME_PREFIX = "transport_client_worker";
|
||||
public static final String TRANSPORT_CLIENT_BOSS_THREAD_NAME_PREFIX = "transport_client_boss";
|
||||
|
||||
public static final Setting<Integer> WORKER_COUNT = new Setting<>("transport.netty.worker_count",
|
||||
public static final Setting<Integer> WORKER_COUNT =
|
||||
new Setting<>("transport.netty.worker_count",
|
||||
(s) -> Integer.toString(EsExecutors.boundedNumberOfProcessors(s) * 2),
|
||||
(s) -> Setting.parseInt(s, 1, "transport.netty.worker_count"), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> CONNECTIONS_PER_NODE_RECOVERY = intSetting("transport.connections_per_node.recovery", 2, 1, false,
|
||||
Scope.CLUSTER);
|
||||
public static final Setting<Integer> CONNECTIONS_PER_NODE_BULK = intSetting("transport.connections_per_node.bulk", 3, 1, false,
|
||||
Scope.CLUSTER);
|
||||
public static final Setting<Integer> CONNECTIONS_PER_NODE_REG = intSetting("transport.connections_per_node.reg", 6, 1, false,
|
||||
Scope.CLUSTER);
|
||||
public static final Setting<Integer> CONNECTIONS_PER_NODE_STATE = intSetting("transport.connections_per_node.state", 1, 1, false,
|
||||
Scope.CLUSTER);
|
||||
public static final Setting<Integer> CONNECTIONS_PER_NODE_PING = intSetting("transport.connections_per_node.ping", 1, 1, false,
|
||||
Scope.CLUSTER);
|
||||
(s) -> Setting.parseInt(s, 1, "transport.netty.worker_count"), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> CONNECTIONS_PER_NODE_RECOVERY =
|
||||
intSetting("transport.connections_per_node.recovery", 2, 1, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> CONNECTIONS_PER_NODE_BULK =
|
||||
intSetting("transport.connections_per_node.bulk", 3, 1, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> CONNECTIONS_PER_NODE_REG =
|
||||
intSetting("transport.connections_per_node.reg", 6, 1, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> CONNECTIONS_PER_NODE_STATE =
|
||||
intSetting("transport.connections_per_node.state", 1, 1, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> CONNECTIONS_PER_NODE_PING =
|
||||
intSetting("transport.connections_per_node.ping", 1, 1, false, SettingsProperty.ClusterScope);
|
||||
// the scheduled internal ping interval setting, defaults to disabled (-1)
|
||||
public static final Setting<TimeValue> PING_SCHEDULE = timeSetting("transport.ping_schedule", TimeValue.timeValueSeconds(-1), false,
|
||||
Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_BLOCKING_CLIENT = boolSetting("transport.tcp.blocking_client", TcpSettings.TCP_BLOCKING_CLIENT,
|
||||
false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> TCP_CONNECT_TIMEOUT = timeSetting("transport.tcp.connect_timeout",
|
||||
TcpSettings.TCP_CONNECT_TIMEOUT, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_NO_DELAY = boolSetting("transport.tcp_no_delay", TcpSettings.TCP_NO_DELAY, false,
|
||||
Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_KEEP_ALIVE = boolSetting("transport.tcp.keep_alive", TcpSettings.TCP_KEEP_ALIVE, false,
|
||||
Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_BLOCKING_SERVER = boolSetting("transport.tcp.blocking_server", TcpSettings.TCP_BLOCKING_SERVER,
|
||||
false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Boolean> TCP_REUSE_ADDRESS = boolSetting("transport.tcp.reuse_address", TcpSettings.TCP_REUSE_ADDRESS,
|
||||
false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<TimeValue> PING_SCHEDULE =
|
||||
timeSetting("transport.ping_schedule", TimeValue.timeValueSeconds(-1), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> TCP_BLOCKING_CLIENT =
|
||||
boolSetting("transport.tcp.blocking_client", TcpSettings.TCP_BLOCKING_CLIENT, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<TimeValue> TCP_CONNECT_TIMEOUT =
|
||||
timeSetting("transport.tcp.connect_timeout", TcpSettings.TCP_CONNECT_TIMEOUT, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> TCP_NO_DELAY =
|
||||
boolSetting("transport.tcp_no_delay", TcpSettings.TCP_NO_DELAY, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> TCP_KEEP_ALIVE =
|
||||
boolSetting("transport.tcp.keep_alive", TcpSettings.TCP_KEEP_ALIVE, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> TCP_BLOCKING_SERVER =
|
||||
boolSetting("transport.tcp.blocking_server", TcpSettings.TCP_BLOCKING_SERVER, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Boolean> TCP_REUSE_ADDRESS =
|
||||
boolSetting("transport.tcp.reuse_address", TcpSettings.TCP_REUSE_ADDRESS, false, SettingsProperty.ClusterScope);
|
||||
|
||||
public static final Setting<ByteSizeValue> TCP_SEND_BUFFER_SIZE = Setting.byteSizeSetting("transport.tcp.send_buffer_size", TcpSettings.TCP_SEND_BUFFER_SIZE, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> TCP_RECEIVE_BUFFER_SIZE = Setting.byteSizeSetting("transport.tcp.receive_buffer_size", TcpSettings.TCP_RECEIVE_BUFFER_SIZE, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> TCP_SEND_BUFFER_SIZE =
|
||||
Setting.byteSizeSetting("transport.tcp.send_buffer_size", TcpSettings.TCP_SEND_BUFFER_SIZE, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> TCP_RECEIVE_BUFFER_SIZE =
|
||||
Setting.byteSizeSetting("transport.tcp.receive_buffer_size", TcpSettings.TCP_RECEIVE_BUFFER_SIZE, false,
|
||||
SettingsProperty.ClusterScope);
|
||||
|
||||
public static final Setting<ByteSizeValue> NETTY_MAX_CUMULATION_BUFFER_CAPACITY = Setting.byteSizeSetting("transport.netty.max_cumulation_buffer_capacity", new ByteSizeValue(-1), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Integer> NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS = Setting.intSetting("transport.netty.max_composite_buffer_components", -1, -1, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> NETTY_MAX_CUMULATION_BUFFER_CAPACITY =
|
||||
Setting.byteSizeSetting("transport.netty.max_cumulation_buffer_capacity", new ByteSizeValue(-1), false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS =
|
||||
Setting.intSetting("transport.netty.max_composite_buffer_components", -1, -1, false, SettingsProperty.ClusterScope);
|
||||
|
||||
// See AdaptiveReceiveBufferSizePredictor#DEFAULT_XXX for default values in netty..., we can use higher ones for us, even fixed one
|
||||
public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_SIZE = Setting.byteSizeSetting(
|
||||
|
@ -193,12 +199,13 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
defaultReceiverPredictor = Math.min(defaultReceiverPredictor, Math.max(l, 64 * 1024));
|
||||
}
|
||||
return new ByteSizeValue(defaultReceiverPredictor).toString();
|
||||
}, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_MIN = byteSizeSetting("transport.netty.receive_predictor_min",
|
||||
NETTY_RECEIVE_PREDICTOR_SIZE, false, Scope.CLUSTER);
|
||||
public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_MAX = byteSizeSetting("transport.netty.receive_predictor_max",
|
||||
NETTY_RECEIVE_PREDICTOR_SIZE, false, Scope.CLUSTER);
|
||||
public static final Setting<Integer> NETTY_BOSS_COUNT = intSetting("transport.netty.boss_count", 1, 1, false, Scope.CLUSTER);
|
||||
}, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_MIN =
|
||||
byteSizeSetting("transport.netty.receive_predictor_min", NETTY_RECEIVE_PREDICTOR_SIZE, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_MAX =
|
||||
byteSizeSetting("transport.netty.receive_predictor_max", NETTY_RECEIVE_PREDICTOR_SIZE, false, SettingsProperty.ClusterScope);
|
||||
public static final Setting<Integer> NETTY_BOSS_COUNT =
|
||||
intSetting("transport.netty.boss_count", 1, 1, false, SettingsProperty.ClusterScope);
|
||||
|
||||
protected final NetworkService networkService;
|
||||
protected final Version version;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue