Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EFA6C18A02 for ; Tue, 1 Mar 2016 01:41:57 +0000 (UTC) Received: (qmail 55436 invoked by uid 500); 1 Mar 2016 01:41:51 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 55403 invoked by uid 500); 1 Mar 2016 01:41:51 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 55394 invoked by uid 99); 1 Mar 2016 01:41:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Mar 2016 01:41:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5B2DDE7897; Tue, 1 Mar 2016 01:41:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jaoki@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-15189: Set dfs.allow.truncate = True on HDFS during HAWQ install or add service (lavjain via jaoki) Date: Tue, 1 Mar 2016 01:41:51 +0000 (UTC) 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 Authored: Mon Feb 29 17:41:31 2016 -0800 Committer: Jun Aoki 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"]