fix: Decode ComponentId to avoid UI throwing errors #3827
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
After bumping our Storm services from Storm 1 to Storm 2, we faced an issue where some components fail to load through the UI.
500 Server Error
org.apache.storm.thrift.TApplicationException: Internal error processing getComponentPageInfo
Findings:
We verified that the getComponentPageInfo method works correctly for Spouts and Bolts with names that do not contain spaces.
However, it fails for components with names that contain spaces.
Root Cause:
The issue lies on how the parameter componentId is being passed. For example, in the StatsUtils.componentType method:
public static String componentType(StormTopology topology, String compId) {
if (compId == null) {
return null;
}
}
Error Scenario:
When accessing the component page of a Bolt named Test Error, the compId value is "Test+Error".
However, in the bolts map, the component key is stored as "Test Error".
This mismatch prevents the bolts map from finding the component, leading the method to incorrectly return the SPOUT value for a Bolt.
On this PR we're decoding the componentId string so it will match the correct value.
How was the change tested
Compiled the project, copied the jar into my machine and verified that the UI is now loading the components for names with spaces