diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-05-09 14:00:23 +0200 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-05-09 14:00:23 +0200 |
commit | 9646dfb2d9186c36f118cf7eb29ac81055bfc502 (patch) | |
tree | 527fce59bff2fe1d43dd47474e46caf23804cdb3 | |
parent | 02e883daacb9aac085d18d848395cad568373a17 (diff) |
Memory visibility to ensure step isn't run twice
2 files changed, 2 insertions, 1 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java index 34e04d966a3..b4e440821b5 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java @@ -389,7 +389,7 @@ public class JobController { } /** Locks and modifies the run with the given id, provided it is still active. */ - private void locked(RunId id, UnaryOperator<Run> modifications) { + public void locked(RunId id, UnaryOperator<Run> modifications) { try (Lock __ = curator.lock(id.application(), id.type())) { active(id).ifPresent(run -> { run = modifications.apply(run); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunner.java index a40e60ae7c2..47e17b34d2a 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunner.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunner.java @@ -83,6 +83,7 @@ public class JobRunner extends Maintainer { try { AtomicBoolean changed = new AtomicBoolean(false); jobs.locked(id.application(), id.type(), step, lockedStep -> { + jobs.locked(id, run -> run); // Memory visibility. jobs.active(id).ifPresent(run -> { // The run may have become inactive, so we bail out. if ( ! run.readySteps().contains(step)) return; // Someone may have updated the run status, making this step obsolete, so we bail out. |