Skip to content

Commit

Permalink
Improve handling of test processes
Browse files Browse the repository at this point in the history
  • Loading branch information
johscheuer committed Dec 3, 2024
1 parent c59e1d7 commit 2c4f2f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controllers/remove_process_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (r *FoundationDBClusterReconciler) getProcessGroupsToRemove(logger logr.Log
}

excluded, err := processGroup.AllAddressesExcluded(logger, remainingMap)
if !excluded || err != nil {
if processGroup.ProcessClass != fdbv1beta2.ProcessClassTest && (!excluded || err != nil) {
logger.Info("Incomplete exclusion still present in removeProcessGroups step", "processGroupID", processGroup.ProcessGroupID, "error", err)
allExcluded = false
continue
Expand Down
11 changes: 9 additions & 2 deletions controllers/update_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ func checkAndSetProcessStatus(logger logr.Logger, r *FoundationDBClusterReconcil
excluded = process.Excluded
}

if process.ProcessClass == fdbv1beta2.ProcessClassTest && processGroupStatus.IsMarkedForRemoval() {
processGroupStatus.ExclusionSkipped = ok
processGroupStatus.SetExclude()
excluded = true
}

if len(substitutions) == 0 {
continue
}
Expand Down Expand Up @@ -440,7 +446,7 @@ func checkAndSetProcessStatus(logger logr.Logger, r *FoundationDBClusterReconcil
// This allows to handle cases were a process was fully excluded but not yet removed and someone manually includes
// the processes back. If multiple processes are running inside the pod and at least one process is excluded,
// all processes are assumed to be excluded (as the operator always exclude all processes of a pod).
if !excluded && !processGroupStatus.ExclusionTimestamp.IsZero() {
if !excluded && !processGroupStatus.ExclusionSkipped && !processGroupStatus.ExclusionTimestamp.IsZero() {
logger.Info("reset exclusion", "processGroupID", processGroupStatus.ProcessGroupID, "previousTimestamp", processGroupStatus.ExclusionTimestamp)
processGroupStatus.ExclusionTimestamp = nil
}
Expand Down Expand Up @@ -491,7 +497,8 @@ func validateProcessGroups(ctx context.Context, r *FoundationDBClusterReconciler
// If the process group should be removed without exclusion or the process class is test, remove it without
// further checks. For the test processes there is no reason to try to exclude them as they are not maintaining
// any data.
if ok || processGroup.ProcessClass == fdbv1beta2.ProcessClassTest {
if !processGroup.ExclusionSkipped && (ok || processGroup.ProcessClass == fdbv1beta2.ProcessClassTest) {
logger.V(1).Info("Process group is being removed without exclusion", "ProcessGroupID", processGroup.ProcessGroupID)
processGroup.ExclusionSkipped = ok
processGroup.SetExclude()
}
Expand Down

0 comments on commit 2c4f2f0

Please sign in to comment.