Skip to content
Merged
Changes from all commits
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 @@ -691,26 +691,6 @@ private static void resolveIndicesForDataStreamRelatedAbstraction(
}
}

private static void resolveWriteIndexForDataStreams(
Context context,
DataStream dataStream,
Set<Index> concreteIndicesResult,
IndexComponentSelector selector
) {
if (shouldIncludeRegularIndices(context.getOptions(), selector)) {
Index writeIndex = dataStream.getWriteIndex();
if (addIndex(writeIndex, null, context)) {
concreteIndicesResult.add(writeIndex);
}
}
if (shouldIncludeFailureIndices(context.getOptions(), selector)) {
Index failureStoreWriteIndex = dataStream.getWriteFailureIndex();
if (failureStoreWriteIndex != null && addIndex(failureStoreWriteIndex, null, context)) {
concreteIndicesResult.add(failureStoreWriteIndex);
}
}
}

public static boolean shouldIncludeRegularIndices(IndicesOptions indicesOptions, IndexComponentSelector expressionSelector) {
if (indicesOptions.allowSelectors()) {
return expressionSelector == null || expressionSelector.shouldIncludeData();
Expand Down Expand Up @@ -873,19 +853,6 @@ public Index concreteSingleIndex(ProjectMetadata project, IndicesRequest request
return indices[0];
}

/**
* Utility method that allows to resolve an index expression to its corresponding single write index.
*
* @param state the cluster state containing all the data to resolve to expression to a concrete index
* @param request The request that defines how an alias or an index need to be resolved to a concrete index
* and the expression that can be resolved to an alias or an index name.
* @throws IllegalArgumentException if the index resolution does not lead to an index, or leads to more than one index
* @return the write index obtained as a result of the index resolution
*/
public Index concreteWriteIndex(ClusterState state, IndicesRequest request) {
return concreteWriteIndex(projectResolver.getProjectMetadata(state), request);
}

/**
* Utility method that allows to resolve an index expression to its corresponding single write index.
*
Expand Down Expand Up @@ -977,14 +944,6 @@ public Index concreteWriteIndex(
return indices[0];
}

/**
* @return whether the specified index, data stream or alias exists.
* If the data stream, index or alias contains date math then that is resolved too.
*/
public boolean hasIndexAbstraction(String indexAbstraction, ClusterState state) {
return hasIndexAbstraction(indexAbstraction, projectResolver.getProjectMetadata(state));
}

/**
* @return whether the specified index, data stream or alias exists.
* If the data stream, index or alias contains date math then that is resolved too.
Expand Down Expand Up @@ -1041,34 +1000,13 @@ public static void assertExpressionHasNullOrDataSelector(String expression) {
}
}

/**
* Resolve an array of expressions to the set of indices and aliases that these expressions match.
*/
public Set<ResolvedExpression> resolveExpressions(ClusterState state, String... expressions) {
return resolveExpressions(projectResolver.getProjectMetadata(state), expressions);
}

/**
* Resolve an array of expressions to the set of indices and aliases that these expressions match.
*/
public Set<ResolvedExpression> resolveExpressions(ProjectMetadata project, String... expressions) {
return resolveExpressions(project, IndicesOptions.lenientExpandOpen(), false, expressions);
}

/**
* Resolve the expression to the set of indices, aliases, and, optionally, datastreams that the expression matches.
* If {@param preserveDataStreams} is {@code true}, datastreams that are covered by the wildcards from the
* {@param expressions} are returned as-is, without expanding them further to their respective backing indices.
*/
public Set<ResolvedExpression> resolveExpressions(
ClusterState state,
IndicesOptions indicesOptions,
boolean preserveDataStreams,
String... expressions
) {
return resolveExpressions(projectResolver.getProjectMetadata(state), indicesOptions, preserveDataStreams, expressions);
}

/**
* Resolve the expression to the set of indices, aliases, and, optionally, datastreams that the expression matches.
* If {@param preserveDataStreams} is {@code true}, datastreams that are covered by the wildcards from the
Expand Down Expand Up @@ -1101,17 +1039,6 @@ public Set<ResolvedExpression> resolveExpressions(
}
}

/**
* Iterates through the list of indices and selects the effective list of filtering aliases for the
* given index.
* <p>Only aliases with filters are returned. If the indices list contains a non-filtering reference to
* the index itself - null is returned. Returns {@code null} if no filtering is required.
* <b>NOTE</b>: The provided expressions must have been resolved already via {@link #resolveExpressionsToResources(Context, String...)}.
*/
public String[] filteringAliases(ClusterState state, String index, Set<ResolvedExpression> resolvedExpressions) {
return filteringAliases(projectResolver.getProjectMetadata(state), index, resolvedExpressions);
}

/**
* Iterates through the list of indices and selects the effective list of filtering aliases for the
* given index.
Expand Down Expand Up @@ -1140,31 +1067,6 @@ boolean iterateIndexAliases(int indexAliasesSize, int resolvedExpressionsSize) {
return indexAliasesSize <= resolvedExpressionsSize;
}

/**
* Iterates through the list of indices and selects the effective list of required aliases for the given index.
* <p>Only aliases where the given predicate tests successfully are returned. If the indices list contains a non-required reference to
* the index itself - null is returned. Returns {@code null} if no filtering is required.
* <p><b>NOTE</b>: the provided expressions must have been resolved already via
* {@link #resolveExpressionsToResources(Context, String...)}.
*/
public String[] indexAliases(
ClusterState state,
String index,
Predicate<AliasMetadata> requiredAlias,
Predicate<DataStreamAlias> requiredDataStreamAlias,
boolean skipIdentity,
Set<ResolvedExpression> resolvedExpressions
) {
return indexAliases(
projectResolver.getProjectMetadata(state),
index,
requiredAlias,
requiredDataStreamAlias,
skipIdentity,
resolvedExpressions
);
}

/**
* Iterates through the list of indices and selects the effective list of required aliases for the given index.
* <p>Only aliases where the given predicate tests successfully are returned. If the indices list contains a non-required reference to
Expand Down Expand Up @@ -1827,9 +1729,9 @@ private static IndexMetadata.State excludeState(IndicesOptions options) {
final IndexMetadata.State excludeState;
if (options.expandWildcardsOpen() && options.expandWildcardsClosed()) {
excludeState = null;
} else if (options.expandWildcardsOpen() && options.expandWildcardsClosed() == false) {
} else if (options.expandWildcardsOpen()) {
excludeState = IndexMetadata.State.CLOSE;
} else if (options.expandWildcardsClosed() && options.expandWildcardsOpen() == false) {
} else if (options.expandWildcardsClosed()) {
excludeState = IndexMetadata.State.OPEN;
} else {
assert false : "this shouldn't get called if wildcards expand to none";
Expand Down