This is an automated email from the ASF dual-hosted git repository.

alexantonenko pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 4be4c8a  AMBARI-25374. Use host names instead ip addresses while 
checking hive interactive service status
     new b730f30  Merge pull request #3082 from hiveww/AMBARI-25374-branch-2.7
4be4c8a is described below

commit 4be4c8a252cab40ce6e037021bcc3da493becdaf
Author: Alex Antonenko <aantone...@hortonworks.com>
AuthorDate: Fri Sep 6 18:07:42 2019 +0300

    AMBARI-25374. Use host names instead ip addresses while checking hive 
interactive service status
---
 .../HIVE/configuration/hive-interactive-site.xml         |  6 ++++++
 ambari-web/app/mappers/service_metrics_mapper.js         | 16 ++++++++++------
 ambari-web/app/utils/ajax/ajax.js                        |  2 +-
 ambari-web/test/mappers/service_metrics_mapper_test.js   |  2 +-
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-interactive-site.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-interactive-site.xml
index 52d5db4..c98eedc 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-interactive-site.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-interactive-site.xml
@@ -257,6 +257,12 @@ limitations under the License.
     <on-ambari-upgrade add="true"/>
   </property>
   <property>
+    <name>hive.server2.leadertest.use.ip</name>
+    <value>true</value>
+    <description>Use ip address to check hive interactive service 
status</description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
     <name>hive.server2.zookeeper.namespace</name>
     <value>hiveserver2-hive2</value>
     <description>The parent node in ZooKeeper used by HiveServer2 when 
supporting dynamic service discovery.</description>
diff --git a/ambari-web/app/mappers/service_metrics_mapper.js 
b/ambari-web/app/mappers/service_metrics_mapper.js
index 0d23ce2..e2ddbfc 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -316,16 +316,19 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
     var self = this;
     
App.router.get('configurationController').getCurrentConfigsBySites(['hive-site',
 'hive-interactive-site']).done(function (configs) {
       var hiveWebUiPort = configs.findProperty('type', 
'hive-interactive-site').properties['hive.server2.webui.port'];
+      var hiveWebUiProtoFlag = configs.findProperty('type', 
'hive-interactive-site').properties['hive.server2.webui.use.ssl'];
+      var hiveWebUiProto = hiveWebUiProtoFlag ? 'https' : 'http';
       var hostNames = hiveInteractiveServers.mapProperty('host_name');
+      var useIps = configs.findProperty('type', 
'hive-interactive-site').properties['hive.server2.leadertest.use.ip'];
       var notDefinedHostIp = hostNames.find(function (hostName) {
         return !self.get('hostNameIpMap')[hostName];
       });
-      if (notDefinedHostIp) {
+      if (useIps && notDefinedHostIp) {
         self.getHostNameIpMap(hostNames).done(function () {
-          self.getHiveServersInteractiveStatus(hiveInteractiveServers, 
hiveWebUiPort);
+          self.getHiveServersInteractiveStatus(hiveInteractiveServers, 
hiveWebUiPort, hiveWebUiProto, useIps);
         });
       } else {
-        self.getHiveServersInteractiveStatus(hiveInteractiveServers, 
hiveWebUiPort);
+        self.getHiveServersInteractiveStatus(hiveInteractiveServers, 
hiveWebUiPort, hiveWebUiProto, useIps);
       }
     });
   },
@@ -347,14 +350,15 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
     });
   },
 
-  getHiveServersInteractiveStatus: function(hiveInteractiveServers, 
hiveWebUiPort) {
+  getHiveServersInteractiveStatus: function(hiveInteractiveServers, 
hiveWebUiPort, hiveWebUiProto, useIps) {
     var self = this;
     hiveInteractiveServers.forEach(function (hiveInteractiveServer) {
       App.ajax.send({
         name: 'hiveServerInteractive.getStatus',
         data: {
-          hsiHost: self.hostNameIpMap[hiveInteractiveServer.host_name],
-          port: hiveWebUiPort
+          hsiHost: useIps ? 
self.hostNameIpMap[hiveInteractiveServer.host_name] : 
hiveInteractiveServer.host_name,
+          port: hiveWebUiPort,
+          proto: hiveWebUiProto
         },
         sender: self
       }).success(function (isActive) {
diff --git a/ambari-web/app/utils/ajax/ajax.js 
b/ambari-web/app/utils/ajax/ajax.js
index 2401c08..1a899e6 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -3220,7 +3220,7 @@ var urls = {
     mock: '',
     format: function (data) {
       return {
-        url: 'http://' + data.hsiHost + ':' + data.port + '/leader'
+        url: data.proto + '://' + data.hsiHost + ':' + data.port + '/leader'
       }
     }
   }
diff --git a/ambari-web/test/mappers/service_metrics_mapper_test.js 
b/ambari-web/test/mappers/service_metrics_mapper_test.js
index 20af575..823db86 100644
--- a/ambari-web/test/mappers/service_metrics_mapper_test.js
+++ b/ambari-web/test/mappers/service_metrics_mapper_test.js
@@ -273,7 +273,7 @@ describe('App.serviceMetricsMapper', function () {
       sinon.stub(configurationController, 'getCurrentConfigsBySites', function 
() {
         return {done: function (callback) {
           return callback([
-            {type: 'hive-interactive-site', properties: 
{'hive.server2.webui.port': '1'}}
+            {type: 'hive-interactive-site', properties: 
{'hive.server2.webui.port': '1', 'hive.server2.leadertest.use.ip': true}},
           ]);
         }};
       });

Reply via email to