Repository: ambari Updated Branches: refs/heads/branch-2.6 9e8a039bc -> 78684fb7c
AMBARI-21619. More ResourceManager HA host group placeholders in blueprints Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/78684fb7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/78684fb7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/78684fb7 Branch: refs/heads/branch-2.6 Commit: 78684fb7cb5058eb5ada6ab8fc8bcf664c24df9e Parents: 9e8a039 Author: Attila Doroszlai <[email protected]> Authored: Tue Aug 1 14:22:37 2017 +0200 Committer: Attila Doroszlai <[email protected]> Committed: Fri Aug 11 13:50:47 2017 +0200 ---------------------------------------------------------------------- .../BlueprintConfigurationProcessor.java | 18 +++++------ .../BlueprintConfigurationProcessorTest.java | 34 +++++++++++++------- 2 files changed, 31 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/78684fb7/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java index 5fd2b5b..ab6a586 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java @@ -899,14 +899,14 @@ public class BlueprintConfigurationProcessor { Map<String, String> yarnSiteConfig = clusterTopology.getConfiguration().getFullProperties().get("yarn-site"); // generate the property names based on the current HA config for the ResourceManager deployments for (String resourceManager : parseResourceManagers(yarnSiteConfig)) { - final String rmHostPropertyName = "yarn.resourcemanager.hostname." + resourceManager; - yarnSiteUpdatersForAvailability.put(rmHostPropertyName, new SingleHostTopologyUpdater("RESOURCEMANAGER")); - - final String rmHTTPAddress = "yarn.resourcemanager.webapp.address." + resourceManager; - yarnSiteUpdatersForAvailability.put(rmHTTPAddress, new SingleHostTopologyUpdater("RESOURCEMANAGER")); - - final String rmHTTPSAddress = "yarn.resourcemanager.webapp.https.address." + resourceManager; - yarnSiteUpdatersForAvailability.put(rmHTTPSAddress, new SingleHostTopologyUpdater("RESOURCEMANAGER")); + SingleHostTopologyUpdater updater = new SingleHostTopologyUpdater("RESOURCEMANAGER"); + yarnSiteUpdatersForAvailability.put("yarn.resourcemanager.hostname." + resourceManager, updater); + yarnSiteUpdatersForAvailability.put("yarn.resourcemanager.address." + resourceManager, updater); + yarnSiteUpdatersForAvailability.put("yarn.resourcemanager.admin.address." + resourceManager, updater); + yarnSiteUpdatersForAvailability.put("yarn.resourcemanager.resource-tracker.address." + resourceManager, updater); + yarnSiteUpdatersForAvailability.put("yarn.resourcemanager.scheduler.address." + resourceManager, updater); + yarnSiteUpdatersForAvailability.put("yarn.resourcemanager.webapp.address." + resourceManager, updater); + yarnSiteUpdatersForAvailability.put("yarn.resourcemanager.webapp.https.address." + resourceManager, updater); } return highAvailabilityUpdaters; @@ -1341,7 +1341,7 @@ public class BlueprintConfigurationProcessor { /** * Component name */ - private String component; + private final String component; /** * Constructor. http://git-wip-us.apache.org/repos/asf/ambari/blob/78684fb7/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java index c5af0d9..1959610 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java @@ -3359,6 +3359,14 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport { yarnSiteProperties.put("yarn.resourcemanager.ha.rm-ids", "rm1, rm2"); yarnSiteProperties.put("yarn.resourcemanager.hostname.rm1", expectedHostName); yarnSiteProperties.put("yarn.resourcemanager.hostname.rm2", expectedHostNameTwo); + yarnSiteProperties.put("yarn.resourcemanager.address.rm1", expectedHostName + ":" + expectedPortNum); + yarnSiteProperties.put("yarn.resourcemanager.address.rm2", expectedHostNameTwo + ":" + expectedPortNum); + yarnSiteProperties.put("yarn.resourcemanager.admin.address.rm1", expectedHostName + ":" + expectedPortNum); + yarnSiteProperties.put("yarn.resourcemanager.admin.address.rm2", expectedHostNameTwo + ":" + expectedPortNum); + yarnSiteProperties.put("yarn.resourcemanager.resource-tracker.address.rm1", expectedHostName + ":" + expectedPortNum); + yarnSiteProperties.put("yarn.resourcemanager.resource-tracker.address.rm2", expectedHostNameTwo + ":" + expectedPortNum); + yarnSiteProperties.put("yarn.resourcemanager.scheduler.address.rm1", expectedHostName + ":" + expectedPortNum); + yarnSiteProperties.put("yarn.resourcemanager.scheduler.address.rm2", expectedHostNameTwo + ":" + expectedPortNum); yarnSiteProperties.put("yarn.resourcemanager.webapp.address.rm1", expectedHostName + ":" + expectedPortNum); yarnSiteProperties.put("yarn.resourcemanager.webapp.address.rm2", expectedHostNameTwo + ":" + expectedPortNum); yarnSiteProperties.put("yarn.resourcemanager.webapp.https.address.rm1", expectedHostName + ":" + expectedPortNum); @@ -3411,18 +3419,20 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport { createExportedHostName(expectedHostGroupName, expectedPortNum), yarnSiteProperties.get("yarn.timeline-service.webapp.https.address")); // verify that dynamically-named RM HA properties are exported as expected - assertEquals("Yarn ResourceManager rm1 hostname not exported properly", - createExportedHostName(expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.hostname.rm1")); - assertEquals("Yarn ResourceManager rm2 hostname not exported properly", - createExportedHostName(expectedHostGroupNameTwo), yarnSiteProperties.get("yarn.resourcemanager.hostname.rm2")); - assertEquals("Yarn ResourceManager rm1 web address not exported properly", - createExportedHostName(expectedHostGroupName, expectedPortNum), yarnSiteProperties.get("yarn.resourcemanager.webapp.address.rm1")); - assertEquals("Yarn ResourceManager rm2 web address not exported properly", - createExportedHostName(expectedHostGroupNameTwo, expectedPortNum), yarnSiteProperties.get("yarn.resourcemanager.webapp.address.rm2")); - assertEquals("Yarn ResourceManager rm1 HTTPS address not exported properly", - createExportedHostName(expectedHostGroupName, expectedPortNum), yarnSiteProperties.get("yarn.resourcemanager.webapp.https.address.rm1")); - assertEquals("Yarn ResourceManager rm2 HTTPS address not exported properly", - createExportedHostName(expectedHostGroupNameTwo, expectedPortNum), yarnSiteProperties.get("yarn.resourcemanager.webapp.https.address.rm2")); + List<String> properties = Arrays.asList( + "yarn.resourcemanager.address", + "yarn.resourcemanager.admin.address", + "yarn.resourcemanager.resource-tracker.address", + "yarn.resourcemanager.scheduler.address", + "yarn.resourcemanager.webapp.address", + "yarn.resourcemanager.webapp.https.address" + ); + for (String property : properties) { + String propertyWithID = property + ".rm1"; + assertEquals(propertyWithID, createExportedHostName(expectedHostGroupName, expectedPortNum), yarnSiteProperties.get(propertyWithID)); + propertyWithID = property + ".rm2"; + assertEquals(propertyWithID, createExportedHostName(expectedHostGroupNameTwo, expectedPortNum), yarnSiteProperties.get(propertyWithID)); + } assertEquals("Yarn Zookeeper address property not exported properly", createExportedHostName(expectedHostGroupName, "2181") + "," + createExportedHostName(expectedHostGroupNameTwo, "2181"),
