Repository: ambari Updated Branches: refs/heads/branch-2.1 2f41cc67e -> e9ad2afea
AMBARI-13566. After upgrade Namenode fails to start when Kerberos is enabled using HDP 2.2.8.0 (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e9ad2afe Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e9ad2afe Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e9ad2afe Branch: refs/heads/branch-2.1 Commit: e9ad2afea2de381414e4a19c733b69986f4f9d92 Parents: 2f41cc6 Author: Andrew Onishuk <[email protected]> Authored: Mon Oct 26 19:31:08 2015 +0200 Committer: Andrew Onishuk <[email protected]> Committed: Mon Oct 26 19:31:08 2015 +0200 ---------------------------------------------------------------------- .../ambari/server/state/PropertyInfo.java | 3 +- .../server/upgrade/AbstractUpgradeCatalog.java | 32 +------------------- .../server/upgrade/UpgradeCatalog210.java | 15 ++++++++- .../HDFS/2.1.0.2.0/configuration/hdfs-site.xml | 1 + .../services/HIVE/configuration/hive-site.xml | 6 ++++ 5 files changed, 24 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/e9ad2afe/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java index a6ef1d0..d0b7670 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java @@ -232,6 +232,7 @@ public class PropertyInfo { PASSWORD, USER, GROUP, - ADDITIONAL_USER_PROPERTY + ADDITIONAL_USER_PROPERTY, + DONT_ADD_ON_UPGRADE } } http://git-wip-us.apache.org/repos/asf/ambari/blob/e9ad2afe/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java index 92cc9e6..cd3c684 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java @@ -69,8 +69,6 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog { protected Injector injector; // map and list with constants, for filtration like in stack advisor - protected Map<String,List<String>> hiveAuthPropertyValueDependencies = new HashMap<String, List<String>>(); - protected List<String> allHiveAuthPropertyValueDependecies = new ArrayList<String>(); /** * Override variable in child's if table name was changed @@ -99,17 +97,6 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog { this.injector = injector; injector.injectMembers(this); registerCatalog(this); - - hiveAuthPropertyValueDependencies.put("ldap", Arrays.asList("hive.server2.authentication.ldap.url", - "hive.server2.authentication.ldap.baseDN")); - hiveAuthPropertyValueDependencies.put("kerberos", Arrays.asList("hive.server2.authentication.kerberos.keytab", - "hive.server2.authentication.kerberos.principal")); - hiveAuthPropertyValueDependencies.put("pam", Arrays.asList("hive.server2.authentication.pam.services")); - hiveAuthPropertyValueDependencies.put("custom", Arrays.asList("hive.server2.custom.authentication.class")); - - for (List<String> dependencies : hiveAuthPropertyValueDependencies.values()) { - allHiveAuthPropertyValueDependecies.addAll(dependencies); - } } /** @@ -284,7 +271,7 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog { String configType = ConfigHelper.fileNameToConfigType(property.getFilename()); Config clusterConfigs = cluster.getDesiredConfigByType(configType); if(clusterConfigs == null || !clusterConfigs.getProperties().containsKey(property.getName())) { - if (!checkAccordingToStackAdvisor(property, cluster) || property.getValue() == null) { + if (property.getValue() == null || property.getPropertyTypes().contains(PropertyInfo.PropertyType.DONT_ADD_ON_UPGRADE)) { continue; } @@ -308,23 +295,6 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog { } } - protected boolean checkAccordingToStackAdvisor(PropertyInfo property, Cluster cluster) { - if (allHiveAuthPropertyValueDependecies.contains(property.getName())) { - Config hiveSite = cluster.getDesiredConfigByType(CONFIGURATION_TYPE_HIVE_SITE); - if (hiveSite != null) { - String hiveAuthValue = hiveSite.getProperties().get(PROPERTY_HIVE_SERVER2_AUTHENTICATION); - if (hiveAuthValue != null) { - List<String> dependencies = hiveAuthPropertyValueDependencies.get(hiveAuthValue.toLowerCase()); - if (dependencies != null) { - return dependencies.contains(property.getName()); - } - } - } - return false; - } - return true; - } - protected boolean isNNHAEnabled(Cluster cluster) { Config hdfsSiteConfig = cluster.getDesiredConfigByType(CONFIGURATION_TYPE_HDFS_SITE); if (hdfsSiteConfig != null) { http://git-wip-us.apache.org/repos/asf/ambari/blob/e9ad2afe/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java index 41754d9..dc633e3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java @@ -1537,25 +1537,38 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog { if(cluster.getDesiredConfigByType("hive-site") != null) { Set<String> hiveSiteRemoveProps = new HashSet<String>(); + Map<String, String> hiveSiteAddProps = new HashMap<String, String>(); String hive_server2_auth = ""; if (cluster.getDesiredConfigByType("hive-site").getProperties().containsKey("hive.server2.authentication")) { hive_server2_auth = cluster.getDesiredConfigByType("hive-site").getProperties().get("hive.server2.authentication"); } if (!"pam".equalsIgnoreCase(hive_server2_auth)) { hiveSiteRemoveProps.add("hive.server2.authentication.pam.services"); + } else { + hiveSiteAddProps.put("hive.server2.authentication.pam.services", ""); } if (!"custom".equalsIgnoreCase(hive_server2_auth)) { hiveSiteRemoveProps.add("hive.server2.custom.authentication.class"); + } else { + hiveSiteAddProps.put("hive.server2.custom.authentication.class", ""); } if (!"ldap".equalsIgnoreCase(hive_server2_auth)) { hiveSiteRemoveProps.add("hive.server2.authentication.ldap.url"); hiveSiteRemoveProps.add("hive.server2.authentication.ldap.baseDN"); + } else { + hiveSiteAddProps.put("hive.server2.authentication.ldap.url", ""); + hiveSiteAddProps.put("hive.server2.authentication.ldap.baseDN", ""); } if (!"kerberos".equalsIgnoreCase(hive_server2_auth) && !cluster.getServices().containsKey("KERBEROS")) { hiveSiteRemoveProps.add("hive.server2.authentication.kerberos.keytab"); hiveSiteRemoveProps.add("hive.server2.authentication.kerberos.principal"); + } else { + hiveSiteAddProps.put("hive.server2.authentication.kerberos.keytab", ""); + hiveSiteAddProps.put("hive.server2.authentication.kerberos.principal", ""); } - updateConfigurationPropertiesForCluster(cluster, "hive-site", new HashMap<String, String>(), hiveSiteRemoveProps, false, true); + + + updateConfigurationPropertiesForCluster(cluster, "hive-site", hiveSiteAddProps, hiveSiteRemoveProps, false, true); } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/e9ad2afe/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml index e53de9c..0585aa3 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml +++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml @@ -263,6 +263,7 @@ <property> <name>dfs.namenode.rpc-address</name> <value>localhost:8020</value> + <property-type>DONT_ADD_ON_UPGRADE</property-type> <description>RPC address that handles all clients requests.</description> </property> http://git-wip-us.apache.org/repos/asf/ambari/blob/e9ad2afe/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml index cf79e43..381f96b 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml @@ -1734,6 +1734,7 @@ limitations under the License. <property> <name>hive.server2.authentication.ldap.url</name> <value> </value> + <property-type>DONT_ADD_ON_UPGRADE</property-type> <depends-on> <property> <type>hive-site</type> @@ -1744,6 +1745,7 @@ limitations under the License. <property> <name>hive.server2.authentication.ldap.baseDN</name> <value></value> + <property-type>DONT_ADD_ON_UPGRADE</property-type> <value-attributes> <empty-value-valid>true</empty-value-valid> </value-attributes> @@ -1757,6 +1759,7 @@ limitations under the License. <property> <name>hive.server2.authentication.kerberos.keytab</name> <value>/etc/security/keytabs/hive.service.keytab</value> + <property-type>DONT_ADD_ON_UPGRADE</property-type> <depends-on> <property> <type>hive-site</type> @@ -1767,6 +1770,7 @@ limitations under the License. <property> <name>hive.server2.authentication.kerberos.principal</name> <value>hive/[email protected]</value> + <property-type>DONT_ADD_ON_UPGRADE</property-type> <depends-on> <property> <type>hive-site</type> @@ -1777,6 +1781,7 @@ limitations under the License. <property> <name>hive.server2.authentication.pam.services</name> <value></value> + <property-type>DONT_ADD_ON_UPGRADE</property-type> <depends-on> <property> <type>hive-site</type> @@ -1787,6 +1792,7 @@ limitations under the License. <property> <name>hive.server2.custom.authentication.class</name> <value></value> + <property-type>DONT_ADD_ON_UPGRADE</property-type> <depends-on> <property> <type>hive-site</type>
