Skip to content

Commit 8f07d60

Browse files
authored
Fix trappy timeouts in o.e.a.a.cluster.* (#112674)
Removes all usages of `TRAPPY_IMPLICIT_DEFAULT_MASTER_NODE_TIMEOUT` in cluster-related APIs in `:server`. Relates #107984
1 parent b633fe1 commit 8f07d60

File tree

357 files changed

+2640
-1479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

357 files changed

+2640
-1479
lines changed

modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/DataStreamIT.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ public void testResolvabilityOfDataStreamsInAPIs() throws Exception {
597597
false
598598
);
599599
verifyResolvability(dataStreamName, indicesAdmin().prepareGetSettings(dataStreamName), false);
600-
verifyResolvability(dataStreamName, clusterAdmin().prepareHealth(dataStreamName), false);
601-
verifyResolvability(dataStreamName, clusterAdmin().prepareState().setIndices(dataStreamName), false);
600+
verifyResolvability(dataStreamName, clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT, dataStreamName), false);
601+
verifyResolvability(dataStreamName, clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).setIndices(dataStreamName), false);
602602
verifyResolvability(dataStreamName, client().prepareFieldCaps(dataStreamName).setFields("*"), false);
603603
verifyResolvability(dataStreamName, indicesAdmin().prepareGetIndex().addIndices(dataStreamName), false);
604604
verifyResolvability(dataStreamName, indicesAdmin().prepareOpen(dataStreamName), false);
@@ -644,8 +644,8 @@ public void testResolvabilityOfDataStreamsInAPIs() throws Exception {
644644
indicesAdmin().prepareUpdateSettings(wildcardExpression).setSettings(Settings.builder().put("index.number_of_replicas", 0)),
645645
false
646646
);
647-
verifyResolvability(wildcardExpression, clusterAdmin().prepareHealth(wildcardExpression), false);
648-
verifyResolvability(wildcardExpression, clusterAdmin().prepareState().setIndices(wildcardExpression), false);
647+
verifyResolvability(wildcardExpression, clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT, wildcardExpression), false);
648+
verifyResolvability(wildcardExpression, clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).setIndices(wildcardExpression), false);
649649
verifyResolvability(wildcardExpression, client().prepareFieldCaps(wildcardExpression).setFields("*"), false);
650650
verifyResolvability(wildcardExpression, indicesAdmin().prepareGetIndex().addIndices(wildcardExpression), false);
651651
verifyResolvability(wildcardExpression, indicesAdmin().prepareOpen(wildcardExpression), false);
@@ -1594,7 +1594,7 @@ public void testClusterStateIncludeDataStream() throws Exception {
15941594
client().execute(CreateDataStreamAction.INSTANCE, createDataStreamRequest).get();
15951595

15961596
// when querying a backing index then the data stream should be included as well.
1597-
ClusterStateRequest request = new ClusterStateRequest().indices(".ds-metrics-foo-*000001");
1597+
ClusterStateRequest request = new ClusterStateRequest(TEST_REQUEST_TIMEOUT).indices(".ds-metrics-foo-*000001");
15981598
ClusterState state = clusterAdmin().state(request).get().getState();
15991599
assertThat(state.metadata().dataStreams().size(), equalTo(1));
16001600
assertThat(state.metadata().dataStreams().get("metrics-foo").getName(), equalTo("metrics-foo"));

modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/ResolveClusterDataStreamIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ private Map<String, Object> setupThreeClusters(boolean useAlias) throws IOExcept
405405
assertFalse(
406406
client(REMOTE_CLUSTER_2).admin()
407407
.cluster()
408-
.prepareHealth(remoteIndex2)
408+
.prepareHealth(TEST_REQUEST_TIMEOUT, remoteIndex2)
409409
.setWaitForYellowStatus()
410410
.setTimeout(TimeValue.timeValueSeconds(10))
411411
.get()

modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleServiceIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ public void testDataLifecycleServiceConfiguresTheMergePolicy() throws Exception
917917
String firstGenerationIndex = getBackingIndices(dataStreamName).get(0);
918918
ClusterGetSettingsAction.Response response = client().execute(
919919
ClusterGetSettingsAction.INSTANCE,
920-
new ClusterGetSettingsAction.Request()
920+
new ClusterGetSettingsAction.Request(TEST_REQUEST_TIMEOUT)
921921
).get();
922922
Settings clusterSettings = response.persistentSettings();
923923

@@ -1093,7 +1093,7 @@ public void testLifecycleAppliedToFailureStore() throws Exception {
10931093
// Let's verify the merge settings
10941094
ClusterGetSettingsAction.Response response = client().execute(
10951095
ClusterGetSettingsAction.INSTANCE,
1096-
new ClusterGetSettingsAction.Request()
1096+
new ClusterGetSettingsAction.Request(TEST_REQUEST_TIMEOUT)
10971097
).get();
10981098
Settings clusterSettings = response.persistentSettings();
10991099

modules/data-streams/src/test/java/org/elasticsearch/datastreams/DataStreamsStatsTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ public void testStatsClosedBackingIndexDataStream() throws Exception {
131131
assertTrue(indicesAdmin().close(new CloseIndexRequest(".ds-" + dataStreamName + "-*-000001")).actionGet().isAcknowledged());
132132

133133
assertBusy(
134-
() -> assertNotEquals(ClusterHealthStatus.RED, clusterAdmin().health(new ClusterHealthRequest()).actionGet().getStatus())
134+
() -> assertNotEquals(
135+
ClusterHealthStatus.RED,
136+
clusterAdmin().health(new ClusterHealthRequest(TEST_REQUEST_TIMEOUT)).actionGet().getStatus()
137+
)
135138
);
136139

137140
DataStreamsStatsAction.Response stats = getDataStreamsStats();

modules/data-streams/src/test/java/org/elasticsearch/datastreams/LookAHeadTimeTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ public void testLookAheadTimeSettingHigherThanTimeSeriesPollIntervalSetting() {
118118
}
119119

120120
private void updateClusterSettings(Settings settings) {
121-
clusterAdmin().updateSettings(new ClusterUpdateSettingsRequest().persistentSettings(settings)).actionGet();
121+
clusterAdmin().updateSettings(
122+
new ClusterUpdateSettingsRequest(TEST_REQUEST_TIMEOUT, TEST_REQUEST_TIMEOUT).persistentSettings(settings)
123+
).actionGet();
122124
}
123125

124126
private void updateIndexSettings(Settings settings) {

modules/lang-painless/src/internalClusterTest/java/org/elasticsearch/painless/action/CrossClusterPainlessExecuteIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private void setupTwoClusters() throws Exception {
175175
assertFalse(
176176
client(REMOTE_CLUSTER).admin()
177177
.cluster()
178-
.prepareHealth(REMOTE_INDEX)
178+
.prepareHealth(TEST_REQUEST_TIMEOUT, REMOTE_INDEX)
179179
.setWaitForYellowStatus()
180180
.setTimeout(TimeValue.timeValueSeconds(10))
181181
.get()

modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/FeatureMigrationIT.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ public void testStartMigrationAndImmediatelyCheckStatus() throws Exception {
8888

8989
ensureGreen();
9090

91-
PostFeatureUpgradeRequest migrationRequest = new PostFeatureUpgradeRequest();
92-
GetFeatureUpgradeStatusRequest getStatusRequest = new GetFeatureUpgradeStatusRequest();
91+
PostFeatureUpgradeRequest migrationRequest = new PostFeatureUpgradeRequest(TEST_REQUEST_TIMEOUT);
92+
GetFeatureUpgradeStatusRequest getStatusRequest = new GetFeatureUpgradeStatusRequest(TEST_REQUEST_TIMEOUT);
9393

9494
// Start the migration and *immediately* request the status. We're trying to detect a race condition with this test, so we need to
9595
// do this as fast as possible, but not before the request to start the migration completes.
@@ -170,7 +170,7 @@ public void testMigrateInternalManagedSystemIndex() throws Exception {
170170
postUpgradeHookCalled.set(true);
171171
});
172172

173-
PostFeatureUpgradeRequest migrationRequest = new PostFeatureUpgradeRequest();
173+
PostFeatureUpgradeRequest migrationRequest = new PostFeatureUpgradeRequest(TEST_REQUEST_TIMEOUT);
174174
PostFeatureUpgradeResponse migrationResponse = client().execute(PostFeatureUpgradeAction.INSTANCE, migrationRequest).get();
175175
assertThat(migrationResponse.getReason(), nullValue());
176176
assertThat(migrationResponse.getElasticsearchException(), nullValue());
@@ -180,7 +180,7 @@ public void testMigrateInternalManagedSystemIndex() throws Exception {
180180
.collect(Collectors.toSet());
181181
assertThat(migratingFeatures, hasItem(FEATURE_NAME));
182182

183-
GetFeatureUpgradeStatusRequest getStatusRequest = new GetFeatureUpgradeStatusRequest();
183+
GetFeatureUpgradeStatusRequest getStatusRequest = new GetFeatureUpgradeStatusRequest(TEST_REQUEST_TIMEOUT);
184184
// The feature upgrade may take longer than ten seconds when tests are running
185185
// in parallel, so we give assertBusy a sixty-second timeout.
186186
assertBusy(() -> {
@@ -196,7 +196,7 @@ public void testMigrateInternalManagedSystemIndex() throws Exception {
196196
assertTrue("the pre-migration hook wasn't actually called", preUpgradeHookCalled.get());
197197
assertTrue("the post-migration hook wasn't actually called", postUpgradeHookCalled.get());
198198

199-
Metadata finalMetadata = clusterAdmin().prepareState().get().getState().metadata();
199+
Metadata finalMetadata = clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).get().getState().metadata();
200200
// Check that the results metadata is what we expect.
201201
FeatureMigrationResults currentResults = finalMetadata.custom(FeatureMigrationResults.TYPE);
202202
assertThat(currentResults, notNullValue());
@@ -246,12 +246,12 @@ public void testMigrateIndexWithWriteBlock() throws Exception {
246246
updateIndexSettings(Settings.builder().put("index.blocks.write", true), indexName);
247247
ensureGreen();
248248

249-
client().execute(PostFeatureUpgradeAction.INSTANCE, new PostFeatureUpgradeRequest()).get();
249+
client().execute(PostFeatureUpgradeAction.INSTANCE, new PostFeatureUpgradeRequest(TEST_REQUEST_TIMEOUT)).get();
250250

251251
assertBusy(() -> {
252252
GetFeatureUpgradeStatusResponse statusResp = client().execute(
253253
GetFeatureUpgradeStatusAction.INSTANCE,
254-
new GetFeatureUpgradeStatusRequest()
254+
new GetFeatureUpgradeStatusRequest(TEST_REQUEST_TIMEOUT)
255255
).get();
256256
logger.info(Strings.toString(statusResp));
257257
assertThat(statusResp.getUpgradeStatus(), equalTo(GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_MIGRATION_NEEDED));
@@ -299,7 +299,7 @@ public void onFailure(Exception e) {
299299
fail("cluster state update failed, see log for details");
300300
}
301301

302-
PostFeatureUpgradeRequest migrationRequest = new PostFeatureUpgradeRequest();
302+
PostFeatureUpgradeRequest migrationRequest = new PostFeatureUpgradeRequest(TEST_REQUEST_TIMEOUT);
303303
PostFeatureUpgradeResponse migrationResponse = client().execute(PostFeatureUpgradeAction.INSTANCE, migrationRequest).get();
304304
// Make sure we actually started the migration
305305
assertTrue(
@@ -309,7 +309,7 @@ public void onFailure(Exception e) {
309309

310310
// Now wait for the migration to finish (otherwise the test infra explodes)
311311
assertBusy(() -> {
312-
GetFeatureUpgradeStatusRequest getStatusRequest = new GetFeatureUpgradeStatusRequest();
312+
GetFeatureUpgradeStatusRequest getStatusRequest = new GetFeatureUpgradeStatusRequest(TEST_REQUEST_TIMEOUT);
313313
GetFeatureUpgradeStatusResponse statusResp = client().execute(GetFeatureUpgradeStatusAction.INSTANCE, getStatusRequest).get();
314314
logger.info(Strings.toString(statusResp));
315315
assertThat(statusResp.getUpgradeStatus(), equalTo(GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_MIGRATION_NEEDED));
@@ -337,8 +337,10 @@ private void migrateWithTemplatesV1(String templatePrefix, SystemIndexDescriptor
337337

338338
ensureGreen();
339339

340-
PostFeatureUpgradeResponse migrationResponse = client().execute(PostFeatureUpgradeAction.INSTANCE, new PostFeatureUpgradeRequest())
341-
.get();
340+
PostFeatureUpgradeResponse migrationResponse = client().execute(
341+
PostFeatureUpgradeAction.INSTANCE,
342+
new PostFeatureUpgradeRequest(TEST_REQUEST_TIMEOUT)
343+
).get();
342344

343345
assertTrue(migrationResponse.isAccepted());
344346
}
@@ -349,7 +351,7 @@ public void testBailOnMigrateWithTemplatesV1() throws Exception {
349351
assertBusy(() -> {
350352
GetFeatureUpgradeStatusResponse statusResp = client().execute(
351353
GetFeatureUpgradeStatusAction.INSTANCE,
352-
new GetFeatureUpgradeStatusRequest()
354+
new GetFeatureUpgradeStatusRequest(TEST_REQUEST_TIMEOUT)
353355
).get();
354356
logger.info(Strings.toString(statusResp));
355357
assertThat(statusResp.getUpgradeStatus(), equalTo(GetFeatureUpgradeStatusResponse.UpgradeStatus.ERROR));
@@ -364,7 +366,7 @@ public void testMigrateWithTemplatesV1() throws Exception {
364366
assertBusy(() -> {
365367
GetFeatureUpgradeStatusResponse statusResp = client().execute(
366368
GetFeatureUpgradeStatusAction.INSTANCE,
367-
new GetFeatureUpgradeStatusRequest()
369+
new GetFeatureUpgradeStatusRequest(TEST_REQUEST_TIMEOUT)
368370
).get();
369371
logger.info(Strings.toString(statusResp));
370372
assertThat(statusResp.getUpgradeStatus(), equalTo(GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_MIGRATION_NEEDED));
@@ -426,8 +428,10 @@ private void migrateWithTemplatesV2(String prefix, SystemIndexDescriptor... desc
426428

427429
ensureGreen();
428430

429-
PostFeatureUpgradeResponse migrationResponse = client().execute(PostFeatureUpgradeAction.INSTANCE, new PostFeatureUpgradeRequest())
430-
.get();
431+
PostFeatureUpgradeResponse migrationResponse = client().execute(
432+
PostFeatureUpgradeAction.INSTANCE,
433+
new PostFeatureUpgradeRequest(TEST_REQUEST_TIMEOUT)
434+
).get();
431435
assertTrue(migrationResponse.isAccepted());
432436
}
433437

@@ -437,7 +441,7 @@ public void testBailOnMigrateWithTemplatesV2() throws Exception {
437441
assertBusy(() -> {
438442
GetFeatureUpgradeStatusResponse statusResp = client().execute(
439443
GetFeatureUpgradeStatusAction.INSTANCE,
440-
new GetFeatureUpgradeStatusRequest()
444+
new GetFeatureUpgradeStatusRequest(TEST_REQUEST_TIMEOUT)
441445
).get();
442446
logger.info(Strings.toString(statusResp));
443447
assertThat(statusResp.getUpgradeStatus(), equalTo(GetFeatureUpgradeStatusResponse.UpgradeStatus.ERROR));
@@ -452,7 +456,7 @@ public void testMigrateWithTemplatesV2() throws Exception {
452456
assertBusy(() -> {
453457
GetFeatureUpgradeStatusResponse statusResp = client().execute(
454458
GetFeatureUpgradeStatusAction.INSTANCE,
455-
new GetFeatureUpgradeStatusRequest()
459+
new GetFeatureUpgradeStatusRequest(TEST_REQUEST_TIMEOUT)
456460
).get();
457461
logger.info(Strings.toString(statusResp));
458462
assertThat(statusResp.getUpgradeStatus(), equalTo(GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_MIGRATION_NEEDED));

modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/MultiFeatureMigrationIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void testMultipleFeatureMigration() throws Exception {
176176
hooksCalled.countDown();
177177
});
178178

179-
PostFeatureUpgradeRequest migrationRequest = new PostFeatureUpgradeRequest();
179+
PostFeatureUpgradeRequest migrationRequest = new PostFeatureUpgradeRequest(TEST_REQUEST_TIMEOUT);
180180
PostFeatureUpgradeResponse migrationResponse = client().execute(PostFeatureUpgradeAction.INSTANCE, migrationRequest).get();
181181
assertThat(migrationResponse.getReason(), nullValue());
182182
assertThat(migrationResponse.getElasticsearchException(), nullValue());
@@ -189,7 +189,7 @@ public void testMultipleFeatureMigration() throws Exception {
189189
// wait for all the plugin methods to have been called before assertBusy since that will exponentially backoff
190190
assertThat(hooksCalled.await(30, TimeUnit.SECONDS), is(true));
191191

192-
GetFeatureUpgradeStatusRequest getStatusRequest = new GetFeatureUpgradeStatusRequest();
192+
GetFeatureUpgradeStatusRequest getStatusRequest = new GetFeatureUpgradeStatusRequest(TEST_REQUEST_TIMEOUT);
193193
assertBusy(() -> {
194194
GetFeatureUpgradeStatusResponse statusResponse = client().execute(GetFeatureUpgradeStatusAction.INSTANCE, getStatusRequest)
195195
.get();
@@ -203,7 +203,7 @@ public void testMultipleFeatureMigration() throws Exception {
203203
assertTrue("the second plugin's pre-migration hook wasn't actually called", secondPluginPreMigrationHookCalled.get());
204204
assertTrue("the second plugin's post-migration hook wasn't actually called", secondPluginPostMigrationHookCalled.get());
205205

206-
Metadata finalMetadata = clusterAdmin().prepareState().get().getState().metadata();
206+
Metadata finalMetadata = clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).get().getState().metadata();
207207
// Check that the results metadata is what we expect
208208
FeatureMigrationResults currentResults = finalMetadata.custom(FeatureMigrationResults.TYPE);
209209
assertThat(currentResults, notNullValue());

modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/SystemIndexMigrationIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void testSystemIndexMigrationCanBeInterruptedWithShutdown() throws Except
8585
clusterService.addListener(clusterStateListener);
8686

8787
// create task by calling API
88-
final PostFeatureUpgradeRequest req = new PostFeatureUpgradeRequest();
88+
final PostFeatureUpgradeRequest req = new PostFeatureUpgradeRequest(TEST_REQUEST_TIMEOUT);
8989
client().execute(PostFeatureUpgradeAction.INSTANCE, req);
9090
logger.info("migrate feature api called");
9191

@@ -101,12 +101,12 @@ public Settings onNodeStopped(String nodeName) throws Exception {
101101

102102
assertBusy(() -> {
103103
// Wait for the node we restarted to completely rejoin the cluster
104-
ClusterState clusterState = clusterAdmin().prepareState().get().getState();
104+
ClusterState clusterState = clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).get().getState();
105105
assertThat("expected restarted node to rejoin cluster", clusterState.getNodes().size(), equalTo(2));
106106

107107
GetFeatureUpgradeStatusResponse statusResponse = client().execute(
108108
GetFeatureUpgradeStatusAction.INSTANCE,
109-
new GetFeatureUpgradeStatusRequest()
109+
new GetFeatureUpgradeStatusRequest(TEST_REQUEST_TIMEOUT)
110110
).get();
111111
assertThat(
112112
"expected migration to fail due to restarting only data node",

plugins/discovery-azure-classic/src/internalClusterTest/java/org/elasticsearch/discovery/azure/classic/AzureSimpleTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void testOneNodeShouldRunUsingPrivateIp() {
3030
assertNotNull(
3131
client().admin()
3232
.cluster()
33-
.prepareState()
33+
.prepareState(TEST_REQUEST_TIMEOUT)
3434
.setMasterNodeTimeout(TimeValue.timeValueSeconds(1))
3535
.get()
3636
.getState()
@@ -52,7 +52,7 @@ public void testOneNodeShouldRunUsingPublicIp() {
5252
assertNotNull(
5353
client().admin()
5454
.cluster()
55-
.prepareState()
55+
.prepareState(TEST_REQUEST_TIMEOUT)
5656
.setMasterNodeTimeout(TimeValue.timeValueSeconds(1))
5757
.get()
5858
.getState()

0 commit comments

Comments
 (0)