Java Code Examples for org.elasticsearch.common.settings.Settings#getAsTime()
The following examples show how to use
org.elasticsearch.common.settings.Settings#getAsTime() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NodesFailureDetectionService.java From Elasticsearch with Apache License 2.0 | 6 votes |
public NodesFailureDetectionService(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterName clusterName, ClusterService clusterService, RoutingService routingService, JoinClusterAction joinClusterAction, ClusterStateOpLog clusterStateOpLog) { super(settings); this.pingInterval = settings.getAsTime(SETTING_PING_INTERVAL, timeValueSeconds(1)); this.pingTimeout = settings.getAsTime(SETTING_PING_TIMEOUT, timeValueSeconds(5)); this.pingRetryCount = settings.getAsInt(SETTING_PING_RETRIES, 3); this.threadPool = threadPool; this.transportService = transportService; this.clusterName = clusterName; this.clusterService = clusterService; this.routingService = routingService; this.joinClusterAction = joinClusterAction; this.clusterStateOpLog = clusterStateOpLog; this.localNode = clusterService.localNode(); logger.debug("[node ] uses ping_interval [{}], ping_timeout [{}], ping_retries [{}]", pingInterval, pingTimeout, pingRetryCount); transportService.registerRequestHandler(PING_ACTION_NAME, PingRequest.class, ThreadPool.Names.SAME, new PingRequestHandler()); }
Example 2
Source File: TranslogConfig.java From Elasticsearch with Apache License 2.0 | 6 votes |
/** * Creates a new TranslogConfig instance * @param shardId the shard ID this translog belongs to * @param translogPath the path to use for the transaction log files * @param indexSettings the index settings used to set internal variables * @param durabilty the default durability setting for the translog * @param bigArrays a bigArrays instance used for temporarily allocating write operations * @param threadPool a {@link ThreadPool} to schedule async sync durability */ public TranslogConfig(ShardId shardId, Path translogPath, Settings indexSettings, Translog.Durabilty durabilty, BigArrays bigArrays, @Nullable ThreadPool threadPool) { this.indexSettings = indexSettings; this.shardId = shardId; this.translogPath = translogPath; this.durabilty = durabilty; this.threadPool = threadPool; this.bigArrays = bigArrays; this.type = TranslogWriter.Type.fromString(indexSettings.get(INDEX_TRANSLOG_FS_TYPE, TranslogWriter.Type.BUFFERED.name())); this.bufferSize = (int) indexSettings.getAsBytesSize(INDEX_TRANSLOG_BUFFER_SIZE, IndexingMemoryController.INACTIVE_SHARD_TRANSLOG_BUFFER).bytes(); // Not really interesting, updated by IndexingMemoryController... syncInterval = indexSettings.getAsTime(INDEX_TRANSLOG_SYNC_INTERVAL, TimeValue.timeValueSeconds(5)); if (syncInterval.millis() > 0 && threadPool != null) { syncOnEachOperation = false; } else if (syncInterval.millis() == 0) { syncOnEachOperation = true; } else { syncOnEachOperation = false; } }
Example 3
Source File: FaultDetection.java From Elasticsearch with Apache License 2.0 | 6 votes |
public FaultDetection(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterName clusterName) { super(settings); this.threadPool = threadPool; this.transportService = transportService; this.clusterName = clusterName; this.connectOnNetworkDisconnect = settings.getAsBoolean(SETTING_CONNECT_ON_NETWORK_DISCONNECT, false); this.pingInterval = settings.getAsTime(SETTING_PING_INTERVAL, timeValueSeconds(1)); this.pingRetryTimeout = settings.getAsTime(SETTING_PING_TIMEOUT, timeValueSeconds(30)); this.pingRetryCount = settings.getAsInt(SETTING_PING_RETRIES, 3); this.registerConnectionListener = settings.getAsBoolean(SETTING_REGISTER_CONNECTION_LISTENER, true); this.connectionListener = new FDConnectionListener(); if (registerConnectionListener) { transportService.addConnectionListener(connectionListener); } }
Example 4
Source File: ResourceWatcherService.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Inject public ResourceWatcherService(Settings settings, ThreadPool threadPool) { super(settings); this.enabled = settings.getAsBoolean("resource.reload.enabled", true); this.threadPool = threadPool; TimeValue interval = settings.getAsTime("resource.reload.interval.low", Frequency.LOW.interval); lowMonitor = new ResourceMonitor(interval, Frequency.LOW); interval = settings.getAsTime("resource.reload.interval.medium", settings.getAsTime("resource.reload.interval", Frequency.MEDIUM.interval)); mediumMonitor = new ResourceMonitor(interval, Frequency.MEDIUM); interval = settings.getAsTime("resource.reload.interval.high", Frequency.HIGH.interval); highMonitor = new ResourceMonitor(interval, Frequency.HIGH); logRemovedSetting("watcher.enabled", "resource.reload.enabled"); logRemovedSetting("watcher.interval", "resource.reload.interval"); logRemovedSetting("watcher.interval.low", "resource.reload.interval.low"); logRemovedSetting("watcher.interval.medium", "resource.reload.interval.medium"); logRemovedSetting("watcher.interval.high", "resource.reload.interval.high"); }
Example 5
Source File: PublishClusterStateVersionAction.java From Elasticsearch with Apache License 2.0 | 5 votes |
public PublishClusterStateVersionAction(Settings settings, ClusterService clusterService, TransportService transportService, ClusterStateOpLog clusterStateOpLog) { super(settings); this.clusterService = clusterService; this.transportService = transportService; this.clusterStateOpLog = clusterStateOpLog; this.pullFullClusterStateAction = new PullFullClusterStateAction(settings, clusterService, transportService, clusterStateOpLog); this.fullStateSyncOps = settings.getAsLong(SETTING_FULL_STATE_SYNC_THRESHOLD, 30L); this.publishTimeout = settings.getAsTime(PUBLISH_TIMEOUT, publishTimeout); this.transportService.registerRequestHandler(PUBLISH_VERSION_ACTION_NAME, BytesTransportRequest.class, ThreadPool.Names.GENERIC, new PublishClusterStateVersionRequestHandler()); }
Example 6
Source File: TranslogService.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public void onRefreshSettings(Settings settings) { int flushThresholdOperations = settings.getAsInt(INDEX_TRANSLOG_FLUSH_THRESHOLD_OPS, TranslogService.this.flushThresholdOperations); if (flushThresholdOperations != TranslogService.this.flushThresholdOperations) { logger.info("updating flush_threshold_ops from [{}] to [{}]", TranslogService.this.flushThresholdOperations, flushThresholdOperations); TranslogService.this.flushThresholdOperations = flushThresholdOperations; } ByteSizeValue flushThresholdSize = settings.getAsBytesSize(INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE, TranslogService.this.flushThresholdSize); if (!flushThresholdSize.equals(TranslogService.this.flushThresholdSize)) { logger.info("updating flush_threshold_size from [{}] to [{}]", TranslogService.this.flushThresholdSize, flushThresholdSize); TranslogService.this.flushThresholdSize = flushThresholdSize; } TimeValue flushThresholdPeriod = settings.getAsTime(INDEX_TRANSLOG_FLUSH_THRESHOLD_PERIOD, TranslogService.this.flushThresholdPeriod); if (!flushThresholdPeriod.equals(TranslogService.this.flushThresholdPeriod)) { logger.info("updating flush_threshold_period from [{}] to [{}]", TranslogService.this.flushThresholdPeriod, flushThresholdPeriod); TranslogService.this.flushThresholdPeriod = flushThresholdPeriod; } TimeValue interval = settings.getAsTime(INDEX_TRANSLOG_FLUSH_INTERVAL, TranslogService.this.interval); if (!interval.equals(TranslogService.this.interval)) { logger.info("updating interval from [{}] to [{}]", TranslogService.this.interval, interval); TranslogService.this.interval = interval; } boolean disableFlush = settings.getAsBoolean(INDEX_TRANSLOG_DISABLE_FLUSH, TranslogService.this.disableFlush); if (disableFlush != TranslogService.this.disableFlush) { logger.info("updating disable_flush from [{}] to [{}]", TranslogService.this.disableFlush, disableFlush); TranslogService.this.disableFlush = disableFlush; } }
Example 7
Source File: SearchService.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public void onRefreshSettings(Settings settings) { final TimeValue maybeNewDefaultSearchTimeout = settings.getAsTime(SearchService.DEFAULT_SEARCH_TIMEOUT, SearchService.this.settings.getAsTime(DEFAULT_SEARCH_TIMEOUT, NO_TIMEOUT)); if (!maybeNewDefaultSearchTimeout.equals(SearchService.this.defaultSearchTimeout)) { logger.info("updating [{}] from [{}] to [{}]", SearchService.DEFAULT_SEARCH_TIMEOUT, SearchService.this.defaultSearchTimeout, maybeNewDefaultSearchTimeout); SearchService.this.defaultSearchTimeout = maybeNewDefaultSearchTimeout; } }
Example 8
Source File: GcMonitor.java From elasticsearch-helper with Apache License 2.0 | 5 votes |
public GcMonitor(Settings settings) { this.enabled = settings.getAsBoolean("monitor.gc.enabled", false); TimeValue interval = settings.getAsTime("monitor.gc.interval", timeValueSeconds(1)); this.gcThresholds = new HashMap<>(); Map<String, Settings> gcThresholdGroups = settings.getGroups("monitor.gc.level"); for (Map.Entry<String, Settings> entry : gcThresholdGroups.entrySet()) { String name = entry.getKey(); TimeValue warn = entry.getValue().getAsTime("warn", null); TimeValue info = entry.getValue().getAsTime("info", null); TimeValue debug = entry.getValue().getAsTime("debug", null); if (warn == null || info == null || debug == null) { logger.warn("ignoring gc_threshold for [{}], missing warn/info/debug values", name); } else { gcThresholds.put(name, new GcThreshold(name, warn.millis(), info.millis(), debug.millis())); } } if (!gcThresholds.containsKey(JvmInfo.YOUNG)) { gcThresholds.put(JvmInfo.YOUNG, new GcThreshold(JvmInfo.YOUNG, 1000, 700, 400)); } if (!gcThresholds.containsKey(JvmInfo.OLD)) { gcThresholds.put(JvmInfo.OLD, new GcThreshold(JvmInfo.OLD, 10000, 5000, 2000)); } if (!gcThresholds.containsKey("default")) { gcThresholds.put("default", new GcThreshold("default", 10000, 5000, 2000)); } logger.debug("enabled [{}], interval [{}], gc_threshold [{}]", enabled, interval, this.gcThresholds); if (enabled) { scheduledFuture = Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(new GcMonitorThread(), 0L, interval.seconds(), TimeUnit.SECONDS); } }
Example 9
Source File: MappingUpdatedAction.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public void onRefreshSettings(Settings settings) { TimeValue current = MappingUpdatedAction.this.dynamicMappingUpdateTimeout; TimeValue newValue = settings.getAsTime( INDICES_MAPPING_DYNAMIC_TIMEOUT, MappingUpdatedAction.this.settings.getAsTime( INDICES_MAPPING_DYNAMIC_TIMEOUT, DEFAULT_ADDITIONAL_MAPPING_CHANGE_TIME)); if (!current.equals(newValue)) { logger.info("updating " + INDICES_MAPPING_DYNAMIC_TIMEOUT + " from [{}] to [{}]", current, newValue); MappingUpdatedAction.this.dynamicMappingUpdateTimeout = newValue; } }
Example 10
Source File: DiscoverySettings.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Inject public DiscoverySettings(Settings settings, NodeSettingsService nodeSettingsService) { super(settings); nodeSettingsService.addListener(new ApplySettings()); this.noMasterBlock = parseNoMasterBlock(settings.get(NO_MASTER_BLOCK, DEFAULT_NO_MASTER_BLOCK)); this.publishTimeout = settings.getAsTime(PUBLISH_TIMEOUT, publishTimeout); this.publishDiff = settings.getAsBoolean(PUBLISH_DIFF_ENABLE, DEFAULT_PUBLISH_DIFF_ENABLE); }
Example 11
Source File: OsService.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Inject public OsService(Settings settings, OsProbe probe) { super(settings); this.probe = probe; TimeValue refreshInterval = settings.getAsTime("monitor.os.refresh_interval", TimeValue.timeValueSeconds(1)); this.info = probe.osInfo(); this.info.refreshInterval = refreshInterval.millis(); this.info.allocatedProcessors = EsExecutors.boundedNumberOfProcessors(settings); osStatsCache = new OsStatsCache(refreshInterval, probe.osStats()); logger.debug("Using probe [{}] with refresh_interval [{}]", probe, refreshInterval); }
Example 12
Source File: ProcessService.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Inject public ProcessService(Settings settings, ProcessProbe probe) { super(settings); this.probe = probe; final TimeValue refreshInterval = settings.getAsTime("monitor.process.refresh_interval", TimeValue.timeValueSeconds(1)); processStatsCache = new ProcessStatsCache(refreshInterval, probe.processStats()); this.info = probe.processInfo(); this.info.refreshInterval = refreshInterval.millis(); logger.debug("Using probe [{}] with refresh_interval [{}]", probe, refreshInterval); }
Example 13
Source File: UnassignedInfo.java From Elasticsearch with Apache License 2.0 | 5 votes |
/** * The allocation delay value in nano seconds associated with the index (defaulting to node settings if not set). */ public long getAllocationDelayTimeoutSettingNanos(Settings settings, Settings indexSettings) { if (reason != Reason.NODE_LEFT && reason != Reason.PRIMARY_REPORT_FAILURE) { return 0; } TimeValue delayTimeout = indexSettings.getAsTime(INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING, settings.getAsTime(INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING, DEFAULT_DELAYED_NODE_LEFT_TIMEOUT)); return Math.max(0l, delayTimeout.nanos()); }
Example 14
Source File: InternalClusterInfoService.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Inject public InternalClusterInfoService(Settings settings, NodeSettingsService nodeSettingsService, TransportNodesStatsAction transportNodesStatsAction, TransportIndicesStatsAction transportIndicesStatsAction, ClusterService clusterService, ThreadPool threadPool) { super(settings); this.leastAvailableSpaceUsages = Collections.emptyMap(); this.mostAvailableSpaceUsages = Collections.emptyMap(); this.shardRoutingToDataPath = Collections.emptyMap(); this.shardSizes = Collections.emptyMap(); this.transportNodesStatsAction = transportNodesStatsAction; this.transportIndicesStatsAction = transportIndicesStatsAction; this.clusterService = clusterService; this.threadPool = threadPool; this.updateFrequency = settings.getAsTime(INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL); this.enabled = settings.getAsBoolean(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, true); this.updateFrequency = settings.getAsTime(INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL); this.fetchTimeout = settings.getAsTime(INTERNAL_CLUSTER_INFO_TIMEOUT, DEFAULT_TIMEOUT); this.enabled = settings.getAsBoolean( DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, DiskThresholdDecider.DEFAULT_THRESHOLD_ENABLED); nodeSettingsService.addListener(new ApplySettings()); // Add InternalClusterInfoService to listen for Master changes this.clusterService.add((LocalNodeMasterListener)this); // Add to listen for state changes (when nodes are added) this.clusterService.add((ClusterStateListener)this); }
Example 15
Source File: FsService.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Inject public FsService(Settings settings, FsProbe probe) throws IOException { super(settings); this.probe = probe; TimeValue refreshInterval = settings.getAsTime("monitor.fs.refresh_interval", TimeValue.timeValueSeconds(10)); fsStatsCache = new FsInfoCache(refreshInterval, probe.stats()); logger.debug("Using probe [{}] with refresh_interval [{}]", probe, refreshInterval); }
Example 16
Source File: DiskThresholdDecider.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Inject public DiskThresholdDecider(Settings settings, NodeSettingsService nodeSettingsService, ClusterInfoService infoService, Client client) { super(settings); String lowWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, DEFAULT_LOW_DISK_WATERMARK); String highWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, DEFAULT_HIGH_DISK_WATERMARK); if (!validWatermarkSetting(lowWatermark, CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK)) { throw new ElasticsearchParseException("unable to parse low watermark [{}]", lowWatermark); } if (!validWatermarkSetting(highWatermark, CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK)) { throw new ElasticsearchParseException("unable to parse high watermark [{}]", highWatermark); } // Watermark is expressed in terms of used data, but we need "free" data watermark this.freeDiskThresholdLow = 100.0 - thresholdPercentageFromWatermark(lowWatermark); this.freeDiskThresholdHigh = 100.0 - thresholdPercentageFromWatermark(highWatermark); this.freeBytesThresholdLow = thresholdBytesFromWatermark(lowWatermark, CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK); this.freeBytesThresholdHigh = thresholdBytesFromWatermark(highWatermark, CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK); this.includeRelocations = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS, DEFAULT_INCLUDE_RELOCATIONS); this.rerouteInterval = settings.getAsTime(CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL, TimeValue.timeValueSeconds(60)); this.enabled = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, DEFAULT_THRESHOLD_ENABLED); nodeSettingsService.addListener(new ApplySettings()); infoService.addListener(new DiskListener(client)); }
Example 17
Source File: ScriptService.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Inject public ScriptService(Settings settings, Environment env, Set<ScriptEngineService> scriptEngines, ResourceWatcherService resourceWatcherService, ScriptContextRegistry scriptContextRegistry) throws IOException { super(settings); this.parseFieldMatcher = new ParseFieldMatcher(settings); if (Strings.hasLength(settings.get(DISABLE_DYNAMIC_SCRIPTING_SETTING))) { throw new IllegalArgumentException(DISABLE_DYNAMIC_SCRIPTING_SETTING + " is not a supported setting, replace with fine-grained script settings. \n" + "Dynamic scripts can be enabled for all languages and all operations by replacing `script.disable_dynamic: false` with `script.inline: on` and `script.indexed: on` in elasticsearch.yml"); } this.scriptEngines = scriptEngines; this.scriptContextRegistry = scriptContextRegistry; int cacheMaxSize = settings.getAsInt(SCRIPT_CACHE_SIZE_SETTING, SCRIPT_CACHE_SIZE_DEFAULT); TimeValue cacheExpire = settings.getAsTime(SCRIPT_CACHE_EXPIRE_SETTING, null); logger.debug("using script cache with max_size [{}], expire [{}]", cacheMaxSize, cacheExpire); this.defaultLang = settings.get(DEFAULT_SCRIPTING_LANGUAGE_SETTING, DEFAULT_LANG); CacheBuilder cacheBuilder = CacheBuilder.newBuilder(); if (cacheMaxSize >= 0) { cacheBuilder.maximumSize(cacheMaxSize); } if (cacheExpire != null) { cacheBuilder.expireAfterAccess(cacheExpire.nanos(), TimeUnit.NANOSECONDS); } this.cache = cacheBuilder.removalListener(new ScriptCacheRemovalListener()).build(); ImmutableMap.Builder<String, ScriptEngineService> enginesByLangBuilder = ImmutableMap.builder(); ImmutableMap.Builder<String, ScriptEngineService> enginesByExtBuilder = ImmutableMap.builder(); for (ScriptEngineService scriptEngine : scriptEngines) { for (String type : scriptEngine.types()) { enginesByLangBuilder.put(type, scriptEngine); } for (String ext : scriptEngine.extensions()) { enginesByExtBuilder.put(ext, scriptEngine); } } this.scriptEnginesByLang = enginesByLangBuilder.build(); this.scriptEnginesByExt = enginesByExtBuilder.build(); this.scriptModes = new ScriptModes(this.scriptEnginesByLang, scriptContextRegistry, settings); // add file watcher for static scripts scriptsDirectory = env.scriptsFile(); if (logger.isTraceEnabled()) { logger.trace("Using scripts directory [{}] ", scriptsDirectory); } FileWatcher fileWatcher = new FileWatcher(scriptsDirectory); fileWatcher.addListener(new ScriptChangesListener()); if (settings.getAsBoolean(SCRIPT_AUTO_RELOAD_ENABLED_SETTING, true)) { // automatic reload is enabled - register scripts resourceWatcherService.add(fileWatcher); } else { // automatic reload is disable just load scripts once fileWatcher.init(); } }
Example 18
Source File: MappingUpdatedAction.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Inject public MappingUpdatedAction(Settings settings, NodeSettingsService nodeSettingsService) { super(settings); this.dynamicMappingUpdateTimeout = settings.getAsTime(INDICES_MAPPING_DYNAMIC_TIMEOUT, DEFAULT_ADDITIONAL_MAPPING_CHANGE_TIME); nodeSettingsService.addListener(new ApplySettings()); }
Example 19
Source File: DiskThresholdDecider.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Override public void onRefreshSettings(Settings settings) { String newLowWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, DiskThresholdDecider.this.settings.get( CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, DEFAULT_LOW_DISK_WATERMARK)); String newHighWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, DiskThresholdDecider.this.settings.get( CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, DEFAULT_HIGH_DISK_WATERMARK)); Boolean newRelocationsSetting = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS, DiskThresholdDecider.this.settings.getAsBoolean( CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS, DEFAULT_INCLUDE_RELOCATIONS)); Boolean newEnableSetting = settings.getAsBoolean( CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, DiskThresholdDecider.this.settings.getAsBoolean( CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, DEFAULT_THRESHOLD_ENABLED)); TimeValue newRerouteInterval = settings.getAsTime(CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL, null); if (newEnableSetting != null && newEnableSetting != DiskThresholdDecider.this.enabled) { logger.info("updating [{}] from [{}] to [{}]", CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, DiskThresholdDecider.this.enabled, newEnableSetting); DiskThresholdDecider.this.enabled = newEnableSetting; } if (newRelocationsSetting != null && newRelocationsSetting != DiskThresholdDecider.this.includeRelocations) { logger.info("updating [{}] from [{}] to [{}]", CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS, DiskThresholdDecider.this.includeRelocations, newRelocationsSetting); DiskThresholdDecider.this.includeRelocations = newRelocationsSetting; } if (newLowWatermark != null) { if (!validWatermarkSetting(newLowWatermark, CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK)) { throw new ElasticsearchParseException("unable to parse low watermark [{}]", newLowWatermark); } Double newFreeDiskThresholdLow = 100.0 - thresholdPercentageFromWatermark(newLowWatermark); ByteSizeValue newFreeBytesThresholdLow = thresholdBytesFromWatermark(newLowWatermark, CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK); if (!freeDiskThresholdLow.equals(newFreeDiskThresholdLow) || freeBytesThresholdLow.bytes() != newFreeBytesThresholdLow.bytes()) { logger.info("updating [{}] to [{}]", CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, newLowWatermark); DiskThresholdDecider.this.freeDiskThresholdLow = newFreeDiskThresholdLow; DiskThresholdDecider.this.freeBytesThresholdLow = newFreeBytesThresholdLow; } } if (newHighWatermark != null) { if (!validWatermarkSetting(newHighWatermark, CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK)) { throw new ElasticsearchParseException("unable to parse high watermark [{}]", newHighWatermark); } Double newFreeDiskThresholdHigh = 100.0 - thresholdPercentageFromWatermark(newHighWatermark); ByteSizeValue newFreeBytesThresholdHigh = thresholdBytesFromWatermark(newHighWatermark, CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK); if (!freeDiskThresholdHigh.equals(newFreeDiskThresholdHigh) || freeBytesThresholdHigh.bytes() != newFreeBytesThresholdHigh.bytes()) { logger.info("updating [{}] to [{}]", CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, newHighWatermark); DiskThresholdDecider.this.freeDiskThresholdHigh = 100.0 - thresholdPercentageFromWatermark(newHighWatermark); DiskThresholdDecider.this.freeBytesThresholdHigh = thresholdBytesFromWatermark(newHighWatermark, CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK); } } if (newRerouteInterval != null) { logger.info("updating [{}] to [{}]", CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL, newRerouteInterval); DiskThresholdDecider.this.rerouteInterval = newRerouteInterval; } }
Example 20
Source File: InternalClusterService.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Override public void onRefreshSettings(Settings settings) { final TimeValue slowTaskLoggingThreshold = settings.getAsTime(SETTING_CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD, InternalClusterService.this.slowTaskLoggingThreshold); InternalClusterService.this.slowTaskLoggingThreshold = slowTaskLoggingThreshold; }