Skip to content
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

[7.x] More accurate error message for datastream and alias (#79027) #79029

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
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 @@ -157,7 +157,7 @@ protected void masterOperation(final IndicesAliasesRequest request, final Cluste
if (indexAbstraction.getParentDataStream() != null) {
throw new IllegalArgumentException("The provided expressions [" + String.join(",", action.indices())
+ "] match a backing index belonging to data stream [" + indexAbstraction.getParentDataStream().getName()
+ "]. Data streams and their backing indices don't support aliases.");
+ "]. Data stream backing indices don't support aliases.");
}
}
final Optional<Exception> maybeException = requestValidators.validateRequest(request, state, concreteIndices);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private void validateAliasTargetIsNotDSBackingIndex(ClusterState currentState, A
if (indexAbstraction.getParentDataStream() != null) {
throw new IllegalArgumentException("The provided index [" + action.getIndex()
+ "] is a backing index belonging to data stream [" + indexAbstraction.getParentDataStream().getName()
+ "]. Data streams and their backing indices don't support alias operations.");
+ "]. Data stream backing indices don't support alias operations.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ public void testAliasesForDataStreamBackingIndicesNotSupported() {
IllegalArgumentException exception = expectThrows(IllegalArgumentException.class, () -> service.applyAliasActions(state,
singletonList(new AliasAction.Add(backingIndexName, "test", null, null, null, null, null))));
assertThat(exception.getMessage(), is("The provided index [" + backingIndexName + "] is a backing index belonging to data " +
"stream [foo-stream]. Data streams and their backing indices don't support alias operations."));
"stream [foo-stream]. Data stream backing indices don't support alias operations."));
}

public void testDataStreamAliases() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ public void testAliasActionsFailOnDataStreamBackingIndices() throws Exception {
+ backingIndex
+ "] match a backing index belonging to data stream ["
+ dataStreamName
+ "]. Data streams and their backing indices don't "
+ "]. Data stream backing indices don't "
+ "support aliases."
)
);
Expand Down