Adds Blueprint export handler for Hive Zookeeper quorum configuration

This patch addresses bug AMBARI-7592.

In the case of a multi-node cluster deployment that contains Hive, the
  following property:

"hive.zookeeper.quorum"

was not being properly handled by the BlueprintConfigurationProcessor.

This meant that this property would include hostname information
  in an exported Blueprint.  This is incorrect, since the Blueprint
  should not contain direct references to hostnames.

This patch fixes this bug by registering a PropertyUpdater
  instance for "hive.zookeeper.quorum" in hive-site.xml.  The
  PropertyUpdater is responsible for stripping out the
  hostnames, and adding in the expected tokens and host
  group names.

This patch also adds new test assertions to an existing
  unit test in order to verify this fix.


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8f7f7177
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8f7f7177
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8f7f7177

Branch: refs/heads/branch-alerts-dev
Commit: 8f7f717779b5249bfe2f36f2635df240231babcb
Parents: 76579d1
Author: Bob Nettleton <[email protected]>
Authored: Wed Oct 1 13:36:23 2014 -0400
Committer: John Speidel <[email protected]>
Committed: Thu Oct 2 10:09:49 2014 -0400

----------------------------------------------------------------------
 .../controller/internal/BlueprintConfigurationProcessor.java   | 4 ++++
 .../internal/BlueprintConfigurationProcessorTest.java          | 6 ++++++
 2 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8f7f7177/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 d33ae65..9663486 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
@@ -853,6 +853,8 @@ public class BlueprintConfigurationProcessor {
     Map<String, PropertyUpdater> multiStormSiteMap = new HashMap<String, 
PropertyUpdater>();
     Map<String, PropertyUpdater> multiCoreSiteMap = new HashMap<String, 
PropertyUpdater>();
     Map<String, PropertyUpdater> multiHdfsSiteMap = new HashMap<String, 
PropertyUpdater>();
+    Map<String, PropertyUpdater> multiHiveSiteMap = new HashMap<String, 
PropertyUpdater>();
+
 
     Map<String, PropertyUpdater> dbHiveSiteMap = new HashMap<String, 
PropertyUpdater>();
 
@@ -881,6 +883,7 @@ public class BlueprintConfigurationProcessor {
     multiHostTopologyUpdaters.put("storm-site", multiStormSiteMap);
     multiHostTopologyUpdaters.put("core-site", multiCoreSiteMap);
     multiHostTopologyUpdaters.put("hdfs-site", multiHdfsSiteMap);
+    multiHostTopologyUpdaters.put("hive-site", multiHiveSiteMap);
 
     dbHostTopologyUpdaters.put("hive-site", dbHiveSiteMap);
 
@@ -936,6 +939,7 @@ public class BlueprintConfigurationProcessor {
     multiWebhcatSiteMap.put("templeton.hive.properties", new 
MultipleHostTopologyUpdater("HIVE_SERVER"));
     multiWebhcatSiteMap.put("templeton.kerberos.principal", new 
MultipleHostTopologyUpdater("WEBHCAT_SERVER"));
     hiveEnvMap.put("hive_hostname", new 
SingleHostTopologyUpdater("HIVE_SERVER"));
+    multiHiveSiteMap.put("hive.zookeeper.quorum", new 
MultipleHostTopologyUpdater("ZOOKEEPER_SERVER"));
 
     // OOZIE_SERVER
     oozieSiteMap.put("oozie.base.url", new 
SingleHostTopologyUpdater("OOZIE_SERVER"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f7f7177/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 90f83bc..a57bacb 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
@@ -1640,8 +1640,10 @@ public class BlueprintConfigurationProcessorTest {
     // setup properties that include host information
     hiveSiteProperties.put("hive.metastore.uris", expectedHostName + ":" + 
expectedPortNum);
     hiveSiteProperties.put("javax.jdo.option.ConnectionURL", expectedHostName 
+ ":" + expectedPortNum);
+    hiveSiteProperties.put("hive.zookeeper.quorum", expectedHostName + ":" + 
expectedPortNum + "," + expectedHostNameTwo + ":" + expectedPortNum);
     hiveEnvProperties.put("hive_hostname", expectedHostName);
 
+
     webHCatSiteProperties.put("templeton.hive.properties", expectedHostName + 
"," + expectedHostNameTwo);
     webHCatSiteProperties.put("templeton.kerberos.principal", 
expectedHostName);
 
@@ -1677,6 +1679,10 @@ public class BlueprintConfigurationProcessorTest {
     assertEquals("hive property not properly exported",
       createExportedHostName(expectedHostGroupName) + "," + 
createExportedHostName(expectedHostGroupNameTwo), 
coreSiteProperties.get("hadoop.proxyuser.hcat.hosts"));
 
+    assertEquals("hive zookeeper quorum property not properly exported",
+      createExportedAddress(expectedPortNum, expectedHostGroupName) + "," + 
createExportedAddress(expectedPortNum, expectedHostGroupNameTwo),
+      hiveSiteProperties.get("hive.zookeeper.quorum"));
+
     mockSupport.verifyAll();
   }
 

Reply via email to