@@ -426,28 +426,24 @@ public void testRepeatedNullMasterRecognizedAsGreenIfMasterDoesNotKnowItIsUnstab
426
426
.put (CoordinationDiagnosticsService .NO_MASTER_TRANSITIONS_THRESHOLD_SETTING .getKey (), 1 )
427
427
.build ()
428
428
);
429
+ int nullTransitionsThreshold = 1 ;
429
430
final List <String > dataNodes = internalCluster ().startDataOnlyNodes (
430
431
2 ,
431
432
Settings .builder ()
432
433
.put (LeaderChecker .LEADER_CHECK_TIMEOUT_SETTING .getKey (), "1s" )
433
434
.put (Coordinator .PUBLISH_TIMEOUT_SETTING .getKey (), "1s" )
434
- .put (CoordinationDiagnosticsService .NO_MASTER_TRANSITIONS_THRESHOLD_SETTING .getKey (), 1 )
435
+ .put (CoordinationDiagnosticsService .NO_MASTER_TRANSITIONS_THRESHOLD_SETTING .getKey (), nullTransitionsThreshold )
435
436
.put (CoordinationDiagnosticsService .NODE_HAS_MASTER_LOOKUP_TIMEFRAME_SETTING .getKey (), new TimeValue (60 , TimeUnit .SECONDS ))
436
437
.build ()
437
438
);
438
439
ensureStableCluster (3 );
439
- for (int i = 0 ; i < 2 ; i ++) {
440
+ for (int i = 0 ; i < nullTransitionsThreshold + 1 ; i ++) {
440
441
final String masterNode = masterNodes .get (0 );
441
442
442
443
// Simulating a painful gc by suspending all threads for a long time on the current elected master node.
443
444
SingleNodeDisruption masterNodeDisruption = new LongGCDisruption (random (), masterNode );
444
445
445
446
final CountDownLatch dataNodeMasterSteppedDown = new CountDownLatch (2 );
446
- internalCluster ().getInstance (ClusterService .class , masterNode ).addListener (event -> {
447
- if (event .state ().nodes ().getMasterNodeId () == null ) {
448
- dataNodeMasterSteppedDown .countDown ();
449
- }
450
- });
451
447
internalCluster ().getInstance (ClusterService .class , dataNodes .get (0 )).addListener (event -> {
452
448
if (event .state ().nodes ().getMasterNodeId () == null ) {
453
449
dataNodeMasterSteppedDown .countDown ();
@@ -466,7 +462,7 @@ public void testRepeatedNullMasterRecognizedAsGreenIfMasterDoesNotKnowItIsUnstab
466
462
// Stop disruption
467
463
logger .info ("--> unfreezing node [{}]" , masterNode );
468
464
masterNodeDisruption .stopDisrupting ();
469
- ensureStableCluster (3 );
465
+ ensureStableCluster (3 , TimeValue . timeValueSeconds ( 30 ), false , randomFrom ( dataNodes ) );
470
466
}
471
467
assertGreenMasterStability (internalCluster ().client (randomFrom (dataNodes )));
472
468
}
0 commit comments