diff options
author | Valerij Fredriksen <freva@users.noreply.github.com> | 2021-07-05 12:44:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-05 12:44:43 +0200 |
commit | 0b017fa234bddbfeb106d06bc75d974ef867a3cb (patch) | |
tree | 2920dd1b42ca3be92c97dfd8c707657a71e34c94 /controller-server | |
parent | de0e4caae8412071e68f6b939fa82669ddfb042c (diff) | |
parent | b6df83baa40127b3efa3fe4f084979e304415f49 (diff) |
Merge pull request #18530 from vespa-engine/jonmv/catch-exceptions-in-all-cases
Catch excepptions also when getting confirmed owners
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java index 69e0eb26f16..7398b7e977e 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java @@ -17,7 +17,6 @@ import com.yahoo.yolean.Exceptions; import java.time.Duration; import java.util.HashMap; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; @@ -112,20 +111,29 @@ public class ApplicationOwnershipConfirmer extends ControllerMaintainer { } private double updateConfirmedApplicationOwners() { + AtomicInteger attempts = new AtomicInteger(0); + AtomicInteger failures = new AtomicInteger(0); applications() - .withProjectId() - .withProductionDeployment() - .asList() - .stream() - .filter(application -> application.ownershipIssueId().isPresent()) - .forEach(application -> { - IssueId ownershipIssueId = application.ownershipIssueId().get(); - ownershipIssues.getConfirmedOwner(ownershipIssueId).ifPresent(owner -> { - controller().applications().lockApplicationIfPresent(application.id(), lockedApplication -> - controller().applications().store(lockedApplication.withOwner(owner))); - }); - }); - return 1.0; + .withProjectId() + .withProductionDeployment() + .asList() + .stream() + .filter(application -> application.ownershipIssueId().isPresent()) + .forEach(application -> { + attempts.incrementAndGet(); + IssueId issueId = application.ownershipIssueId().get(); + try { + ownershipIssues.getConfirmedOwner(issueId).ifPresent(owner -> { + controller().applications().lockApplicationIfPresent(application.id(), lockedApplication -> + controller().applications().store(lockedApplication.withOwner(owner))); + }); + } + catch (RuntimeException e) { + failures.incrementAndGet(); + log.log(Level.INFO, "Exception caught when attempting to find confirmed owner of issue with id '" + issueId + "': " + Exceptions.toMessageString(e)); + } + }); + return asSuccessFactor(attempts.get(), failures.get()); } private ApplicationList applications() { |