@@ -408,7 +408,6 @@ func UpdateGlobalCoordinationState(
408
408
}
409
409
410
410
processes := GetProcessesFromProcessMap (processGroup .ProcessGroupID , processesMap )
411
-
412
411
var excluded bool
413
412
for _ , process := range processes {
414
413
excluded = excluded || process .Excluded
@@ -418,33 +417,85 @@ func UpdateGlobalCoordinationState(
418
417
// exclusion timestamp set or because the processes are excluded.
419
418
if ! (processGroup .IsExcluded () || excluded ) {
420
419
if _ , ok := pendingForExclusion [processGroup .ProcessGroupID ]; ! ok {
420
+ logger .V (1 ).
421
+ Info ("Adding to pendingForExclusion" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is marked for removal but not excluded" )
421
422
updatesPendingForExclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
422
423
}
423
424
424
425
if _ , ok := pendingForInclusion [processGroup .ProcessGroupID ]; ! ok {
426
+ logger .V (1 ).
427
+ Info ("Adding to pendingForInclusion" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is marked for removal but not excluded" )
425
428
updatesPendingForInclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
426
429
}
427
430
} else {
431
+ reason := "process group is excluded and marked for removal"
428
432
// Check if the process group is present in pendingForExclusion or readyForExclusion.
429
433
// If so, add them to the set to remove those entries as the process is already excluded.
430
434
if _ , ok := pendingForExclusion [processGroup .ProcessGroupID ]; ok {
435
+ logger .V (1 ).
436
+ Info ("Removing from pendingForExclusion" , "processGroupID" , processGroup .ProcessGroupID , "reason" , reason )
431
437
updatesPendingForExclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
432
438
}
433
439
434
440
if _ , ok := readyForExclusion [processGroup .ProcessGroupID ]; ok {
441
+ logger .V (1 ).
442
+ Info ("Removing from readyForExclusion" , "processGroupID" , processGroup .ProcessGroupID , "reason" , reason )
435
443
updatesReadyForExclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
436
444
}
437
445
438
446
// Ensure the process is added to the pending for inclusion list.
439
447
if _ , ok := pendingForInclusion [processGroup .ProcessGroupID ]; ! ok {
448
+ logger .V (1 ).
449
+ Info ("Adding to pendingForInclusion" , "processGroupID" , processGroup .ProcessGroupID , "reason" , reason )
440
450
updatesPendingForInclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
441
451
}
442
452
443
453
if processGroup .ExclusionSkipped {
444
454
if _ , ok := readyForInclusion [processGroup .ProcessGroupID ]; ! ok {
455
+ logger .V (1 ).
456
+ Info ("Adding to readyForInclusion" , "processGroupID" , processGroup .ProcessGroupID , "reason" , reason )
445
457
updatesReadyForInclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
446
458
}
447
459
}
460
+
461
+ // if the process group is excluded, we don't need to restart it.
462
+ if _ , ok := pendingForRestart [processGroup .ProcessGroupID ]; ok {
463
+ logger .V (1 ).
464
+ Info ("Removing from pendingForRestart" , "processGroupID" , processGroup .ProcessGroupID , "reason" , reason )
465
+ updatesPendingForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
466
+ }
467
+
468
+ if _ , ok := readyForRestart [processGroup .ProcessGroupID ]; ok {
469
+ logger .V (1 ).
470
+ Info ("Removing from readyForRestart" , "processGroupID" , processGroup .ProcessGroupID , "reason" , reason )
471
+ updatesReadyForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
472
+ }
473
+ }
474
+
475
+ // If the process group is stuck in terminating, we can add it to the ready for inclusion list.
476
+ if processGroup .GetConditionTime (fdbv1beta2 .ResourcesTerminating ) != nil {
477
+ if _ , ok := pendingForInclusion [processGroup .ProcessGroupID ]; ! ok {
478
+ logger .V (1 ).
479
+ Info ("Adding to pendingForInclusion and readyForInclusion" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is marked for removal and in terminating" )
480
+ updatesPendingForInclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
481
+ updatesReadyForInclusion [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionAdd
482
+ }
483
+
484
+ // If the process group is marked for removal and the resources are stuck in terminating or the processes are not running, we should
485
+ // remove them from the restart list, because there are no processes to restart.
486
+ if processGroup .GetConditionTime (fdbv1beta2 .MissingProcesses ) != nil {
487
+ if _ , ok := pendingForRestart [processGroup .ProcessGroupID ]; ok {
488
+ logger .V (1 ).
489
+ Info ("Removing from pendingForRestart" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is marked for removal" )
490
+ updatesPendingForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
491
+ }
492
+
493
+ if _ , ok := readyForRestart [processGroup .ProcessGroupID ]; ok {
494
+ logger .V (1 ).
495
+ Info ("Removing from readyForRestart" , "processGroupID" , processGroup .ProcessGroupID , "reason" , "process group is marked for removal" )
496
+ updatesReadyForRestart [processGroup .ProcessGroupID ] = fdbv1beta2 .UpdateActionDelete
497
+ }
498
+ }
448
499
}
449
500
450
501
addresses , ok := processAddresses [processGroup .ProcessGroupID ]
@@ -457,7 +508,7 @@ func UpdateGlobalCoordinationState(
457
508
continue
458
509
}
459
510
460
- // If the process groups is missing long enough to be ignored, ensure that it's removed from the pending
511
+ // If the process group is missing long enough to be ignored, ensure that it's removed from the pending
461
512
// and the ready list.
462
513
if processGroup .GetConditionTime (fdbv1beta2 .IncorrectCommandLine ) != nil &&
463
514
! restarts .ShouldBeIgnoredBecauseMissing (logger , cluster , processGroup ) {
0 commit comments