You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/07/24 15:26:56 UTC
[30/50] [abbrv] ambari git commit: AMBARI-21520. Ambari server logs
NPE with no additional stack trace on any host component start/stop
command.(vbrodetskyi)
AMBARI-21520. Ambari server logs NPE with no additional stack trace on any host component start/stop command.(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/30cd7157
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/30cd7157
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/30cd7157
Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 30cd715793183e0c00ea7fdb900482cfcdc13a8a
Parents: 4b189a1
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Wed Jul 19 17:18:27 2017 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Wed Jul 19 17:19:11 2017 +0300
----------------------------------------------------------------------
.../AmbariManagementControllerImpl.java | 3 ++
.../ambari/server/state/ConfigHelper.java | 29 ++++++++++++++++++--
2 files changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/30cd7157/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 38842fa..fac7b94 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -2707,6 +2707,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
return requestStages;
}
+ // check all stack configs are present in desired configs
+ configHelper.checkAllStageConfigsPresentInDesiredConfigs(cluster);
+
// caching upgrade suspended
boolean isUpgradeSuspended = cluster.isUpgradeSuspended();
http://git-wip-us.apache.org/repos/asf/ambari/blob/30cd7157/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
index 2a70ee1..e8250fe 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
@@ -699,7 +699,9 @@ public class ConfigHelper {
for (PropertyInfo stackProperty : stackProperties) {
if (stackProperty.getPropertyTypes().contains(propertyType)) {
String stackPropertyConfigType = fileNameToConfigType(stackProperty.getFilename());
- result.put(stackProperty, actualConfigs.get(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
+ if (actualConfigs.containsKey(stackPropertyConfigType)) {
+ result.put(stackProperty, actualConfigs.get(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
+ }
}
}
@@ -776,13 +778,36 @@ public class ConfigHelper {
for (PropertyInfo stackProperty : stackProperties) {
if (stackProperty.getPropertyTypes().contains(propertyType)) {
String stackPropertyConfigType = fileNameToConfigType(stackProperty.getFilename());
- result.add(actualConfigs.get(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
+ if (actualConfigs.containsKey(stackPropertyConfigType)) {
+ result.add(actualConfigs.get(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
+ }
}
}
return result;
}
+ public void checkAllStageConfigsPresentInDesiredConfigs(Cluster cluster) throws AmbariException {
+ StackId stackId = cluster.getDesiredStackVersion();
+ Set<String> stackConfigTypes = ambariMetaInfo.getStack(stackId.getStackName(),
+ stackId.getStackVersion()).getConfigTypeAttributes().keySet();
+ Map<String, Config> actualConfigs = new HashMap<>();
+ Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
+
+ for (Map.Entry<String, DesiredConfig> desiredConfigEntry : desiredConfigs.entrySet()) {
+ String configType = desiredConfigEntry.getKey();
+ DesiredConfig desiredConfig = desiredConfigEntry.getValue();
+ actualConfigs.put(configType, cluster.getConfig(configType, desiredConfig.getTag()));
+ }
+
+ for (String stackConfigType : stackConfigTypes) {
+ if (!actualConfigs.containsKey(stackConfigType)) {
+ LOG.error(String.format("Unable to find stack configuration %s in ambari configs!", stackConfigType));
+ }
+ }
+
+ }
+
/***
* Fetch all the config values of a given PropertyType. For eg: Fetch all stack configs that are of type "user"
* @param cluster