You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by go...@apache.org on 2019/05/22 18:38:04 UTC

[storm] 04/05: STORM-3394 Fix placeholder system bolt filtering for Topology page

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

govind pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git

commit 2bbc8262ccd4119f4c98886d3aaab9431b5d585c
Author: dandsager <da...@verizonmedia.com>
AuthorDate: Fri May 17 13:16:21 2019 -0500

    STORM-3394 Fix placeholder system bolt filtering for Topology page
    
    Add () to clarify intent
    
    replaced __system with Constants.SYSTEM_COMPONENT_ID
---
 .../main/java/org/apache/storm/daemon/nimbus/Nimbus.java  | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java b/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
index a65d63b..0f662de 100644
--- a/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
+++ b/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
@@ -4081,7 +4081,7 @@ public class Nimbus implements Iface, Shutdownable, DaemonCommon {
                 setResourcesDefaultIfNotSet(boltResources, entry.getKey(), topoConf);
                 commonStats.set_resources_map(boltResources.get(entry.getKey()).toNormalizedMap());
             }
-            maybeAddPlaceholderBoltAggStats(topoPageInfo, topology);
+            maybeAddPlaceholderBoltAggStats(topoPageInfo, topology, includeSys);
 
             if (workerSummaries != null) {
                 topoPageInfo.set_workers(workerSummaries);
@@ -4145,7 +4145,7 @@ public class Nimbus implements Iface, Shutdownable, DaemonCommon {
     private void maybeAddPlaceholderSpoutAggStats(TopologyPageInfo topoPageInfo, StormTopology topology) {
         if (topoPageInfo.get_id_to_spout_agg_stats().isEmpty()) {
             Map<String, SpoutSpec> spouts = topology.get_spouts();
-            for (Entry<String, SpoutSpec> entry : spouts.entrySet()) {
+            for (String spoutName : spouts.keySet()) {
                 // component
                 ComponentAggregateStats placeholderComponentStats = new ComponentAggregateStats();
                 placeholderComponentStats.set_type(ComponentType.SPOUT);
@@ -4166,7 +4166,7 @@ public class Nimbus implements Iface, Shutdownable, DaemonCommon {
                 specificStats.set_spout(spoutAggStats);
                 placeholderComponentStats.set_specific_stats(specificStats);
 
-                topoPageInfo.get_id_to_spout_agg_stats().put(entry.getKey(), placeholderComponentStats);
+                topoPageInfo.get_id_to_spout_agg_stats().put(spoutName, placeholderComponentStats);
             }
         }
     }
@@ -4176,12 +4176,13 @@ public class Nimbus implements Iface, Shutdownable, DaemonCommon {
      *
      * @param topoPageInfo  topology page info holding bolt AggStats
      * @param topology      storm topology used to get bolt names
+     * @param includeSys    whether to show system bolts
      */
-    private void maybeAddPlaceholderBoltAggStats(TopologyPageInfo topoPageInfo, StormTopology topology) {
+    private void maybeAddPlaceholderBoltAggStats(TopologyPageInfo topoPageInfo, StormTopology topology, boolean includeSys) {
         if (topoPageInfo.get_id_to_bolt_agg_stats().isEmpty()) {
             Map<String, Bolt> bolts = topology.get_bolts();
-            for (Entry<String, Bolt> entry : bolts.entrySet()) {
-                if (Utils.isSystemId(entry.getKey())) {
+            for (String boltName : bolts.keySet()) {
+                if ((!includeSys && Utils.isSystemId(boltName)) || boltName.equals(Constants.SYSTEM_COMPONENT_ID)) {
                     continue;
                 }
 
@@ -4208,7 +4209,7 @@ public class Nimbus implements Iface, Shutdownable, DaemonCommon {
                 specificStats.set_bolt(boltAggStats);
                 placeholderComponentStats.set_specific_stats(specificStats);
 
-                topoPageInfo.get_id_to_bolt_agg_stats().put(entry.getKey(), placeholderComponentStats);
+                topoPageInfo.get_id_to_bolt_agg_stats().put(boltName, placeholderComponentStats);
             }
         }
     }