AMBARI-14390. EU from HDP 2.1 to 2.3 added NULL properties (afernandez via dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/314bbc6b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/314bbc6b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/314bbc6b Branch: refs/heads/trunk Commit: 314bbc6b876f04d579d315f49c81062443c37998 Parents: 9e2a603 Author: Lisnichenko Dmitro <[email protected]> Authored: Wed Dec 16 10:00:27 2015 +0200 Committer: Lisnichenko Dmitro <[email protected]> Committed: Wed Dec 16 10:00:27 2015 +0200 ---------------------------------------------------------------------- .../internal/UpgradeResourceProvider.java | 11 +++++++ .../ambari/server/state/ConfigMergeHelper.java | 2 ++ .../HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml | 14 ++++++++ .../stacks/HDP/2.2/upgrades/config-upgrade.xml | 34 ++++++++++++++++++++ 4 files changed, 61 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/314bbc6b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java index 1e59b58..0f9e65e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java @@ -1026,6 +1026,17 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider if (null == newDefaultConfigurations) { newConfigurationsByType.put(configurationType, existingConfigurations); continue; + } else { + // TODO, should we remove existing configs whose value is NULL even though they don't have a value in the new stack? + + // Remove any configs in the new stack whose value is NULL, unless they currently exist and the value is not NULL. + Iterator<Map.Entry<String, String>> iter = newDefaultConfigurations.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry<String, String> entry = iter.next(); + if (entry.getValue() == null) { + iter.remove(); + } + } } // for every existing configuration, see if an entry exists; if it does http://git-wip-us.apache.org/repos/asf/ambari/blob/314bbc6b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java index b799bc7..9d366ae 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java @@ -78,6 +78,7 @@ public class ConfigMergeHelper { targetStack.getStackName(), targetStack.getStackVersion()); addToMap(newMap, set); + // Final result after merging. Map<String, Map<String, ThreeWayValue>> result = new HashMap<String, Map<String, ThreeWayValue>>(); @@ -104,6 +105,7 @@ public class ConfigMergeHelper { customValueKeys = CollectionUtils.subtract(valueKeys, oldPairs.keySet()); } + // Keep properties with custom values (i.e., changed from default value in old stack) if (null != customValueKeys) { for (String prop : customValueKeys) { String newVal = newPairs.get(prop); http://git-wip-us.apache.org/repos/asf/ambari/blob/314bbc6b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml index ef4b531..a46a5cd 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml @@ -221,11 +221,25 @@ <supports-auto-skip-failure>false</supports-auto-skip-failure> <!--Changes for stack 2.2--> + <!--HDFS--> + <execute-stage service="HDFS" component="NAMENODE" title="Apply config changes for NameNode without Ranger"> + <task xsi:type="configure" id="hdp_2_2_0_0_namenode_no_ranger"/> + </execute-stage> + <!--YARN--> <execute-stage service="MAPREDUCE2" component="HISTORYSERVER" title="Apply config changes for HistoryServer"> <task xsi:type="configure" id="hdp_2_2_0_0_historyserver_classpath"/> </execute-stage> + <execute-stage service="MAPREDUCE2" component="HISTORYSERVER" title="Apply config changes for YARN without Ranger"> + <task xsi:type="configure" id="hdp_2_2_0_0_historyserver_no_ranger"/> + </execute-stage> + + <!--STORM--> + <execute-stage service="STORM" component="NIMBUS" title="Apply config changes for Nimbus without Ranger"> + <task xsi:type="configure" id="hdp_2_2_0_0_nimbus_no_ranger"/> + </execute-stage> + <!--Changes for stack 2.3--> <!--HDFS--> <execute-stage service="HDFS" component="NAMENODE" title="Apply config changes for NameNode"> http://git-wip-us.apache.org/repos/asf/ambari/blob/314bbc6b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/config-upgrade.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/config-upgrade.xml index ab384db..c2844fa 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/config-upgrade.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/config-upgrade.xml @@ -19,6 +19,20 @@ <upgrade-config-changes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <services> + + <service name="HDFS"> + <component name="NAMENODE"> + <changes> + <definition xsi:type="configure" id="hdp_2_2_0_0_namenode_no_ranger" summary="NameNode properties without Ranger"> + <!-- In HDP 2.1, RANGER was not present, so this property must not be added even though it is new in the + HDP 2.2 stack. The property is only valid in HDP 2.2 and higher if RANGER is present. --> + <type>hdfs-site</type> + <transfer operation="delete" delete-key="dfs.namenode.inode.attributes.provider.class"/> + </definition> + </changes> + </component> + </service> + <service name="YARN"> <component name="HISTORY_SERVER"> <changes> @@ -26,6 +40,13 @@ <type>yarn-site</type> <set key="yarn.application.classpath" value="$HADOOP_CONF_DIR,/usr/hdp/current/hadoop-client/*,/usr/hdp/current/hadoop-client/lib/*,/usr/hdp/current/hadoop-hdfs-client/*,/usr/hdp/current/hadoop-hdfs-client/lib/*,/usr/hdp/current/hadoop-yarn-client/*,/usr/hdp/current/hadoop-yarn-client/lib/*"/> </definition> + + <definition xsi:type="configure" id="hdp_2_2_0_0_historyserver_no_ranger" summary="YARN properties without Ranger"> + <!-- In HDP 2.1, RANGER was not present, so this property must not be added even though it is new in the + HDP 2.2 stack. The property is only valid in HDP 2.2 and higher if RANGER is present. --> + <type>yarn-site</type> + <transfer operation="delete" delete-key="yarn.authorization-provider"/> + </definition> </changes> </component> </service> @@ -91,4 +112,17 @@ </service> </services> + <service name="STORM"> + <component name="NIMBUS"> + <changes> + <definition xsi:type="configure" id="hdp_2_2_0_0_nimbus_no_ranger" summary="Nimbus properties without Ranger"> + <!-- In HDP 2.1, RANGER was not present, so this property must not be added even though it is new in the + HDP 2.2 stack. The property is only valid in HDP 2.2 and higher if RANGER is present. --> + <type>storm-site</type> + <transfer operation="delete" delete-key="nimbus.authorizer"/> + </definition> + </changes> + </component> + </service> + </upgrade-config-changes>
