Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 527e75c19 -> ad642c7b1


AMBARI-12010. Enabling and disabling Phoenix in HBase configs leaves certain 
configs changed (srimanth)


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

Branch: refs/heads/branch-2.1
Commit: ad642c7b1531107c77869ad885bf65b1943b2165
Parents: 527e75c
Author: Srimanth Gunturi <[email protected]>
Authored: Thu Jun 18 15:45:24 2015 -0700
Committer: Srimanth Gunturi <[email protected]>
Committed: Thu Jun 18 15:53:22 2015 -0700

----------------------------------------------------------------------
 .../stacks/HDP/2.2/services/stack_advisor.py        | 16 ++++++++--------
 .../stacks/HDP/2.3/services/stack_advisor.py        | 12 ++++++------
 .../python/stacks/2.2/common/test_stack_advisor.py  |  8 ++++++++
 .../python/stacks/2.3/common/test_stack_advisor.py  |  9 +++++++++
 4 files changed, 31 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ad642c7b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
index 9de8421..e5b6adb 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
@@ -471,14 +471,14 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
     putHbaseSitePropertyAttributes = self.putPropertyAttribute(configurations, 
"hbase-site")
     putHbaseSiteProperty("hbase.regionserver.global.memstore.size", '0.4')
 
-    if 'hbase-env' in services['configurations'] and 'phoenix_sql_enabled' in 
services['configurations']['hbase-env']['properties']:
-      if 'true' == 
services['configurations']['hbase-env']['properties']['phoenix_sql_enabled'].lower():
-        putHbaseSiteProperty("hbase.regionserver.wal.codec", 
'org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec')
-        putHbaseSiteProperty("phoenix.functions.allowUserDefinedFunctions", 
'true')
-      else:
-        putHbaseSiteProperty("hbase.regionserver.wal.codec", 
'org.apache.hadoop.hbase.regionserver.wal.WALCellCodec')
-        putHbaseSitePropertyAttributes('hbase.rpc.controllerfactory.class', 
'delete', 'true')
-        
putHbaseSitePropertyAttributes('phoenix.functions.allowUserDefinedFunctions', 
'delete', 'true')
+    if 'hbase-env' in services['configurations'] and 'phoenix_sql_enabled' in 
services['configurations']['hbase-env']['properties'] and \
+       'true' == 
services['configurations']['hbase-env']['properties']['phoenix_sql_enabled'].lower():
+      putHbaseSiteProperty("hbase.regionserver.wal.codec", 
'org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec')
+      putHbaseSiteProperty("phoenix.functions.allowUserDefinedFunctions", 
'true')
+    else:
+      putHbaseSiteProperty("hbase.regionserver.wal.codec", 
'org.apache.hadoop.hbase.regionserver.wal.WALCellCodec')
+      putHbaseSitePropertyAttributes('hbase.rpc.controllerfactory.class', 
'delete', 'true')
+      
putHbaseSitePropertyAttributes('phoenix.functions.allowUserDefinedFunctions', 
'delete', 'true')
 
     servicesList = [service["StackServices"]["service_name"] for service in 
services["services"]]
     if 'ranger-hbase-plugin-properties' in services['configurations'] and 
('ranger-hbase-plugin-enabled' in 
services['configurations']['ranger-hbase-plugin-properties']['properties']):

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad642c7b/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 d65d711..b1f4fb0 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
@@ -135,12 +135,12 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
 
       putHbaseEnvPropertyAttributes('hbase_max_direct_memory_size', 'delete', 
'true')
 
-    if 'hbase-env' in services['configurations'] and 'phoenix_sql_enabled' in 
services['configurations']['hbase-env']['properties']:
-      if 'true' == 
services['configurations']['hbase-env']['properties']['phoenix_sql_enabled'].lower():
-        putHbaseSiteProperty("hbase.rpc.controllerfactory.class", 
"org.apache.hadoop.hbase.ipc.controller.ServerRpcControllerFactory")
-        
putHbaseSiteProperty("hbase.region.server.rpc.scheduler.factory.class", 
"org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory")
-      else:
-        
putHbaseSitePropertyAttributes('hbase.region.server.rpc.scheduler.factory.class',
 'delete', 'true')
+    if 'hbase-env' in services['configurations'] and 'phoenix_sql_enabled' in 
services['configurations']['hbase-env']['properties'] and \
+       'true' == 
services['configurations']['hbase-env']['properties']['phoenix_sql_enabled'].lower():
+      putHbaseSiteProperty("hbase.rpc.controllerfactory.class", 
"org.apache.hadoop.hbase.ipc.controller.ServerRpcControllerFactory")
+      putHbaseSiteProperty("hbase.region.server.rpc.scheduler.factory.class", 
"org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory")
+    else:
+      
putHbaseSitePropertyAttributes('hbase.region.server.rpc.scheduler.factory.class',
 'delete', 'true')
 
     servicesList = [service["StackServices"]["service_name"] for service in 
services["services"]]
     if 'ranger-hbase-plugin-properties' in services['configurations'] and 
('ranger-hbase-plugin-enabled' in 
services['configurations']['ranger-hbase-plugin-properties']['properties']):

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad642c7b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
index 78acce3..436d796 100644
--- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
@@ -1983,6 +1983,14 @@ class TestHDP22StackAdvisor(TestCase):
     self.stackAdvisor.recommendHBASEConfigurations(configurations, 
clusterData, services, None)
     self.assertEquals(configurations, expected)
 
+    # Test - default recommendations should have certain configs deleted. HAS 
TO BE LAST TEST.
+    services["configurations"] = {}
+    configurations = {}
+    self.stackAdvisor.recommendHBASEConfigurations(configurations, 
clusterData, services, None)
+    
self.assertEquals(configurations['hbase-site']['property_attributes']['phoenix.functions.allowUserDefinedFunctions'],
 {'delete': 'true'})
+    
self.assertEquals(configurations['hbase-site']['property_attributes']['hbase.rpc.controllerfactory.class'],
 {'delete': 'true'})
+    
self.assertEquals(configurations['hbase-site']['properties']['hbase.regionserver.wal.codec'],
 "org.apache.hadoop.hbase.regionserver.wal.WALCellCodec")
+
 
   def test_recommendHDFSConfigurations(self):
     configurations = {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad642c7b/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 2f73f18..fd35f1c 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
@@ -236,6 +236,15 @@ class TestHDP23StackAdvisor(TestCase):
     self.stackAdvisor.recommendHBASEConfigurations(configurations, 
clusterData, services, None)
     self.assertEquals(configurations, expected)
 
+    # Test - default recommendations should have certain configs deleted. HAS 
TO BE LAST TEST.
+    services["configurations"] = {}
+    configurations = {}
+    self.stackAdvisor.recommendHBASEConfigurations(configurations, 
clusterData, services, None)
+    
self.assertEquals(configurations['hbase-site']['property_attributes']['phoenix.functions.allowUserDefinedFunctions'],
 {'delete': 'true'})
+    
self.assertEquals(configurations['hbase-site']['property_attributes']['hbase.rpc.controllerfactory.class'],
 {'delete': 'true'})
+    
self.assertEquals(configurations['hbase-site']['property_attributes']['hbase.region.server.rpc.scheduler.factory.class'],
 {'delete': 'true'})
+    
self.assertEquals(configurations['hbase-site']['properties']['hbase.regionserver.wal.codec'],
 "org.apache.hadoop.hbase.regionserver.wal.WALCellCodec")
+
 
   def test_recommendHiveConfigurations(self):
     self.maxDiff = None

Reply via email to