Jelajahi Sumber

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.
Bob Nettleton 10 tahun lalu
induk
melakukan
8f7f717779

+ 4 - 0
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"));

+ 6 - 0
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();
   }