You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2014/06/26 23:14:14 UTC

git commit: AMBARI-6295. UI freezes for more than 2 seconds, every 15 seconds, on 2K-node cluster. (srimanth)

Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 ef448acba -> d527ec73c


AMBARI-6295. UI freezes for more than 2 seconds, every 15 seconds, on 2K-node cluster. (srimanth)


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

Branch: refs/heads/branch-1.6.1
Commit: d527ec73c57c264a3296f7c6d0ed0b55c01d0040
Parents: ef448ac
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Thu Jun 26 14:08:35 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Thu Jun 26 14:08:35 2014 -0700

----------------------------------------------------------------------
 .../app/mappers/component_config_mapper.js      | 42 +++++++++++++-------
 1 file changed, 27 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d527ec73/ambari-web/app/mappers/component_config_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/component_config_mapper.js b/ambari-web/app/mappers/component_config_mapper.js
index ef880df..79540e2 100644
--- a/ambari-web/app/mappers/component_config_mapper.js
+++ b/ambari-web/app/mappers/component_config_mapper.js
@@ -38,30 +38,42 @@ App.componentConfigMapper = App.QuickDataMapper.create({
     var cacheServices = App.cache['services'];
     var componentsWithStaleConfigs = {};
     var loadedServiceComponentsMap = this.buildServiceComponentMap(cacheServices);
-
+    var mapConfig = this.get('config');
+    // We do not want to parse JSON if there is no need to
+    var hostComponentJsonMap = {};
+    var hostComponentJsonIds = [];
+    var hostComponentJsonsToRemove = {};
     json.items.forEach(function (item) {
       item.host_components.forEach(function (host_component) {
-        var serviceName = host_component.HostRoles.service_name;
         host_component.id = host_component.HostRoles.component_name + '_' + host_component.HostRoles.host_name;
-        hostComponents.push(this.parseIt(host_component, this.get('config')));
-
-        componentsWithStaleConfigs[host_component.id] = true;
-
+        hostComponentJsonIds.push(host_component.id);
+        hostComponentJsonMap[host_component.id] = host_component;
+      });
+    });
+    this.get('model').find().forEach(function (hostComponent) {
+      var hostComponentJson = hostComponentJsonMap[hostComponent.get('id')];
+      if (!hostComponentJson && !hostComponent.get('isMaster')) {
+        hostComponent.set('staleConfigs', false);
+      }
+      if (hostComponentJson!=null && hostComponent.get('staleConfigs') &&
+          hostComponentJson.HostRoles.state == hostComponent.get('workStatus') &&
+          hostComponentJson.HostRoles.maintenance_state == hostComponent.get('passiveState')) {
+        // A component already exists with correct stale_configs flag and other values - no need to load again
+        hostComponentJsonsToRemove[hostComponentJson.id] = hostComponentJson;
+      }
+    });
+    hostComponentJsonIds.forEach(function (hcId) {
+      if(!hostComponentJsonsToRemove[hcId]){
+        var host_component = hostComponentJsonMap[hcId];
+        var serviceName = host_component.HostRoles.service_name;
+        hostComponents.push(this.parseIt(host_component, mapConfig));
         if (!serviceToHostComponentIdMap[serviceName]) {
           serviceToHostComponentIdMap[serviceName] = [];
         }
         serviceToHostComponentIdMap[serviceName].push(host_component.id);
-      }, this);
-    }, this);
-
-    //reset(only for slave and client components) staleConfigs property to false before load to model
-    this.get('model').find().forEach(function (hostComponent) {
-      if (!componentsWithStaleConfigs[hostComponent.get('id')] && !hostComponent.get('isMaster')) {
-        hostComponent.set('staleConfigs', false);
       }
-    });
+    }, this);
     App.store.loadMany(this.get('model'), hostComponents);
-
     this.addNewHostComponents(loadedServiceComponentsMap, serviceToHostComponentIdMap, cacheServices);
     console.timeEnd('App.componentConfigMapper execution time');
   },