Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/2485#discussion_r159972982
--- Diff:
storm-server/src/main/java/org/apache/storm/scheduler/resource/NormalizedResources.java
---
@@ -184,30 +191,25 @@ public void remove(NormalizedResources other) {
int otherLength = other.otherResources.length;
int length = otherResources.length;
if (otherLength > length) {
- double [] newResources = new double[otherLength];
+ double[] newResources = new double[otherLength];
System.arraycopy(newResources, 0, otherResources, 0, length);
otherResources = newResources;
}
- for (int i = 0; i < Math.min(length, otherLength); i++) {
+ for (int i = 0; i < otherLength; i++) {
--- End diff --
With where remove is used it should never go negative, so I would be fine
with blowing up for all negative values so long as we call it out in the
javadocs, and treat something that is not there as a 0. I agree there is a lot
about the code that is not ideal.
---