You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2018/03/13 15:09:50 UTC
[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-22875.
Dependency check should ignore unknown services (#620)
This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by this push:
new d4e4119 AMBARI-22875. Dependency check should ignore unknown services (#620)
d4e4119 is described below
commit d4e41190e58edf0fbe931a5d32eb7d788c4ca5ff
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Tue Mar 13 16:09:48 2018 +0100
AMBARI-22875. Dependency check should ignore unknown services (#620)
---
.../apache/ambari/server/controller/internal/Stack.java | 11 +++++++++++
.../validators/DependencyAndCardinalityValidator.java | 14 +++++++++-----
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/Stack.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/Stack.java
index d08e572..1014245 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/Stack.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/Stack.java
@@ -44,6 +44,8 @@ import org.apache.ambari.server.state.ValueAttributesInfo;
import org.apache.ambari.server.topology.Cardinality;
import org.apache.ambari.server.topology.Configuration;
import org.apache.commons.lang3.tuple.Pair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
@@ -55,6 +57,8 @@ import com.google.common.collect.ImmutableSet;
// TODO move to topology package
public class Stack implements StackDefinition {
+ private static final Logger LOG = LoggerFactory.getLogger(Stack.class);
+
/**
* Stack info
*/
@@ -143,6 +147,11 @@ public class Stack implements StackDefinition {
if (!stackInfo.getServices().isEmpty()) {
registerConditionalDependencies();
}
+
+ String stackId = new StackId(stackInfo.getName(), stackInfo.getVersion()).getStackId();
+ LOG.info("Loaded stack {}", stackId);
+ LOG.debug("Services in stack {}: {}", stackId, serviceComponents);
+ LOG.debug("Components in stack {}: {}", stackId, componentService);
}
/**
@@ -216,6 +225,8 @@ public class Stack implements StackDefinition {
if (serviceInfo != null) {
return serviceInfo.getComponentByName(component);
}
+ } else {
+ LOG.warn("No service found for component {}. Known components: {}", component, componentService.keySet());
}
return null;
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/DependencyAndCardinalityValidator.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/DependencyAndCardinalityValidator.java
index a25dcc4..313248f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/DependencyAndCardinalityValidator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/DependencyAndCardinalityValidator.java
@@ -26,6 +26,7 @@ import java.util.Map;
import org.apache.ambari.server.controller.internal.BlueprintConfigurationProcessor;
import org.apache.ambari.server.controller.internal.StackDefinition;
import org.apache.ambari.server.state.AutoDeployInfo;
+import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.DependencyConditionInfo;
import org.apache.ambari.server.state.DependencyInfo;
import org.apache.ambari.server.topology.Blueprint;
@@ -119,10 +120,9 @@ public class DependencyAndCardinalityValidator implements TopologyValidator {
LOGGER.debug("Processing dependency [{}] for component [{}]", dependency.getName(), component);
// dependent components from the stack definitions are only added if related services are explicitly added to the blueprint!
- boolean isClientDependency = stack.getComponentInfo(dependency.getComponentName()).isClient();
- if (isClientDependency && !topology.getServices().contains(dependency.getServiceName())) {
- LOGGER.debug("The service [{}] for component [{}] is missing from the blueprint [{}], skipping dependency",
- dependency.getServiceName(), dependency.getComponentName(), topology.getBlueprintName());
+ ComponentInfo componentInfo = stack.getComponentInfo(dependency.getComponentName());
+ if (componentInfo == null) {
+ LOGGER.debug("The component [{}] is not associated with any known services, skipping dependency", dependency.getComponentName());
continue;
}
@@ -150,9 +150,13 @@ public class DependencyAndCardinalityValidator implements TopologyValidator {
resolved = missingDependencyInfo.isEmpty();
} else if (dependencyScope.equals("host")) {
- if (group.getComponentNames().contains(componentName) || (autoDeployInfo != null && autoDeployInfo.isEnabled())) {
+ if (group.getComponentNames().contains(componentName)) {
+ resolved = true;
+ LOGGER.debug("Host group {} contains component {} and satisfies host-level dependency for component {}", group.getName(), componentName, component);
+ } else if (autoDeployInfo != null && autoDeployInfo.isEnabled()) {
resolved = true;
group.addComponent(new Component(componentName));
+ LOGGER.info("Added component {} in host group {} to satisfy host-level dependency for component {}", componentName, group.getName(), component);
}
}
--
To stop receiving notification emails like this one, please contact
adoroszlai@apache.org.