vjagadish1989 commented on a change in pull request #952: Improved 
standby-aware container allocation for active-containers on job redeploys
URL: https://github.com/apache/samza/pull/952#discussion_r267638140
 
 

 ##########
 File path: 
samza-core/src/main/java/org/apache/samza/clustermanager/StandbyContainerManager.java
 ##########
 @@ -226,15 +244,35 @@ private void initiateActiveContainerFailover(String 
containerID, String resource
         // use this standby if there was no previous failover for which this 
standbyResource was used
         if (!(failoverMetadata.isPresent() && 
failoverMetadata.get().isStandbyResourceUsed(standbyContainerResource.getResourceID())))
 {
 
-          log.info("Returning standby container {} in running state for active 
container {}", standbyContainerID,
-              activeContainerID);
-          return Optional.of(new Entry<>(standbyContainerID, 
standbyContainerResource));
+          log.info("Returning standby container {} in running state on host {} 
for active container {}", standbyContainerID, 
standbyContainerResource.getHost(), activeContainerID);
+          return standbyContainerResource.getHost();
         }
       }
     }
-
     log.info("Did not find any running standby container for active container 
{}", activeContainerID);
-    return Optional.empty();
+
+    // Now, we iterate over the list of last-known standbyHosts to check if 
anyone of them has not already been tried
+    Map<String, String> containerToHostMapping = 
this.samzaApplicationState.jobModelManager.jobModel().getAllContainerLocality();
+
+    for (String standbyContainerID : 
this.standbyContainerConstraints.get(activeContainerID)) {
+      String standbyHost = containerToHostMapping.get(standbyContainerID);
 
 Review comment:
   We appear to be re-implementing some of querying logic to find the host for 
a standby-container. Instead, leverage the existing APIs in jobModel to query 
the host for a specific containerId

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to