PawasChhokra commented on a change in pull request #1446:
URL: https://github.com/apache/samza/pull/1446#discussion_r539951301
##########
File path:
samza-core/src/main/java/org/apache/samza/clustermanager/StandbyContainerManager.java
##########
@@ -375,18 +403,32 @@ boolean checkStandbyConstraints(String
containerIdToStart, String host) {
SamzaResource resource =
samzaApplicationState.pendingProcessors.get(containerID);
// return false if a conflicting container is pending for launch on the
host
- if (resource != null && resource.getHost().equals(host)) {
- log.info("Container {} cannot be started on host {} because container
{} is already scheduled on this host",
- containerIdToStart, host, containerID);
- return false;
+ if (resource != null) {
+ if (!resource.getHost().equals(ResourceRequestState.ANY_HOST) &&
!host.equals(ResourceRequestState.ANY_HOST)
+ && faultDomainManager.checkHostsOnSameFaultDomain(host,
resource.getHost())) {
+ log.info("Container {} cannot be started on host {} because
container {} is already scheduled on this rack",
+ containerIdToStart, host, containerID);
+ return false;
+ } else if (resource.getHost().equals(host)) {
+ log.info("Container {} cannot be started on host {} because
container {} is already scheduled on this host",
+ containerIdToStart, host, containerID);
+ return false;
+ }
}
// return false if a conflicting container is running on the host
resource = samzaApplicationState.runningProcessors.get(containerID);
- if (resource != null && resource.getHost().equals(host)) {
- log.info("Container {} cannot be started on host {} because container
{} is already running on this host",
- containerIdToStart, host, containerID);
- return false;
+ if (resource != null) {
+ if (!resource.getHost().equals(ResourceRequestState.ANY_HOST) &&
!host.equals(ResourceRequestState.ANY_HOST)
Review comment:
1. Addressed in the previous comment. The hosts passed here will never
be ANY_HOST and will have a hostname.
2. This should be handled here.
3. Simplified the check and removed the ANY_HOST checks.
----------------------------------------------------------------
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]