Java Code Examples for org.elasticsearch.common.settings.ClusterSettings#addSettingsUpdateConsumer()
The following examples show how to use
org.elasticsearch.common.settings.ClusterSettings#addSettingsUpdateConsumer() .
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: InternalClusterInfoService.java From crate with Apache License 2.0 | 6 votes |
public InternalClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, NodeClient client) { this.leastAvailableSpaceUsages = ImmutableOpenMap.of(); this.mostAvailableSpaceUsages = ImmutableOpenMap.of(); this.shardRoutingToDataPath = ImmutableOpenMap.of(); this.shardSizes = ImmutableOpenMap.of(); this.clusterService = clusterService; this.threadPool = threadPool; this.client = client; this.updateFrequency = INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING.get(settings); this.fetchTimeout = INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING.get(settings); this.enabled = DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.get(settings); ClusterSettings clusterSettings = clusterService.getClusterSettings(); //clusterSettings.addSettingsUpdateConsumer(INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING, this::setFetchTimeout); //clusterSettings.addSettingsUpdateConsumer(INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING, this::setUpdateFrequency); clusterSettings.addSettingsUpdateConsumer(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING, this::setEnabled); // Add InternalClusterInfoService to listen for Master changes this.clusterService.addLocalNodeMasterListener(this); // Add to listen for state changes (when nodes are added) this.clusterService.addListener(this); }
Example 2
Source File: DiscoverySettings.java From crate with Apache License 2.0 | 5 votes |
public DiscoverySettings(Settings settings, ClusterSettings clusterSettings) { clusterSettings.addSettingsUpdateConsumer(NO_MASTER_BLOCK_SETTING, this::setNoMasterBlock); clusterSettings.addSettingsUpdateConsumer(PUBLISH_DIFF_ENABLE_SETTING, this::setPublishDiff); clusterSettings.addSettingsUpdateConsumer(COMMIT_TIMEOUT_SETTING, this::setCommitTimeout); clusterSettings.addSettingsUpdateConsumer(PUBLISH_TIMEOUT_SETTING, this::setPublishTimeout); this.noMasterBlock = NO_MASTER_BLOCK_SETTING.get(settings); this.publishTimeout = PUBLISH_TIMEOUT_SETTING.get(settings); this.commitTimeout = COMMIT_TIMEOUT_SETTING.get(settings); this.publishDiff = PUBLISH_DIFF_ENABLE_SETTING.get(settings); }
Example 3
Source File: TransportService.java From crate with Apache License 2.0 | 5 votes |
public TransportService(Settings settings, Transport transport, ThreadPool threadPool, TransportInterceptor transportInterceptor, Function<BoundTransportAddress, DiscoveryNode> localNodeFactory, @Nullable ClusterSettings clusterSettings, ConnectionManager connectionManager) { this.transport = transport; this.threadPool = threadPool; this.localNodeFactory = localNodeFactory; this.connectionManager = connectionManager; this.clusterName = ClusterName.CLUSTER_NAME_SETTING.get(settings); setTracerLogInclude(TRACE_LOG_INCLUDE_SETTING.get(settings)); setTracerLogExclude(TRACE_LOG_EXCLUDE_SETTING.get(settings)); tracerLog = Loggers.getLogger(LOGGER, ".tracer"); taskManager = createTaskManager(settings, threadPool); this.interceptor = transportInterceptor; this.asyncSender = interceptor.interceptSender(this::sendRequestInternal); responseHandlers = transport.getResponseHandlers(); if (clusterSettings != null) { clusterSettings.addSettingsUpdateConsumer(TRACE_LOG_INCLUDE_SETTING, this::setTracerLogInclude); clusterSettings.addSettingsUpdateConsumer(TRACE_LOG_EXCLUDE_SETTING, this::setTracerLogExclude); } registerRequestHandler( HANDSHAKE_ACTION_NAME, HandshakeRequest::new, ThreadPool.Names.SAME, false, false, (request, channel, task) -> channel.sendResponse( new HandshakeResponse(localNode, clusterName, localNode.getVersion()))); }
Example 4
Source File: DecommissioningService.java From crate with Apache License 2.0 | 5 votes |
@VisibleForTesting protected DecommissioningService(Settings settings, final ClusterService clusterService, JobsLogs jobsLogs, ScheduledExecutorService executorService, SQLOperations sqlOperations, IntSupplier numActiveContexts, @Nullable Runnable safeExitAction, final TransportClusterHealthAction healthAction, final TransportClusterUpdateSettingsAction updateSettingsAction) { this.clusterService = clusterService; this.jobsLogs = jobsLogs; this.sqlOperations = sqlOperations; this.numActiveContexts = numActiveContexts; this.healthAction = healthAction; this.updateSettingsAction = updateSettingsAction; // There is a window where this node removed the last shards but still receives new operations because // other nodes created the routing based on an earlier clusterState. // We delay here to give these requests a chance to finish this.safeExitAction = safeExitAction == null ? () -> executorService.schedule(this::exit, 5, TimeUnit.SECONDS) : safeExitAction; gracefulStopTimeout = GRACEFUL_STOP_TIMEOUT_SETTING.setting().get(settings); forceStop = GRACEFUL_STOP_FORCE_SETTING.setting().get(settings); dataAvailability = GRACEFUL_STOP_MIN_AVAILABILITY_SETTING.setting().get(settings); ClusterSettings clusterSettings = clusterService.getClusterSettings(); clusterSettings.addSettingsUpdateConsumer(GRACEFUL_STOP_TIMEOUT_SETTING.setting(), this::setGracefulStopTimeout); clusterSettings.addSettingsUpdateConsumer(GRACEFUL_STOP_FORCE_SETTING.setting(), this::setGracefulStopForce); clusterSettings.addSettingsUpdateConsumer(GRACEFUL_STOP_MIN_AVAILABILITY_SETTING.setting(), this::setDataAvailability); this.executorService = executorService; }
Example 5
Source File: BalancedShardsAllocator.java From crate with Apache License 2.0 | 5 votes |
@Inject public BalancedShardsAllocator(Settings settings, ClusterSettings clusterSettings) { setWeightFunction(INDEX_BALANCE_FACTOR_SETTING.get(settings), SHARD_BALANCE_FACTOR_SETTING.get(settings)); setThreshold(THRESHOLD_SETTING.get(settings)); clusterSettings.addSettingsUpdateConsumer(INDEX_BALANCE_FACTOR_SETTING, SHARD_BALANCE_FACTOR_SETTING, this::setWeightFunction); clusterSettings.addSettingsUpdateConsumer(THRESHOLD_SETTING, this::setThreshold); }
Example 6
Source File: AwarenessAllocationDecider.java From crate with Apache License 2.0 | 5 votes |
public AwarenessAllocationDecider(Settings settings, ClusterSettings clusterSettings) { this.awarenessAttributes = CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING.get(settings); clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING, this::setAwarenessAttributes); setForcedAwarenessAttributes(CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP_SETTING.get(settings)); clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP_SETTING, this::setForcedAwarenessAttributes); }
Example 7
Source File: ClusterRebalanceAllocationDecider.java From crate with Apache License 2.0 | 5 votes |
public ClusterRebalanceAllocationDecider(Settings settings, ClusterSettings clusterSettings) { try { type = CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.get(settings); } catch (IllegalStateException e) { LOGGER.warn("[{}] has a wrong value {}, defaulting to 'indices_all_active'", CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING, CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getRaw(settings)); type = ClusterRebalanceType.INDICES_ALL_ACTIVE; } LOGGER.debug("using [{}] with [{}]", CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, type); clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING, this::setType); }
Example 8
Source File: DecommissionAllocationDecider.java From crate with Apache License 2.0 | 5 votes |
public DecommissionAllocationDecider(Settings settings, ClusterSettings clusterSettings) { updateDecommissioningNodes(DecommissioningService.DECOMMISSION_INTERNAL_SETTING_GROUP.setting().get(settings)); dataAvailability = DecommissioningService.GRACEFUL_STOP_MIN_AVAILABILITY_SETTING.setting().get(settings); clusterSettings.addSettingsUpdateConsumer( DecommissioningService.DECOMMISSION_INTERNAL_SETTING_GROUP.setting(), this::updateDecommissioningNodes); clusterSettings.addSettingsUpdateConsumer( DecommissioningService.GRACEFUL_STOP_MIN_AVAILABILITY_SETTING.setting(), this::updateMinAvailability); }
Example 9
Source File: SchemaUpdateClient.java From crate with Apache License 2.0 | 5 votes |
@Inject public SchemaUpdateClient(Settings settings, ClusterSettings clusterSettings, TransportSchemaUpdateAction schemaUpdateAction) { this.schemaUpdateAction = schemaUpdateAction; this.dynamicMappingUpdateTimeout = MappingUpdatedAction.INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING.get(settings); clusterSettings.addSettingsUpdateConsumer( MappingUpdatedAction.INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING, this::setDynamicMappingUpdateTimeout); }
Example 10
Source File: MemoryManagerFactory.java From crate with Apache License 2.0 | 4 votes |
@Inject public MemoryManagerFactory(ClusterSettings clusterSettings) { clusterSettings.addSettingsUpdateConsumer(MEMORY_ALLOCATION_TYPE.setting(), newValue -> { currentMemoryType = MemoryType.of(newValue); }); }
Example 11
Source File: PrometheusSettings.java From elasticsearch-prometheus-exporter with Apache License 2.0 | 4 votes |
public PrometheusSettings(Settings settings, ClusterSettings clusterSettings) { setPrometheusClusterSettings(PROMETHEUS_CLUSTER_SETTINGS.get(settings)); setPrometheusIndices(PROMETHEUS_INDICES.get(settings)); clusterSettings.addSettingsUpdateConsumer(PROMETHEUS_CLUSTER_SETTINGS, this::setPrometheusClusterSettings); clusterSettings.addSettingsUpdateConsumer(PROMETHEUS_INDICES, this::setPrometheusIndices); }
Example 12
Source File: MappingUpdatedAction.java From crate with Apache License 2.0 | 4 votes |
@Inject public MappingUpdatedAction(Settings settings, ClusterSettings clusterSettings) { this.dynamicMappingUpdateTimeout = INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING.get(settings); clusterSettings.addSettingsUpdateConsumer(INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING, this::setDynamicMappingUpdateTimeout); }
Example 13
Source File: OperationRouting.java From crate with Apache License 2.0 | 4 votes |
public OperationRouting(Settings settings, ClusterSettings clusterSettings) { this.awarenessAttributes = AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING.get(settings); clusterSettings.addSettingsUpdateConsumer(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING, this::setAwarenessAttributes); }
Example 14
Source File: EnableAllocationDecider.java From crate with Apache License 2.0 | 4 votes |
public EnableAllocationDecider(Settings settings, ClusterSettings clusterSettings) { this.enableAllocation = CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.get(settings); this.enableRebalance = CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.get(settings); clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING, this::setEnableAllocation); clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING, this::setEnableRebalance); }
Example 15
Source File: ShardsLimitAllocationDecider.java From crate with Apache License 2.0 | 4 votes |
public ShardsLimitAllocationDecider(Settings settings, ClusterSettings clusterSettings) { this.settings = settings; this.clusterShardLimit = CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING.get(settings); clusterSettings.addSettingsUpdateConsumer(CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING, this::setClusterShardLimit); }
Example 16
Source File: SameShardAllocationDecider.java From crate with Apache License 2.0 | 4 votes |
public SameShardAllocationDecider(Settings settings, ClusterSettings clusterSettings) { this.sameHost = CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING.get(settings); clusterSettings.addSettingsUpdateConsumer(CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING, this::setSameHost); }
Example 17
Source File: JobsLogService.java From crate with Apache License 2.0 | 4 votes |
@VisibleForTesting JobsLogService(Settings settings, Supplier<DiscoveryNode> localNode, ClusterSettings clusterSettings, Functions functions, ScheduledExecutorService scheduler, CircuitBreakerService breakerService) { this.scheduler = scheduler; this.breakerService = breakerService; this.inputFactory = new InputFactory(functions); var jobsLogTable = SysJobsLogTableInfo.create(localNode); this.refResolver = new StaticTableReferenceResolver<>(jobsLogTable.expressions()); TableRelation sysJobsLogRelation = new TableRelation(jobsLogTable); systemTransactionCtx = CoordinatorTxnCtx.systemTransactionContext(); this.expressionAnalyzer = new ExpressionAnalyzer( functions, systemTransactionCtx, ParamTypeHints.EMPTY, new NameFieldProvider(sysJobsLogRelation), null, Operation.READ ); normalizer = new EvaluatingNormalizer(functions, RowGranularity.DOC, refResolver, sysJobsLogRelation); FILTER_VALIDATOR.validate = this::asSymbol; isEnabled = STATS_ENABLED_SETTING.setting().get(settings); jobsLogs = new JobsLogs(this::isEnabled); memoryFilter = createFilter( STATS_JOBS_LOG_FILTER.setting().get(settings), STATS_JOBS_LOG_FILTER.getKey()); persistFilter = createFilter( STATS_JOBS_LOG_PERSIST_FILTER.setting().get(settings), STATS_JOBS_LOG_PERSIST_FILTER.getKey()); setJobsLogSink( STATS_JOBS_LOG_SIZE_SETTING.setting().get(settings), STATS_JOBS_LOG_EXPIRATION_SETTING.setting().get(settings) ); setOperationsLogSink( STATS_OPERATIONS_LOG_SIZE_SETTING.setting().get(settings), STATS_OPERATIONS_LOG_EXPIRATION_SETTING.setting().get(settings)); clusterSettings.addSettingsUpdateConsumer(STATS_JOBS_LOG_FILTER.setting(), filter -> { JobsLogService.this.memoryFilter = createFilter(filter, STATS_JOBS_LOG_FILTER.getKey()); updateJobSink(jobsLogSize, jobsLogExpiration); }); clusterSettings.addSettingsUpdateConsumer(STATS_JOBS_LOG_PERSIST_FILTER.setting(), filter -> { JobsLogService.this.persistFilter = createFilter(filter, STATS_JOBS_LOG_PERSIST_FILTER.getKey()); updateJobSink(jobsLogSize, jobsLogExpiration); }); clusterSettings.addSettingsUpdateConsumer(STATS_ENABLED_SETTING.setting(), this::setStatsEnabled); clusterSettings.addSettingsUpdateConsumer( STATS_JOBS_LOG_SIZE_SETTING.setting(), STATS_JOBS_LOG_EXPIRATION_SETTING.setting(), this::setJobsLogSink); clusterSettings.addSettingsUpdateConsumer( STATS_OPERATIONS_LOG_SIZE_SETTING.setting(), STATS_OPERATIONS_LOG_EXPIRATION_SETTING.setting(), this::setOperationsLogSink); }
Example 18
Source File: NoMasterBlockService.java From crate with Apache License 2.0 | 4 votes |
public NoMasterBlockService(Settings settings, ClusterSettings clusterSettings) { this.noMasterBlock = NO_MASTER_BLOCK_SETTING.get(settings); clusterSettings.addSettingsUpdateConsumer(NO_MASTER_BLOCK_SETTING, this::setNoMasterBlock); }
Example 19
Source File: Reconfigurator.java From crate with Apache License 2.0 | 4 votes |
public Reconfigurator(Settings settings, ClusterSettings clusterSettings) { autoShrinkVotingConfiguration = CLUSTER_AUTO_SHRINK_VOTING_CONFIGURATION.get(settings); clusterSettings.addSettingsUpdateConsumer(CLUSTER_AUTO_SHRINK_VOTING_CONFIGURATION, this::setAutoShrinkVotingConfiguration); }
Example 20
Source File: HierarchyCircuitBreakerService.java From crate with Apache License 2.0 | 4 votes |
public HierarchyCircuitBreakerService(Settings settings, ClusterSettings clusterSettings) { this.fielddataSettings = new BreakerSettings(CircuitBreaker.FIELDDATA, FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING.get(settings).getBytes(), FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING.get(settings), FIELDDATA_CIRCUIT_BREAKER_TYPE_SETTING.get(settings) ); this.inFlightRequestsSettings = new BreakerSettings(CircuitBreaker.IN_FLIGHT_REQUESTS, IN_FLIGHT_REQUESTS_CIRCUIT_BREAKER_LIMIT_SETTING.get(settings).getBytes(), IN_FLIGHT_REQUESTS_CIRCUIT_BREAKER_OVERHEAD_SETTING.get(settings), IN_FLIGHT_REQUESTS_CIRCUIT_BREAKER_TYPE_SETTING.get(settings) ); this.requestSettings = new BreakerSettings(CircuitBreaker.REQUEST, REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING.get(settings).getBytes(), REQUEST_CIRCUIT_BREAKER_OVERHEAD_SETTING.get(settings), REQUEST_CIRCUIT_BREAKER_TYPE_SETTING.get(settings) ); this.accountingSettings = new BreakerSettings(CircuitBreaker.ACCOUNTING, ACCOUNTING_CIRCUIT_BREAKER_LIMIT_SETTING.get(settings).getBytes(), ACCOUNTING_CIRCUIT_BREAKER_OVERHEAD_SETTING.get(settings), ACCOUNTING_CIRCUIT_BREAKER_TYPE_SETTING.get(settings) ); this.parentSettings = new BreakerSettings(CircuitBreaker.PARENT, TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING.get(settings).getBytes(), 1.0, CircuitBreaker.Type.PARENT); queryBreakerSettings = new BreakerSettings(QUERY, QUERY_CIRCUIT_BREAKER_LIMIT_SETTING.setting().get(settings).getBytes(), QUERY_CIRCUIT_BREAKER_OVERHEAD_SETTING.setting().get(settings), CircuitBreaker.Type.MEMORY ); logJobsBreakerSettings = new BreakerSettings(JOBS_LOG, JOBS_LOG_CIRCUIT_BREAKER_LIMIT_SETTING.setting().get(settings).getBytes(), JOBS_LOG_CIRCUIT_BREAKER_OVERHEAD_SETTING.setting().get(settings), CircuitBreaker.Type.MEMORY); logOperationsBreakerSettings = new BreakerSettings(OPERATIONS_LOG, OPERATIONS_LOG_CIRCUIT_BREAKER_LIMIT_SETTING.setting().get(settings).getBytes(), OPERATIONS_LOG_CIRCUIT_BREAKER_OVERHEAD_SETTING.setting().get(settings), CircuitBreaker.Type.MEMORY); if (LOGGER.isTraceEnabled()) { LOGGER.trace("parent circuit breaker with settings {}", this.parentSettings); } registerBreaker(this.requestSettings); registerBreaker(this.fielddataSettings); registerBreaker(this.inFlightRequestsSettings); registerBreaker(this.accountingSettings); registerBreaker(this.queryBreakerSettings); registerBreaker(this.logJobsBreakerSettings); registerBreaker(this.logOperationsBreakerSettings); clusterSettings.addSettingsUpdateConsumer(TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING, this::setTotalCircuitBreakerLimit, this::validateTotalCircuitBreakerLimit); clusterSettings.addSettingsUpdateConsumer(FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING, FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING, this::setFieldDataBreakerLimit); clusterSettings.addSettingsUpdateConsumer(IN_FLIGHT_REQUESTS_CIRCUIT_BREAKER_LIMIT_SETTING, IN_FLIGHT_REQUESTS_CIRCUIT_BREAKER_OVERHEAD_SETTING, this::setInFlightRequestsBreakerLimit); clusterSettings.addSettingsUpdateConsumer(REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, REQUEST_CIRCUIT_BREAKER_OVERHEAD_SETTING, this::setRequestBreakerLimit); clusterSettings.addSettingsUpdateConsumer(ACCOUNTING_CIRCUIT_BREAKER_LIMIT_SETTING, ACCOUNTING_CIRCUIT_BREAKER_OVERHEAD_SETTING, this::setAccountingBreakerLimit); clusterSettings.addSettingsUpdateConsumer(QUERY_CIRCUIT_BREAKER_LIMIT_SETTING.setting(), QUERY_CIRCUIT_BREAKER_OVERHEAD_SETTING.setting(), (newLimit, newOverhead) -> setBreakerLimit(queryBreakerSettings, QUERY, s -> this.queryBreakerSettings = s, newLimit, newOverhead)); clusterSettings.addSettingsUpdateConsumer(JOBS_LOG_CIRCUIT_BREAKER_LIMIT_SETTING.setting(), (newLimit) -> setBreakerLimit(logJobsBreakerSettings, JOBS_LOG, s -> this.logJobsBreakerSettings = s, newLimit, null)); clusterSettings.addSettingsUpdateConsumer(OPERATIONS_LOG_CIRCUIT_BREAKER_LIMIT_SETTING.setting(), (newLimit) -> setBreakerLimit(logOperationsBreakerSettings, OPERATIONS_LOG, s -> this.logOperationsBreakerSettings = s, newLimit, null)); }