Skip to content

Add ability to redirect ingestion failures on data streams to a failure store #126973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Apr 18, 2025
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
Prev Previous commit
Next Next commit
Remove feature flag from xpack main code
  • Loading branch information
jbaiera committed Apr 16, 2025
commit 56a7989b7a35dd23dd635f187dfda5182fa64b6a
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@ protected void innerXContent(XContentBuilder builder, Params params) throws IOEx
super.innerXContent(builder, params);
builder.field("data_streams", streamStats.totalDataStreamCount);
builder.field("indices_count", streamStats.indicesBehindDataStream);
if (DataStream.isFailureStoreFeatureFlagEnabled()) {
builder.startObject("failure_store");
builder.field("explicitly_enabled_count", streamStats.failureStoreExplicitlyEnabledDataStreamCount);
builder.field("effectively_enabled_count", streamStats.failureStoreEffectivelyEnabledDataStreamCount);
builder.field("failure_indices_count", streamStats.failureStoreIndicesCount);
builder.endObject();
}
builder.startObject("failure_store");
builder.field("explicitly_enabled_count", streamStats.failureStoreExplicitlyEnabledDataStreamCount);
builder.field("effectively_enabled_count", streamStats.failureStoreEffectivelyEnabledDataStreamCount);
builder.field("failure_indices_count", streamStats.failureStoreIndicesCount);
builder.endObject();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ public static ActionRequestValidationException validate(
} catch (IllegalArgumentException ile) {
validationException = addValidationError(ile.getMessage(), validationException);
}
if (DataStream.isFailureStoreFeatureFlagEnabled()) {
for (final String indexName : idp.getIndices()) {
validationException = validateIndexNameExpression(indexName, validationException);
}
for (final String indexName : idp.getIndices()) {
validationException = validateIndexNameExpression(indexName, validationException);
}
}
}
Expand All @@ -78,10 +76,8 @@ public static ActionRequestValidationException validate(
} catch (IllegalArgumentException ile) {
validationException = addValidationError(ile.getMessage(), validationException);
}
if (DataStream.isFailureStoreFeatureFlagEnabled()) {
for (String indexName : ridp.indicesPrivileges().getIndices()) {
validationException = validateIndexNameExpression(indexName, validationException);
}
for (String indexName : ridp.indicesPrivileges().getIndices()) {
validationException = validateIndexNameExpression(indexName, validationException);
}
}
if (roleDescriptor.hasRemoteClusterPermissions()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,17 +348,15 @@ public ActionRequestValidationException validate(ActionRequestValidationExceptio
validationException
);
}
if (DataStream.isFailureStoreFeatureFlagEnabled()) {
// best effort prevent users from attempting to use selectors in privilege check
for (String indexPattern : indicesPrivileges.getIndices()) {
if (IndexNameExpressionResolver.hasSelector(indexPattern, IndexComponentSelector.FAILURES)
|| IndexNameExpressionResolver.hasSelector(indexPattern, IndexComponentSelector.DATA)) {
validationException = addValidationError(
"may only check index privileges without selectors in index patterns [" + indexPattern + "]",
validationException
);
break;
}
// best effort prevent users from attempting to use selectors in privilege check
for (String indexPattern : indicesPrivileges.getIndices()) {
if (IndexNameExpressionResolver.hasSelector(indexPattern, IndexComponentSelector.FAILURES)
|| IndexNameExpressionResolver.hasSelector(indexPattern, IndexComponentSelector.DATA)) {
validationException = addValidationError(
"may only check index privileges without selectors in index patterns [" + indexPattern + "]",
validationException
);
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ public final class IndexPrivilege extends Privilege {
private static final Map<String, IndexPrivilege> VALUES = combineSortedInOrder(
sortByAccessLevel(
Stream.of(
DataStream.isFailureStoreFeatureFlagEnabled() ? entry("read_failure_store", READ_FAILURE_STORE) : null,
DataStream.isFailureStoreFeatureFlagEnabled() ? entry("manage_failure_store", MANAGE_FAILURE_STORE) : null
).filter(Objects::nonNull).collect(Collectors.toUnmodifiableMap(Map.Entry::getKey, Map.Entry::getValue))
entry("read_failure_store", READ_FAILURE_STORE),
entry("manage_failure_store", MANAGE_FAILURE_STORE)
).collect(Collectors.toUnmodifiableMap(Map.Entry::getKey, Map.Entry::getValue))
),
sortByAccessLevel(
Stream.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public class InternalUsers {
.privileges(
filterNonNull(
// needed to rollover failure store
DataStream.isFailureStoreFeatureFlagEnabled() ? "manage_failure_store" : null,
"manage_failure_store",
"delete_index",
RolloverAction.NAME,
ForceMergeAction.NAME + "*",
Expand All @@ -184,7 +184,7 @@ public class InternalUsers {
.privileges(
filterNonNull(
// needed to rollover failure store
DataStream.isFailureStoreFeatureFlagEnabled() ? "manage_failure_store" : null,
"manage_failure_store",
"delete_index",
RolloverAction.NAME,
ForceMergeAction.NAME + "*",
Expand Down Expand Up @@ -262,7 +262,7 @@ public class InternalUsers {
.privileges(
filterNonNull(
// needed to rollover failure store
DataStream.isFailureStoreFeatureFlagEnabled() ? "manage_failure_store" : null,
"manage_failure_store",
LazyRolloverAction.NAME
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ public enum Cap {
/**
* Index component selector syntax (my-data-stream-name::failures)
*/
INDEX_COMPONENT_SELECTORS(DataStream.isFailureStoreFeatureFlagEnabled()),
INDEX_COMPONENT_SELECTORS,

/**
* Make numberOfChannels consistent with layout in DefaultLayout by removing duplicated ChannelSet.
Expand Down