rdelval commented on a change in pull request #54: Auto Pause for Batch based 
update strategies
URL: https://github.com/apache/aurora/pull/54#discussion_r317367800
 
 

 ##########
 File path: 
src/main/java/org/apache/aurora/scheduler/updater/JobUpdateControllerImpl.java
 ##########
 @@ -334,14 +353,36 @@ public void systemResume() {
         IJobUpdateInstructions instructions = 
details.getUpdate().getInstructions();
         IJobUpdateKey key = summary.getKey();
         JobUpdateStatus status = summary.getState().getStatus();
+        // This is safe because we always write at least one job update event 
on job update creation
+        IJobUpdateEvent latestEvent = 
CHRON_ORDERING.max(details.getUpdateEvents());
 
         if (isCoordinatedUpdate(instructions)) {
           LOG.info("Automatically restoring pulse state for " + key);
 
-          long pulseMs = inferLastPulseTimestamp(details);
+          long pulseMs = inferLastPulseTimestamp(latestEvent);
           pulseHandler.initializePulseState(details.getUpdate(), status, 
pulseMs);
         }
 
+        // Backfill instances seen if the update is auto pause after batch 
enabled and it is
+        // not currently paused. This takes care of a corner case where the 
scheduler crashes
+        // between determining the update should be auto paused and 
successfully pausing
+        // the update.
+        // Note that if if the update is currently paused, a resume will 
correctly
 
 Review comment:
   Good catch!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to