-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove trappy timeouts from
GetIndexRequest
(#120037)
Relates #107984
- Loading branch information
1 parent
c0f54a9
commit 9f597a4
Showing
65 changed files
with
240 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,15 +182,16 @@ public void testBasicScenario() throws Exception { | |
|
||
String backingIndex = barDataStream.getIndices().get(0).getName(); | ||
backingIndices.add(backingIndex); | ||
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet(); | ||
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex)) | ||
.actionGet(); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue()); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true)); | ||
Map<?, ?> mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap(); | ||
assertThat(ObjectPath.eval("[email protected]", mappings), is("date")); | ||
|
||
backingIndex = fooDataStream.getIndices().get(0).getName(); | ||
backingIndices.add(backingIndex); | ||
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet(); | ||
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex)).actionGet(); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue()); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true)); | ||
mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap(); | ||
|
@@ -214,15 +215,15 @@ public void testBasicScenario() throws Exception { | |
|
||
backingIndex = fooRolloverResponse.getNewIndex(); | ||
backingIndices.add(backingIndex); | ||
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet(); | ||
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex)).actionGet(); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue()); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true)); | ||
mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap(); | ||
assertThat(ObjectPath.eval("[email protected]", mappings), is("date")); | ||
|
||
backingIndex = barRolloverResponse.getNewIndex(); | ||
backingIndices.add(backingIndex); | ||
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet(); | ||
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex)).actionGet(); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue()); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true)); | ||
mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap(); | ||
|
@@ -245,7 +246,7 @@ public void testBasicScenario() throws Exception { | |
expectThrows( | ||
IndexNotFoundException.class, | ||
"Backing index '" + index + "' should have been deleted.", | ||
() -> indicesAdmin().getIndex(new GetIndexRequest().indices(index)).actionGet() | ||
() -> indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(index)).actionGet() | ||
); | ||
} | ||
} | ||
|
@@ -479,7 +480,8 @@ public void testComposableTemplateOnlyMatchingWithDataStreamName() throws Except | |
String backingIndex = getDataStreamResponse.getDataStreams().get(0).getDataStream().getIndices().get(0).getName(); | ||
assertThat(backingIndex, backingIndexEqualTo(dataStreamName, 1)); | ||
|
||
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(dataStreamName)).actionGet(); | ||
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(dataStreamName)) | ||
.actionGet(); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue()); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true)); | ||
assertThat( | ||
|
@@ -492,7 +494,7 @@ public void testComposableTemplateOnlyMatchingWithDataStreamName() throws Except | |
assertThat(backingIndex, backingIndexEqualTo(dataStreamName, 2)); | ||
assertTrue(rolloverResponse.isRolledOver()); | ||
|
||
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet(); | ||
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex)).actionGet(); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue()); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true)); | ||
assertThat( | ||
|
@@ -518,7 +520,7 @@ public void testComposableTemplateOnlyMatchingWithDataStreamName() throws Except | |
expectThrows( | ||
IndexNotFoundException.class, | ||
"Backing index '" + index.getName() + "' should have been deleted.", | ||
() -> indicesAdmin().getIndex(new GetIndexRequest().indices(index.getName())).actionGet() | ||
() -> indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(index.getName())).actionGet() | ||
); | ||
} | ||
} | ||
|
@@ -606,7 +608,7 @@ public void testResolvabilityOfDataStreamsInAPIs() throws Exception { | |
verifyResolvability(dataStreamName, clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT, dataStreamName), false); | ||
verifyResolvability(dataStreamName, clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).setIndices(dataStreamName), false); | ||
verifyResolvability(dataStreamName, client().prepareFieldCaps(dataStreamName).setFields("*"), false); | ||
verifyResolvability(dataStreamName, indicesAdmin().prepareGetIndex().addIndices(dataStreamName), false); | ||
verifyResolvability(dataStreamName, indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(dataStreamName), false); | ||
verifyResolvability(dataStreamName, indicesAdmin().prepareOpen(dataStreamName), false); | ||
verifyResolvability(dataStreamName, indicesAdmin().prepareClose(dataStreamName), true); | ||
verifyResolvability(aliasToDataStream, indicesAdmin().prepareClose(aliasToDataStream), true); | ||
|
@@ -653,7 +655,7 @@ public void testResolvabilityOfDataStreamsInAPIs() throws Exception { | |
verifyResolvability(wildcardExpression, clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT, wildcardExpression), false); | ||
verifyResolvability(wildcardExpression, clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).setIndices(wildcardExpression), false); | ||
verifyResolvability(wildcardExpression, client().prepareFieldCaps(wildcardExpression).setFields("*"), false); | ||
verifyResolvability(wildcardExpression, indicesAdmin().prepareGetIndex().addIndices(wildcardExpression), false); | ||
verifyResolvability(wildcardExpression, indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(wildcardExpression), false); | ||
verifyResolvability(wildcardExpression, indicesAdmin().prepareOpen(wildcardExpression), false); | ||
verifyResolvability(wildcardExpression, indicesAdmin().prepareClose(wildcardExpression), false); | ||
verifyResolvability( | ||
|
@@ -1401,7 +1403,8 @@ public void testGetDataStream() throws Exception { | |
} | ||
|
||
private static void assertBackingIndex(String backingIndex, String timestampFieldPathInMapping, Map<?, ?> expectedMapping) { | ||
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet(); | ||
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex)) | ||
.actionGet(); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue()); | ||
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true)); | ||
Map<?, ?> mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap(); | ||
|
@@ -1488,7 +1491,8 @@ public void testMixedAutoCreate() throws Exception { | |
assertThat(getDataStreamsResponse.getDataStreams().get(2).getDataStream().getName(), equalTo("logs-foobaz2")); | ||
assertThat(getDataStreamsResponse.getDataStreams().get(3).getDataStream().getName(), equalTo("logs-foobaz3")); | ||
|
||
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices("logs-bar*")).actionGet(); | ||
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices("logs-bar*")) | ||
.actionGet(); | ||
assertThat(getIndexResponse.getIndices(), arrayWithSize(4)); | ||
assertThat(getIndexResponse.getIndices(), hasItemInArray("logs-barbaz")); | ||
assertThat(getIndexResponse.getIndices(), hasItemInArray("logs-barfoo")); | ||
|
@@ -1521,7 +1525,8 @@ public void testAutoCreateV1TemplateNoDataStream() { | |
.actionGet(); | ||
assertThat(getDataStreamsResponse.getDataStreams(), hasSize(0)); | ||
|
||
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices("logs-foobar")).actionGet(); | ||
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices("logs-foobar")) | ||
.actionGet(); | ||
assertThat(getIndexResponse.getIndices(), arrayWithSize(1)); | ||
assertThat(getIndexResponse.getIndices(), hasItemInArray("logs-foobar")); | ||
assertThat(getIndexResponse.getSettings().get("logs-foobar").get(IndexMetadata.SETTING_NUMBER_OF_REPLICAS), equalTo("0")); | ||
|
@@ -1657,7 +1662,7 @@ public void testMultiThreadedRollover() throws Exception { | |
.actionGet(); | ||
String newBackingIndexName = getDataStreamResponse.getDataStreams().get(0).getDataStream().getWriteIndex().getName(); | ||
assertThat(newBackingIndexName, backingIndexEqualTo("potato-biscuit", 2)); | ||
indicesAdmin().prepareGetIndex().addIndices(newBackingIndexName).get(); | ||
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(newBackingIndexName).get(); | ||
} catch (Exception e) { | ||
logger.info("--> expecting second index to be created but it has not yet been created"); | ||
fail("expecting second index to exist"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.