Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 fbbc855d3 -> f3051f953


AMBARI-15189: Set dfs.allow.truncate = True on HDFS during HAWQ install or add 
service (lavjain via jaoki)


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

Branch: refs/heads/branch-2.2
Commit: f3051f953f4cad56c9e8b8c162038f2f75a5a00e
Parents: fbbc855
Author: Jun Aoki <ja...@apache.org>
Authored: Mon Feb 29 17:41:31 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Mon Feb 29 17:41:31 2016 -0800

----------------------------------------------------------------------
 .../stacks/HDP/2.3/services/stack_advisor.py    |  5 +++++
 .../stacks/2.3/common/test_stack_advisor.py     | 20 ++++++++++++++++++++
 2 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f3051f95/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index 0b4e543..1382697 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -364,6 +364,11 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
     putHdfsSiteProperty = self.putProperty(configurations, "hdfs-site", 
services)
     putHdfsSitePropertyAttribute = self.putPropertyAttribute(configurations, 
"hdfs-site")
 
+    servicesList = [service["StackServices"]["service_name"] for service in 
services["services"]]
+    if "HAWQ" in servicesList:
+      # Set dfs.allow.truncate to true
+      putHdfsSiteProperty('dfs.allow.truncate', 'true')
+
     if ('ranger-hdfs-plugin-properties' in services['configurations']) and 
('ranger-hdfs-plugin-enabled' in 
services['configurations']['ranger-hdfs-plugin-properties']['properties']):
       rangerPluginEnabled = ''
       if 'ranger-hdfs-plugin-properties' in configurations and 
'ranger-hdfs-plugin-enabled' in  
configurations['ranger-hdfs-plugin-properties']['properties']:

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3051f95/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
index 1968c4b..316d172 100644
--- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
@@ -583,6 +583,26 @@ class TestHDP23StackAdvisor(TestCase):
     self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, 
services, None)
     
self.assertEquals(configurations['hdfs-site']['properties']['dfs.namenode.inode.attributes.provider.class'],
 'org.apache.ranger.authorization.hadoop.RangerHdfsAuthorizer', "Test with 
Ranger HDFS plugin is enabled")
 
+    # Test 1 for dfs.allow.truncate with no HAWQ and dfs.allow.truncate not set
+    self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, 
services, hosts)
+    self.assertTrue('dfs.allow.truncate' not in 
configurations['hdfs-site']['properties'])
+
+    # Test 2 for dfs.allow.truncate with HAWQ and dfs.allow.truncate not set
+    services["services"].append({"StackServices" : {"service_name" : "HAWQ"}, 
"components":[]})
+    self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, 
services, hosts)
+    
self.assertEquals(configurations['hdfs-site']['properties']['dfs.allow.truncate'],
 'true')
+
+    # Test 3 for dfs.allow.truncate with no HAWQ and dfs.allow.truncate set to 
false
+    services["services"].remove({"StackServices" : {"service_name" : "HAWQ"}, 
"components":[]})
+    configurations['hdfs-site']['properties']['dfs.allow.truncate'] = 'false'
+    self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, 
services, hosts)
+    
self.assertEquals(configurations['hdfs-site']['properties']['dfs.allow.truncate'],
 'false')
+
+    # Test 4 for dfs.allow.truncate with HAWQ and dfs.allow.truncate set to 
false
+    services["services"].append({"StackServices" : {"service_name" : "HAWQ"}, 
"components":[]})
+    self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, 
services, hosts)
+    
self.assertEquals(configurations['hdfs-site']['properties']['dfs.allow.truncate'],
 'true')
+
   def test_recommendYARNConfigurations(self):
     configurations = {}
     servicesList = ["YARN"]

Reply via email to