@@ -324,30 +324,31 @@ public static void bootstrapNodes(boolean condition, Runnable startAction, List<
324
324
final Random bootstrapRandom = new Random (randomLong ());
325
325
326
326
bootstrapThread = new Thread (() -> {
327
- BootstrapConfiguration bootstrapConfiguration = null ;
327
+ BootstrapClusterRequest bootstrapClusterRequest = null ;
328
328
while (stopBootstrapThread .get () == false ) {
329
329
final Node node = randomFrom (bootstrapRandom , nodes );
330
330
final TransportService transportService = node .injector ().getInstance (TransportService .class );
331
331
if (transportService .getLocalNode () != null ) {
332
332
final Client client = clientWrapper .apply (node .client ());
333
- if (bootstrapConfiguration == null ) {
333
+ if (bootstrapClusterRequest == null ) {
334
334
try {
335
335
final GetDiscoveredNodesRequest discoveredNodesRequest = new GetDiscoveredNodesRequest ();
336
336
discoveredNodesRequest .setMinimumNodeCount (minimumConfigurationSize );
337
337
if (minimumConfigurationSize > 1 && randomBoolean ()) {
338
338
discoveredNodesRequest .setTimeout (TimeValue .timeValueSeconds (5 ));
339
339
}
340
340
341
- bootstrapConfiguration = client .execute (GetDiscoveredNodesAction .INSTANCE , discoveredNodesRequest )
342
- .get ().getBootstrapConfiguration ();
341
+ bootstrapClusterRequest = new BootstrapClusterRequest (
342
+ client .execute (GetDiscoveredNodesAction .INSTANCE , discoveredNodesRequest ).get ()
343
+ .getBootstrapConfiguration ());
343
344
} catch (Exception e ) {
344
345
logger .trace ("exception getting bootstrap configuration" , e );
345
346
}
346
347
} else {
347
348
try {
348
- client .execute (BootstrapClusterAction .INSTANCE , new BootstrapClusterRequest (bootstrapConfiguration ))
349
- .get ();
349
+ client .execute (BootstrapClusterAction .INSTANCE , bootstrapClusterRequest ).get ();
350
350
if (usually (bootstrapRandom )) {
351
+ // occasionally carry on trying to bootstrap even after one request succeeded.
351
352
return ;
352
353
}
353
354
} catch (Exception e ) {
0 commit comments