Repository: ambari
Updated Branches:
  refs/heads/trunk 4e5910d01 -> f3a418c31


AMBARI-10587. HBase 'Phoenix SQL' widget type should be checkbox (srimanth)


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

Branch: refs/heads/trunk
Commit: f3a418c31f7ef30cb077a4e976f76f27025d1732
Parents: 4e5910d
Author: Srimanth Gunturi <[email protected]>
Authored: Sun Apr 19 22:55:59 2015 -0700
Committer: Srimanth Gunturi <[email protected]>
Committed: Sun Apr 19 22:55:59 2015 -0700

----------------------------------------------------------------------
 .../services/HBASE/configuration/hbase-env.xml  | 18 ++++++
 .../services/HBASE/configuration/hbase-site.xml | 18 ++----
 .../HDP/2.2/services/HBASE/themes/theme.json    |  6 +-
 .../stacks/HDP/2.2/services/stack_advisor.py    |  6 ++
 .../stacks/2.2/common/test_stack_advisor.py     | 66 ++++++++++++++++++++
 .../widgets/checkbox_config_widget_view.js      |  7 ++-
 6 files changed, 105 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f3a418c3/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-env.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-env.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-env.xml
index 27270a0..6b6d53b 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-env.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-env.xml
@@ -56,6 +56,24 @@ and the -Xmn ratio (hbase_regionserver_xmn_ratio) exceeds 
this value.
     <value></value>
     <description>If not empty, adds 
'-XX:MaxDirectMemorySize={{hbase_max_direct_memory_size}}m' to 
HBASE_REGIONSERVER_OPTS.</description>
   </property>
+  <property>
+    <name>phoenix_sql_enabled</name>
+    <value>false</value>
+    <description>Enable Phoenix SQL</description>
+    <display-name>Phoenix SQL</display-name>
+    <value-attributes>
+      <type>value-list</type>
+      <entries>
+        <entry>
+          <value>true</value>
+        </entry>
+        <entry>
+          <value>false</value>
+        </entry>
+      </entries>
+      <selection-cardinality>1</selection-cardinality>
+    </value-attributes>
+  </property>
 
   <!-- hbase-env.sh -->
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3a418c3/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
index e4c05d1..ea24813 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/configuration/hbase-site.xml
@@ -110,17 +110,11 @@
     <name>hbase.regionserver.wal.codec</name>
     <display-name>RegionServer WAL Codec</display-name>
     <value>org.apache.hadoop.hbase.regionserver.wal.WALCellCodec</value>
-    <value-attributes>
-      <type>value-list</type>
-      <entries>
-        <entry>
-          <value>org.apache.hadoop.hbase.regionserver.wal.WALCellCodec</value>
-        </entry>
-        <entry>
-          
<value>org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec</value>
-        </entry>
-      </entries>
-    </value-attributes>
-    <description>Phoenix SQL</description>
+    <depends-on>
+      <property>
+        <type>hbase-env</type>
+        <name>phoenix_sql_enabled</name>
+      </property>
+    </depends-on>
   </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3a418c3/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/themes/theme.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/themes/theme.json
 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/themes/theme.json
index a716233..3da7470 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/themes/theme.json
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/themes/theme.json
@@ -228,7 +228,7 @@
           "subsection-name": "subsection-hbase-security-col1"
         },
         {
-          "config": "hbase-site/hbase.regionserver.wal.codec",
+          "config": "hbase-env/phoenix_sql_enabled",
           "subsection-name": "subsection-hbase-phoenix-col1"
         },
         {
@@ -406,9 +406,9 @@
         }
       },
       {
-        "config":"hbase-site/hbase.regionserver.wal.codec",
+        "config":"hbase-env/phoenix_sql_enabled",
         "widget":{
-          "type":"combo"
+          "type":"checkbox"
         }
       },
       {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3a418c3/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 0c10f32..c0e5351 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
@@ -272,6 +272,12 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
     putHbaseSiteProperty = self.putProperty(configurations, "hbase-site", 
services)
     putHbaseSiteProperty("hbase.regionserver.global.memstore.upperLimit", 
'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')
+      else:
+        putHbaseSiteProperty("hbase.regionserver.wal.codec", 
'org.apache.hadoop.hbase.regionserver.wal.WALCellCodec')
+
     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']):
       rangerPluginEnabled = 
services['configurations']['ranger-hbase-plugin-properties']['properties']['ranger-hbase-plugin-enabled']

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3a418c3/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 dda807f..09a1f12 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
@@ -1361,6 +1361,72 @@ class TestHDP22StackAdvisor(TestCase):
     self.stackAdvisor.recommendHbaseEnvConfigurations(configurations, 
clusterData, None, None)
     self.assertEquals(configurations, expected)
 
+  def test_recommendHbaseSiteConfigurations(self):
+    servicesList = ["HBASE"]
+    configurations = {}
+    components = []
+    hosts = {
+      "items" : [
+        {
+          "Hosts" : {
+            "cpu_count" : 6,
+            "total_mem" : 50331648,
+            "disk_info" : [
+              {"mountpoint" : "/"},
+              {"mountpoint" : "/dev/shm"},
+              {"mountpoint" : "/vagrant"},
+              {"mountpoint" : "/"},
+              {"mountpoint" : "/dev/shm"},
+              {"mountpoint" : "/vagrant"}
+            ]
+          }
+        }
+      ]
+    }
+    services = {
+      "services" : [
+      ],
+      "configurations": {
+        "hbase-env": {
+          "properties": {
+            "phoenix_sql_enabled": "true"
+          }
+        }
+      }
+    }
+    expected = {
+      "hbase-site": {
+        "properties": {
+          "hbase.regionserver.wal.codec": 
"org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec",
+          "hbase.bucketcache.size": "",
+          "hbase.bucketcache.percentage.in.combinedcache": "",
+          "hbase.regionserver.global.memstore.upperLimit": "0.4",
+          "hbase.bucketcache.ioengine": ""
+        }
+      },
+      "hbase-env": {
+        "properties": {
+          "hbase_master_heapsize": "8192",
+          "hbase_regionserver_heapsize": "8192",
+          "hbase_max_direct_memory_size": ""
+        }
+      }
+    }
+
+    clusterData = 
self.stackAdvisor.getConfigurationClusterSummary(servicesList, hosts, 
components, None)
+    self.assertEquals(clusterData['hbaseRam'], 8)
+
+    # Test when phoenix_sql_enabled = true
+    self.stackAdvisor.recommendHBASEConfigurations(configurations, 
clusterData, services, None)
+    self.assertEquals(configurations, expected)
+
+    # Test when phoenix_sql_enabled = false
+    
services['configurations']['hbase-env']['properties']['phoenix_sql_enabled'] = 
'false'
+    expected['hbase-site']['properties']['hbase.regionserver.wal.codec'] = 
'org.apache.hadoop.hbase.regionserver.wal.WALCellCodec'
+    self.stackAdvisor.recommendHBASEConfigurations(configurations, 
clusterData, services, None)
+    self.assertEquals(configurations, expected)
+
+
   def test_recommendHDFSConfigurations(self):
     configurations = {
       'ranger-hdfs-plugin-properties':{

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3a418c3/ambari-web/app/views/common/configs/widgets/checkbox_config_widget_view.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/views/common/configs/widgets/checkbox_config_widget_view.js 
b/ambari-web/app/views/common/configs/widgets/checkbox_config_widget_view.js
index 326ad2f..4419605 100644
--- a/ambari-web/app/views/common/configs/widgets/checkbox_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/checkbox_config_widget_view.js
@@ -44,7 +44,12 @@ App.CheckboxConfigWidgetView = App.ConfigWidgetView.extend({
   configView: App.ServiceConfigCheckbox.extend({
     serviceConfigBinding: 'parentView.config',
     // @TODO maybe find use case of this method for widget
-    focusIn: function() {}
+    focusIn: function() {},
+    toggleValue: function() {
+      this._super();
+      
this.get('controller').removeCurrentFromDependentList(this.get('serviceConfig'));
+      this.sendRequestRorDependentConfigs(this.get('serviceConfig'));
+    }.observes('checked')
   }),
 
   /**

Reply via email to