Ethanlm commented on a change in pull request #3302:
URL: https://github.com/apache/storm/pull/3302#discussion_r452420749
##########
File path: storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
##########
@@ -3380,16 +3381,21 @@ public void rebalance(String topoName, RebalanceOptions
options)
options.set_principal(null);
// check if executor counts are correctly specified
StormTopology stormTopology = tryReadTopologyFromName(topoName);
- Set<String> comps = new HashSet<>();
+ Set<String> comps = new TreeSet<>();
comps.addAll(stormTopology.get_spouts().keySet());
comps.addAll(stormTopology.get_bolts().keySet());
Map<String, Integer> execOverrides =
options.is_set_num_executors() ? options.get_num_executors() :
Collections.emptyMap();
for (Map.Entry<String, Integer> e: execOverrides.entrySet()) {
String comp = e.getKey();
- Integer value = e.getValue();
- if (!comps.contains(comp)) {
- throw new
WrappedInvalidTopologyException(String.format("Component %s does not exist in
topology %s", comp, topoName));
+ // validate non-system component ids
+ if (!Utils.isSystemId(comp) && !comps.contains(comp)) {
Review comment:
Maybe we can follow the code at
https://github.com/apache/storm/blob/master/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java#L2638-L2639
to get all the components?
Or maybe use stormBase to avoid recomputation.
https://github.com/apache/storm/blob/master/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java#L1808
Not sure if there is any concern with using it without testing. Maybe there
are some corner cases that need to be taken care of.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]