Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.datastreams.DataStreamsPlugin;
import org.elasticsearch.datastreams.lifecycle.health.DataStreamLifecycleHealthIndicatorService;
import org.elasticsearch.dlm.DataStreamLifecycleErrorStore;
import org.elasticsearch.health.Diagnosis;
import org.elasticsearch.health.GetHealthAction;
import org.elasticsearch.health.HealthIndicatorResult;
Expand Down Expand Up @@ -146,7 +147,7 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
settings.put(DataStreamLifecycleService.DATA_STREAM_LIFECYCLE_POLL_INTERVAL, "1s");
settings.put(DataStreamLifecycle.CLUSTER_LIFECYCLE_DEFAULT_ROLLOVER_SETTING.getKey(), "min_docs=1,max_docs=1");
// we'll test DSL errors reach the health node, so we're lowering the threshold over which we report errors
settings.put(DataStreamLifecycleService.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING.getKey(), "3");
settings.put(DataStreamLifecycleErrorStore.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING.getKey(), "3");
return settings.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ public List<Setting<?>> getSettings() {
pluginSettings.add(DataStreamLifecycleService.DATA_STREAM_LIFECYCLE_POLL_INTERVAL_SETTING);
pluginSettings.add(DataStreamLifecycleService.DATA_STREAM_MERGE_POLICY_TARGET_FLOOR_SEGMENT_SETTING);
pluginSettings.add(DataStreamLifecycleService.DATA_STREAM_MERGE_POLICY_TARGET_FACTOR_SETTING);
pluginSettings.add(DataStreamLifecycleService.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING);
return pluginSettings;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,6 @@ public class DataStreamLifecycleService implements ClusterStateListener, Closeab
Setting.Property.Dynamic,
Setting.Property.NodeScope
);
/**
* This setting controls how often we signal that an index is in the error state when it comes to its data stream lifecycle
* progression.
* The signalling is currently logging at the `error` level but in the future it can signify other types of signalling.
*/
public static final Setting<Integer> DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING = Setting.intSetting(
"data_streams.lifecycle.signalling.error_retry_interval",
10,
1,
Setting.Property.Dynamic,
Setting.Property.NodeScope
);

public static final String DOWNSAMPLED_INDEX_PREFIX = "downsample-";

Expand Down Expand Up @@ -243,7 +231,7 @@ public DataStreamLifecycleService(
this.pollInterval = DATA_STREAM_LIFECYCLE_POLL_INTERVAL_SETTING.get(settings);
this.targetMergePolicyFloorSegment = DATA_STREAM_MERGE_POLICY_TARGET_FLOOR_SEGMENT_SETTING.get(settings);
this.targetMergePolicyFactor = DATA_STREAM_MERGE_POLICY_TARGET_FACTOR_SETTING.get(settings);
this.signallingErrorRetryInterval = DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING.get(settings);
this.signallingErrorRetryInterval = DataStreamLifecycleErrorStore.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING.get(settings);
this.rolloverConfiguration = clusterService.getClusterSettings()
.get(DataStreamLifecycle.CLUSTER_LIFECYCLE_DEFAULT_ROLLOVER_SETTING);
this.defaultRepository = RepositoriesService.DEFAULT_REPOSITORY_SETTING.get(settings);
Expand Down Expand Up @@ -284,7 +272,10 @@ public void init() {
clusterService.getClusterSettings()
.addSettingsUpdateConsumer(DATA_STREAM_MERGE_POLICY_TARGET_FLOOR_SEGMENT_SETTING, this::updateMergePolicyFloorSegment);
clusterService.getClusterSettings()
.addSettingsUpdateConsumer(DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING, this::updateSignallingRetryThreshold);
.addSettingsUpdateConsumer(
DataStreamLifecycleErrorStore.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING,
this::updateSignallingRetryThreshold
);
clusterService.getClusterSettings()
.addSettingsUpdateConsumer(RepositoriesService.DEFAULT_REPOSITORY_SETTING, this::updateDefaultRepository);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

import java.util.List;

import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING;

/**
* Provides the infrastructure to send errors encountered by indices managed by data stream lifecycle service to the health node.
*/
Expand Down Expand Up @@ -59,13 +57,16 @@ public DataStreamLifecycleHealthInfoPublisher(
this.client = client;
this.clusterService = clusterService;
this.errorStore = errorStore;
this.signallingErrorRetryInterval = DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING.get(settings);
this.signallingErrorRetryInterval = DataStreamLifecycleErrorStore.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING.get(settings);
this.maxNumberOfErrorsToPublish = DATA_STREAM_LIFECYCLE_MAX_ERRORS_TO_PUBLISH_SETTING.get(settings);
}

public void init() {
clusterService.getClusterSettings()
.addSettingsUpdateConsumer(DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING, this::updateSignallingRetryThreshold);
.addSettingsUpdateConsumer(
DataStreamLifecycleErrorStore.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING,
this::updateSignallingRetryThreshold
);
clusterService.getClusterSettings()
.addSettingsUpdateConsumer(DATA_STREAM_LIFECYCLE_MAX_ERRORS_TO_PUBLISH_SETTING, this::updateNumberOfErrorsToPublish);
}
Expand All @@ -80,7 +81,7 @@ private void updateNumberOfErrorsToPublish(int newValue) {

/**
* Publishes the DSL errors that have passed the signaling threshold (as defined by
* {@link org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService#DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING}
* {@link DataStreamLifecycleErrorStore#DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING}
*/
public void publishDslErrorEntries(ActionListener<AcknowledgedResponse> actionListener) {
DiscoveryNode currentHealthNode = HealthNode.findHealthNode(clusterService.state());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleFixtures.createDataStream;
import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService.DATA_STREAM_MERGE_POLICY_TARGET_FACTOR_SETTING;
import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService.DATA_STREAM_MERGE_POLICY_TARGET_FLOOR_SEGMENT_SETTING;
import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING;
import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService.DOWNSAMPLED_INDEX_PREFIX;
import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService.FORCE_MERGE_COMPLETED_TIMESTAMP_METADATA_KEY;
import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService.ONE_HUNDRED_MB;
Expand Down Expand Up @@ -157,7 +156,7 @@ public void setupServices() {
builtInClusterSettings.add(DataStreamLifecycleService.DATA_STREAM_LIFECYCLE_POLL_INTERVAL_SETTING);
builtInClusterSettings.add(DATA_STREAM_MERGE_POLICY_TARGET_FLOOR_SEGMENT_SETTING);
builtInClusterSettings.add(DATA_STREAM_MERGE_POLICY_TARGET_FACTOR_SETTING);
builtInClusterSettings.add(DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING);
builtInClusterSettings.add(DataStreamLifecycleErrorStore.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING);
Comment thread
dakrone marked this conversation as resolved.
Outdated
ClusterSettings clusterSettings = new ClusterSettings(Settings.EMPTY, builtInClusterSettings);
clusterService = createClusterService(threadPool, clusterSettings);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService.DATA_STREAM_MERGE_POLICY_TARGET_FACTOR_SETTING;
import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService.DATA_STREAM_MERGE_POLICY_TARGET_FLOOR_SEGMENT_SETTING;
import static org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleService.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING;
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
Expand Down Expand Up @@ -71,7 +70,7 @@ public void setupServices() {
builtInClusterSettings.add(DataStreamLifecycleService.DATA_STREAM_LIFECYCLE_POLL_INTERVAL_SETTING);
builtInClusterSettings.add(DATA_STREAM_MERGE_POLICY_TARGET_FLOOR_SEGMENT_SETTING);
builtInClusterSettings.add(DATA_STREAM_MERGE_POLICY_TARGET_FACTOR_SETTING);
builtInClusterSettings.add(DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING);
builtInClusterSettings.add(DataStreamLifecycleErrorStore.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING);
Comment thread
dakrone marked this conversation as resolved.
Outdated
ClusterSettings clusterSettings = new ClusterSettings(Settings.EMPTY, builtInClusterSettings);
clusterService = createClusterService(threadPool, clusterSettings);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import org.elasticsearch.discovery.PeerFinder;
import org.elasticsearch.discovery.SeedHostsResolver;
import org.elasticsearch.discovery.SettingsBasedSeedHostsProvider;
import org.elasticsearch.dlm.DataStreamLifecycleErrorStore;
import org.elasticsearch.env.Environment;
import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.gateway.GatewayService;
Expand Down Expand Up @@ -669,6 +670,7 @@ public void apply(Settings value, Settings current, Settings previous) {
DataStreamGlobalRetentionSettings.FAILURE_STORE_DEFAULT_RETENTION_SETTING,
ShardsAvailabilityHealthIndicatorService.REPLICA_UNASSIGNED_BUFFER_TIME,
DataStreamFailureStoreSettings.DATA_STREAM_FAILURE_STORED_ENABLED_SETTING,
DataStreamLifecycleErrorStore.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING,
IndexingStatsSettings.RECENT_WRITE_LOAD_HALF_LIFE_SETTING,
SearchStatsSettings.RECENT_READ_LOAD_HALF_LIFE_SETTING,
TransportGetAllocationStatsAction.CACHE_TTL_SETTING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.action.datastreams.lifecycle.ErrorEntry;
import org.elasticsearch.cluster.metadata.ProjectId;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.Tuple;
import org.elasticsearch.health.node.DslErrorInfo;
Expand Down Expand Up @@ -42,6 +43,19 @@ public class DataStreamLifecycleErrorStore {

private static final Logger logger = getLogger(DataStreamLifecycleErrorStore.class);

/**
* This setting controls how often we signal that an index is in the error state when it comes to its data stream lifecycle
* progression.
* The signalling is currently logging at the `error` level but in the future it can signify other types of signalling.
*/
public static final Setting<Integer> DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING = Setting.intSetting(
"data_streams.lifecycle.signalling.error_retry_interval",
10,
1,
Setting.Property.Dynamic,
Setting.Property.NodeScope
);

public static final int MAX_ERROR_MESSAGE_LENGTH = 1000;
private final ConcurrentMap<ProjectId, ConcurrentMap<String, ErrorEntry>> projectMap = new ConcurrentHashMap<>();
private final LongSupplier nowSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package org.elasticsearch.xpack.dlm.frozen;

import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.common.util.concurrent.ThreadContext;
Expand Down Expand Up @@ -43,9 +44,17 @@ class DlmFrozenTransitionExecutor implements Closeable {
private final ExecutorService executor;
private final int maxConcurrency;
private final int maxQueueSize;
private final ClusterService clusterService;
private final DataStreamLifecycleErrorStore errorStore;

DlmFrozenTransitionExecutor(int maxConcurrency, int maxQueueSize, Settings settings, DataStreamLifecycleErrorStore errorStore) {
private volatile int errorRetryInterval;

DlmFrozenTransitionExecutor(
ClusterService clusterService,
int maxConcurrency,
int maxQueueSize,
Settings settings,
DataStreamLifecycleErrorStore errorStore
) {
this.maxConcurrency = maxConcurrency;
this.maxQueueSize = maxQueueSize;
this.submittedTransitions = new ConcurrentHashMap<>(maxQueueSize);
Expand All @@ -58,7 +67,21 @@ class DlmFrozenTransitionExecutor implements Closeable {
}
return thread;
}, new ThreadContext(settings), EsExecutors.TaskTrackingConfig.DEFAULT);
this.clusterService = clusterService;
this.errorStore = errorStore;
this.errorRetryInterval = DataStreamLifecycleErrorStore.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING.get(settings);
}

public void init() {
this.clusterService.getClusterSettings()
.addSettingsUpdateConsumer(
DataStreamLifecycleErrorStore.DATA_STREAM_SIGNALLING_ERROR_RETRY_INTERVAL_SETTING,
this::updateErrorInterval
);
}

private void updateErrorInterval(int newInterval) {
this.errorRetryInterval = newInterval;
}

public boolean transitionSubmitted(String indexName) {
Expand Down Expand Up @@ -120,7 +143,7 @@ public void run() {
indexName,
ex,
Strings.format("Error executing transition for index [%s]", indexName),
1
errorRetryInterval
);
} finally {
submittedTransitions.remove(indexName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,13 @@ private void startThreadPools() {
synchronized (this) {
if (closing.get() == false) {
transitionExecutor = new DlmFrozenTransitionExecutor(
clusterService,
maxConcurrency,
maxQueueSize,
clusterService.getSettings(),
errorStore
);
transitionExecutor.init();
schedulerThreadExecutor = Executors.newSingleThreadScheduledExecutor(
EsExecutors.daemonThreadFactory(clusterService.getSettings(), "dlm-frozen-transition-scheduler")
);
Expand Down
Loading
Loading