ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnettle...@apache.org
Subject ambari git commit: AMBARI-9277. Blueprint configuration processing creates invalid templeton.hive.properties during cluster deployment. (rnettleton)
Date Thu, 22 Jan 2015 20:41:15 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 77ae28e84 -> 0a46a47ea


AMBARI-9277. Blueprint configuration processing creates invalid templeton.hive.properties
during cluster deployment. (rnettleton)


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

Branch: refs/heads/trunk
Commit: 0a46a47eafe9e85331de237deca95f6ac06cb786
Parents: 77ae28e
Author: Bob Nettleton <rnettleton@hortonworks.com>
Authored: Thu Jan 22 15:40:34 2015 -0500
Committer: Bob Nettleton <rnettleton@hortonworks.com>
Committed: Thu Jan 22 15:41:09 2015 -0500

----------------------------------------------------------------------
 .../BlueprintConfigurationProcessor.java        |   2 +-
 .../BlueprintConfigurationProcessorTest.java    | 141 +++++++++++++++++++
 2 files changed, 142 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0a46a47e/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 e7219e9..d2af1d7 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
@@ -1162,7 +1162,7 @@ public class BlueprintConfigurationProcessor {
     multiCoreSiteMap.put("hadoop.proxyuser.hive.hosts", new MultipleHostTopologyUpdater("HIVE_SERVER"));
     multiCoreSiteMap.put("hadoop.proxyuser.HTTP.hosts", new MultipleHostTopologyUpdater("WEBHCAT_SERVER"));
     multiCoreSiteMap.put("hadoop.proxyuser.hcat.hosts", new MultipleHostTopologyUpdater("WEBHCAT_SERVER"));
-    multiWebhcatSiteMap.put("templeton.hive.properties", new MultipleHostTopologyUpdater("HIVE_SERVER"));
+    multiWebhcatSiteMap.put("templeton.hive.properties", new SingleHostTopologyUpdater("HIVE_METASTORE"));
     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"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/0a46a47e/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 9f47163..cac1602 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
@@ -1246,6 +1246,147 @@ public class BlueprintConfigurationProcessorTest {
   }
 
   @Test
+  public void testHiveConfigClusterUpdateCustomValue() throws Exception {
+    final String expectedHostGroupName = "host_group_1";
+
+    final String expectedPropertyValue =
+      "hive.metastore.local=false,hive.metastore.uris=thrift://headnode0.ivantestcluster2-ssh.d1.internal.cloudapp.net:9083,hive.user.install.directory=/user";
+
+    EasyMockSupport mockSupport = new EasyMockSupport();
+
+    HostGroup mockHostGroupOne = mockSupport.createMock(HostGroup.class);
+
+    expect(mockHostGroupOne.getComponents()).andReturn(Collections.singleton("HIVE_METASTORE")).atLeastOnce();
+    expect(mockHostGroupOne.getHostInfo()).andReturn(Collections.singleton("test-host-one")).atLeastOnce();
+
+    mockSupport.replayAll();
+
+    Map<String, Map<String, String>> configProperties =
+      new HashMap<String, Map<String, String>>();
+
+    Map<String, String> webHCatSiteProperties =
+      new HashMap<String, String>();
+
+    configProperties.put("webhcat-site", webHCatSiteProperties);
+
+    // setup properties that include host information
+    webHCatSiteProperties.put("templeton.hive.properties",
+      expectedPropertyValue);
+
+    BlueprintConfigurationProcessor configProcessor =
+      new BlueprintConfigurationProcessor(configProperties);
+
+    Map<String, HostGroup> mapOfHostGroups =
+      new HashMap<String, HostGroup>();
+    mapOfHostGroups.put(expectedHostGroupName, mockHostGroupOne);
+
+    // call top-level cluster config update method
+    configProcessor.doUpdateForClusterCreate(mapOfHostGroups, null);
+
+    assertEquals("Unexpected config update for templeton.hive.properties",
+      expectedPropertyValue,
+      webHCatSiteProperties.get("templeton.hive.properties"));
+
+
+    mockSupport.verifyAll();
+
+  }
+
+  @Test
+  public void testHiveConfigClusterUpdateDefaultValue() throws Exception {
+    final String expectedHostGroupName = "host_group_1";
+    final String expectedHostName = "c6401.ambari.apache.org";
+
+    final String expectedPropertyValue =
+      "hive.metastore.local=false,hive.metastore.uris=thrift://localhost:9933,hive.metastore.sasl.enabled=false";
+
+    EasyMockSupport mockSupport = new EasyMockSupport();
+
+    HostGroup mockHostGroupOne = mockSupport.createMock(HostGroup.class);
+    expect(mockHostGroupOne.getComponents()).andReturn(Collections.singleton("HIVE_METASTORE")).atLeastOnce();
+    expect(mockHostGroupOne.getHostInfo()).andReturn(Collections.singleton(expectedHostName)).atLeastOnce();
+
+    mockSupport.replayAll();
+
+    Map<String, Map<String, String>> configProperties =
+      new HashMap<String, Map<String, String>>();
+
+    Map<String, String> webHCatSiteProperties =
+      new HashMap<String, String>();
+
+    configProperties.put("webhcat-site", webHCatSiteProperties);
+
+    // setup properties that include host information
+    webHCatSiteProperties.put("templeton.hive.properties",
+      expectedPropertyValue);
+
+    BlueprintConfigurationProcessor configProcessor =
+      new BlueprintConfigurationProcessor(configProperties);
+
+    Map<String, HostGroup> mapOfHostGroups =
+      new HashMap<String, HostGroup>();
+    mapOfHostGroups.put(expectedHostGroupName, mockHostGroupOne);
+
+    // call top-level cluster config update method
+    configProcessor.doUpdateForClusterCreate(mapOfHostGroups, null);
+
+    // verify that the host name for the metastore.uris property has been updated
+    assertEquals("Unexpected config update for templeton.hive.properties",
+      "hive.metastore.local=false,hive.metastore.uris=thrift://" + expectedHostName + ":9933,hive.metastore.sasl.enabled=false",
+      webHCatSiteProperties.get("templeton.hive.properties"));
+
+    mockSupport.verifyAll();
+
+  }
+
+  @Test
+  public void testHiveConfigClusterUpdateExportedHostGroupValue() throws Exception {
+    final String expectedHostGroupName = "host_group_1";
+    final String expectedHostName = "c6401.ambari.apache.org";
+
+    // simulate the case of this property coming from an exported Blueprint
+    final String expectedPropertyValue =
+      "hive.metastore.local=false,hive.metastore.uris=thrift://%HOSTGROUP::host_group_1%:9083,hive.metastore.sasl.enabled=false,hive.metastore.execute.setugi=true";
+
+    EasyMockSupport mockSupport = new EasyMockSupport();
+
+    HostGroup mockHostGroupOne = mockSupport.createMock(HostGroup.class);
+    expect(mockHostGroupOne.getHostInfo()).andReturn(Collections.singleton(expectedHostName)).atLeastOnce();
+
+    mockSupport.replayAll();
+
+    Map<String, Map<String, String>> configProperties =
+      new HashMap<String, Map<String, String>>();
+
+    Map<String, String> webHCatSiteProperties =
+      new HashMap<String, String>();
+
+    configProperties.put("webhcat-site", webHCatSiteProperties);
+
+    // setup properties that include host information
+    webHCatSiteProperties.put("templeton.hive.properties",
+      expectedPropertyValue);
+
+    BlueprintConfigurationProcessor configProcessor =
+      new BlueprintConfigurationProcessor(configProperties);
+
+    Map<String, HostGroup> mapOfHostGroups =
+      new HashMap<String, HostGroup>();
+    mapOfHostGroups.put(expectedHostGroupName, mockHostGroupOne);
+
+    // call top-level cluster config update method
+    configProcessor.doUpdateForClusterCreate(mapOfHostGroups, null);
+
+    // verify that the host name for the metastore.uris property has been updated
+    assertEquals("Unexpected config update for templeton.hive.properties",
+      "hive.metastore.local=false,hive.metastore.uris=thrift://" + expectedHostName + ":9083,hive.metastore.sasl.enabled=false,hive.metastore.execute.setugi=true",
+      webHCatSiteProperties.get("templeton.hive.properties"));
+
+    mockSupport.verifyAll();
+
+  }
+
+  @Test
   public void testStormAndKafkaConfigClusterUpdateWithoutGangliaServer() throws Exception
{
     final String expectedHostGroupName = "host_group_1";
 


Mime
View raw message