Skip to content

Commit

Permalink
[7.9] Fix retrieving data stream stats for a DS with multiple backing…
Browse files Browse the repository at this point in the history
… indices (#59806) (#59811)

Backports the following commits to 7.9:

    Fix retrieving data stream stats for a DS with multiple backing indices (#59806)
  • Loading branch information
dakrone committed Jul 17, 2020
1 parent d48975a commit 272b641
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Multi Get with alias that resolves to multiple indices":
- skip:
version: " - 6.99.99"
reason: types are required in requests before 7.0.0
version: " - 7.8.99"
reason: "message was changed to fix grammar in 7.9"

- do:
bulk:
Expand Down Expand Up @@ -42,4 +42,4 @@
- match: { docs.1._type: null }
- match: { docs.1._id: "2" }
- match: { docs.1.error.root_cause.0.type: "illegal_argument_exception" }
- match: { docs.1.error.root_cause.0.reason: "/[aA]lias.\\[test_two_and_three\\].has.more.than.one.indices.associated.with.it.\\[\\[test_[23]{1},.test_[23]{1}\\]\\],.can't.execute.a.single.index.op/" }
- match: { docs.1.error.root_cause.0.reason: "/[aA]lias.\\[test_two_and_three\\].has.more.than.one.index.associated.with.it.\\[test_[23]{1},.test_[23]{1}\\],.can't.execute.a.single.index.op/" }
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
"Multi Get with alias that resolves to multiple indices":
- skip:
version: " - 7.8.99"
reason: "message was changed to fix grammar in 7.9"

- do:
bulk:
Expand Down Expand Up @@ -39,4 +42,4 @@
- match: { docs.1._type: test }
- match: { docs.1._id: "2" }
- match: { docs.1.error.root_cause.0.type: "illegal_argument_exception" }
- match: { docs.1.error.root_cause.0.reason: "/[aA]lias.\\[test_two_and_three\\].has.more.than.one.indices.associated.with.it.\\[\\[test_[23]{1},.test_[23]{1}\\]\\],.can't.execute.a.single.index.op/" }
- match: { docs.1.error.root_cause.0.reason: "/[aA]lias.\\[test_two_and_three\\].has.more.than.one.index.associated.with.it.\\[test_[23]{1},.test_[23]{1}\\],.can't.execute.a.single.index.op/" }
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ public void testThatMgetShouldWorkWithMultiIndexAlias() throws IOException {

assertThat(mgetResponse.getResponses()[1].getIndex(), is("multiIndexAlias"));
assertThat(mgetResponse.getResponses()[1].isFailed(), is(true));
assertThat(mgetResponse.getResponses()[1].getFailure().getMessage(), containsString("more than one indices"));
assertThat(mgetResponse.getResponses()[1].getFailure().getMessage(), containsString("more than one index"));

mgetResponse = client().prepareMultiGet()
.add(new MultiGetRequest.Item("multiIndexAlias", "test", "1"))
.get();
assertThat(mgetResponse.getResponses().length, is(1));
assertThat(mgetResponse.getResponses()[0].getIndex(), is("multiIndexAlias"));
assertThat(mgetResponse.getResponses()[0].isFailed(), is(true));
assertThat(mgetResponse.getResponses()[0].getFailure().getMessage(), containsString("more than one indices"));
assertThat(mgetResponse.getResponses()[0].getFailure().getMessage(), containsString("more than one index"));
}

public void testThatMgetShouldWorkWithAliasRouting() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ Index[] concreteIndices(Context context, String... indexExpressions) {
indexNames[i++] = indexMetadata.getIndex().getName();
}
throw new IllegalArgumentException(indexAbstraction.getType().getDisplayName() + " [" + expression +
"] has more than one indices associated with it [" + Arrays.toString(indexNames) +
"], can't execute a single index op");
"] has more than one index associated with it " + Arrays.toString(indexNames) +
", can't execute a single index op");
}

for (IndexMetadata index : indexAbstraction.getIndices()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,15 +604,15 @@ public void testIndexOptionsSingleIndexNoExpandWildcards() {
new IndexNameExpressionResolver.Context(state, IndicesOptions.strictSingleIndexNoExpandForbidClosed());
IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
() -> indexNameExpressionResolver.concreteIndexNames(context, "foofoobar"));
assertThat(e.getMessage(), containsString("alias [foofoobar] has more than one indices associated with it"));
assertThat(e.getMessage(), containsString("alias [foofoobar] has more than one index associated with it"));
}

{
IndexNameExpressionResolver.Context context =
new IndexNameExpressionResolver.Context(state, IndicesOptions.strictSingleIndexNoExpandForbidClosed());
IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
() -> indexNameExpressionResolver.concreteIndexNames(context, "foo", "foofoobar"));
assertThat(e.getMessage(), containsString("alias [foofoobar] has more than one indices associated with it"));
assertThat(e.getMessage(), containsString("alias [foofoobar] has more than one index associated with it"));
}

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ setup:
name: simple-data-stream1
- is_true: acknowledged

- do:
indices.rollover:
alias: "simple-data-stream1"

- do:
indices.data_streams_stats: {}
- match: { data_stream_count: 1 }
- match: { backing_indices: 1 }
- match: { backing_indices: 2 }
- length: { data_streams: 1 }
- match: { data_streams.0.data_stream: 'simple-data-stream1' }
- match: { data_streams.0.backing_indices: 1 }
- match: { data_streams.0.backing_indices: 2 }
- match: { data_streams.0.maximum_timestamp: 0 }

- do:
Expand Down

0 comments on commit 272b641

Please sign in to comment.