This is an automated email from the ASF dual-hosted git repository. rlevas pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new d9a0929 [AMBARI-23953] YARN start failed during EU with IllegalArgumentException d9a0929 is described below commit d9a0929063eea2b57efa09f3e2b153c0c2a293ea Author: Robert Levas <rle...@hortonworks.com> AuthorDate: Fri May 25 16:43:34 2018 -0400 [AMBARI-23953] YARN start failed during EU with IllegalArgumentException --- .../ambari/server/upgrade/UpgradeCatalog270.java | 95 ++++++++++++++++++++-- .../server/upgrade/UpgradeCatalog270Test.java | 2 + 2 files changed, 90 insertions(+), 7 deletions(-) diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog270.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog270.java index 5df03bb..2fd79c8 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog270.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog270.java @@ -249,6 +249,8 @@ public class UpgradeCatalog270 extends AbstractUpgradeCatalog { public static final String AMBARI_INFRA_OLD_NAME = "AMBARI_INFRA"; public static final String AMBARI_INFRA_NEW_NAME = "AMBARI_INFRA_SOLR"; + static final String YARN_SERVICE = "YARN"; + @Inject DaoUtils daoUtils; @@ -1066,6 +1068,76 @@ public class UpgradeCatalog270 extends AbstractUpgradeCatalog { return; } + final boolean updateInfraKerberosDescriptor = updateInfraKerberosDescriptor(kerberosDescriptor); + final boolean updateWebHCatHostKerberosDescriptor = updateWebHCatHostKerberosDescriptor(kerberosDescriptor); + final boolean updateYarnKerberosDescriptor = updateYarnKerberosDescriptor(kerberosDescriptor); + + if (updateInfraKerberosDescriptor || updateWebHCatHostKerberosDescriptor || updateYarnKerberosDescriptor) { + artifactEntity.setArtifactData(kerberosDescriptor.toMap()); + artifactDAO.merge(artifactEntity); + } + } + + /** + * Updates the Yarn Kerberos descriptor stored in the user-supplied Kerberos Descriptor. + * <p> + * Any updates will be performed on the supplied Kerberos Descriptor. + * <p> + * The following changes may be made: + * <ul> + * <li>Change the reference to rm_host to resourcemanager_hosts</li> + * </ul> + * + * @param kerberosDescriptor the user-supplied Kerberos descriptor used to perform the in-place update + * @return <code>true</code> if changes were made; otherwise <code>false</code> + */ + private boolean updateYarnKerberosDescriptor(KerberosDescriptor kerberosDescriptor) { + boolean updated = false; + KerberosServiceDescriptor yarnServiceDescriptor = kerberosDescriptor.getServices().get(YARN_SERVICE); + if (yarnServiceDescriptor != null) { + KerberosConfigurationDescriptor coreSiteConfiguration = yarnServiceDescriptor.getConfiguration(CONFIGURATION_CORE_SITE); + if (coreSiteConfiguration != null) { + Map<String, String> coreSiteProperties = coreSiteConfiguration.getProperties(); + if (coreSiteProperties != null) { + for (Map.Entry<String, String> entry : coreSiteProperties.entrySet()) { + String value = entry.getValue(); + if (value.contains("rm_host")) { + // changing rm_host to resourcemanager_hosts + String newValue = value.replaceAll("rm_host", "resourcemanager_hosts"); + if (!newValue.equals(value)) { + updated = true; + entry.setValue(newValue); + } + } + } + + if (updated) { + // Ensure that the properties are being updated + coreSiteConfiguration.setProperties(coreSiteProperties); + } + } + } + } + + return updated; + } + + /** + * Updates the Infra Kerberos descriptor stored in the user-supplied Kerberos Descriptor. + * <p> + * Any updates will be performed on the supplied Kerberos Descriptor. + * <p> + * The following changes may be made: + * <ul> + * <li>Rename the AMBARI_INFRA service to AMBARI_INFRA_SOLR</li> + * </ul> + * + * @param kerberosDescriptor the user-supplied Kerberos descriptor used to perform the in-place update + * @return <code>true</code> if changes were made; otherwise <code>false</code> + */ + private boolean updateInfraKerberosDescriptor(KerberosDescriptor kerberosDescriptor) { + boolean updated = false; + Map<String, KerberosServiceDescriptor> services = kerberosDescriptor.getServices(); KerberosServiceDescriptor ambariInfraService = services.get(AMBARI_INFRA_OLD_NAME); if (ambariInfraService != null) { @@ -1080,17 +1152,26 @@ public class UpgradeCatalog270 extends AbstractUpgradeCatalog { updateKerberosIdentities(componentDescriptor); } } - } - final boolean updateWebHCatHostKerberosDescriptor = updateWebHCatHostKerberosDescriptor(kerberosDescriptor); - - if (ambariInfraService != null || updateWebHCatHostKerberosDescriptor) { - artifactEntity.setArtifactData(kerberosDescriptor.toMap()); - artifactDAO.merge(artifactEntity); + updated = true; } + + return updated; } - // some command json elements were modified from ..._host to ..._hosts, kerberos related properties must be adjusted accordingly + /** + * Updates the Hive/WebHCat Kerberos descriptor stored in the user-supplied Kerberos Descriptor. + * <p> + * Any updates will be performed on the supplied Kerberos Descriptor. + * <p> + * The following changes may be made: + * <ul> + * <li>some command json elements were modified from ..._host to ..._hosts, kerberos related properties must be adjusted accordingly</li> + * </ul> + * + * @param kerberosDescriptor the user-supplied Kerberos descriptor used to perform the in-place update + * @return <code>true</code> if changes were made; otherwise <code>false</code> + */ private boolean updateWebHCatHostKerberosDescriptor(KerberosDescriptor kerberosDescriptor) { boolean updated = false; final KerberosServiceDescriptor hiveService = kerberosDescriptor.getServices().get(HiveServiceValidator.HIVE_SERVICE); diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog270Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog270Test.java index c502403..8b2f98c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog270Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog270Test.java @@ -1246,6 +1246,7 @@ public class UpgradeCatalog270Test { //there is HIVE -> WEBHCAT_SERVER -> configurations -> core-site -> hadoop.proxyuser.HTTP.hosts assertTrue(kerberosDescriptorJson.contains("${clusterHostInfo/webhcat_server_host|append(core-site/hadoop.proxyuser.HTTP.hosts, \\\\\\\\,, true)}")); + assertTrue(kerberosDescriptorJson.contains("${clusterHostInfo/rm_host}")); ArtifactEntity artifactEntity = new ArtifactEntity(); artifactEntity.setArtifactName("kerberos_descriptor"); @@ -1266,6 +1267,7 @@ public class UpgradeCatalog270Test { assertThat(newCount, is(oldCount)); assertTrue(newKerberosDescriptorJson.contains("${clusterHostInfo/webhcat_server_hosts|append(core-site/hadoop.proxyuser.HTTP.hosts, \\\\,, true)}")); + assertTrue(newKerberosDescriptorJson.contains("${clusterHostInfo/resourcemanager_hosts}")); verify(upgradeCatalog270); } -- To stop receiving notification emails like this one, please contact rle...@apache.org.