Explorar o código

AMBARI-2940. After restarting YARN, the number of lost nodes is incorrect. (srimanth)

Srimanth Gunturi %!s(int64=11) %!d(string=hai) anos
pai
achega
22ff085f16

+ 1 - 1
ambari-web/app/mappers/service_mapper.js

@@ -101,7 +101,7 @@ App.servicesMapper = App.QuickDataMapper.create({
     apps_killed: 'resourceManagerComponent.host_components[0].metrics.yarn.Queue.root.AppsKilled',
     apps_failed: 'resourceManagerComponent.host_components[0].metrics.yarn.Queue.root.AppsFailed',
     node_managers_count_active: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.activeNMcount',
-    node_managers_count_lost: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.lostNMcount',
+    //node_managers_count_lost: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.lostNMcount',
     node_managers_count_unhealthy: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.unhealthyNMcount',
     node_managers_count_rebooted: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.rebootedNMcount',
     node_managers_count_decommissioned: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.decommissionedNMcount',

+ 15 - 1
ambari-web/app/models/service/yarn.js

@@ -24,7 +24,6 @@ App.YARNService = App.Service.extend({
   nodeManagerNodes: DS.hasMany('App.Host'),
   nodeManagerLiveNodes: DS.hasMany('App.Host'),
   nodeManagersCountActive: DS.attr('number'),
-  nodeManagersCountLost: DS.attr('number'),
   nodeManagersCountUnhealthy: DS.attr('number'),
   nodeManagersCountRebooted: DS.attr('number'),
   nodeManagersCountDecommissioned: DS.attr('number'),
@@ -85,6 +84,21 @@ App.YARNService = App.Service.extend({
     this.set('allQueueNames', allQueueNames);
     this.set('childQueueNames', childQueueNames);
   }.observes('queue'),
+  /**
+   * ResourceManager's lost count is not accurate once RM is rebooted. Since
+   * Ambari knows the total number of nodes and the counts of nodes in other
+   * states, we calculate the lost count.
+   */
+  nodeManagersCountLost: function () {
+    var allNMs = this.get('nodeManagerNodes');
+    var totalCount = allNMs != null ? allNMs.get('length') : 0;
+    var activeCount = this.get('nodeManagersCountActive');
+    var rebootedCount = this.get('nodeManagersCountRebooted');
+    var unhealthyCount = this.get('nodeManagersCountUnhealthy');
+    var decomCount = this.get('nodeManagersCountDecommissioned');
+    var nonLostHostsCount = activeCount + rebootedCount + decomCount + unhealthyCount;
+    return totalCount >= nonLostHostsCount ? totalCount - nonLostHostsCount : 0;
+  }.property('nodeManagerNodes', 'nodeManagersCountActive', 'nodeManagersCountRebooted', 'nodeManagersCountUnhealthy', 'nodeManagersCountDecommissioned'),
 });
 
 App.YARNService.FIXTURES = [];