Github user shinrich commented on the issue:
https://github.com/apache/trafficserver/pull/1088
The problem appears to be in _bubble_down. In the test, I had 4 items, w,
x, y, z with weights 10, 20, 30, 40 respectively. I pushed in reverse order,
but the overall order afterwards was correct.
I deleted item X (entry index 1). In the original code, this swaps Z (with
index 3) into slot 1. Then we call bubble_up, which doesn't do anything
because Z's weight is greater than entry 0. Then it calls bubble_down with
index 1. It computes left as 2*index + 1 or 3 in this case. This is greater
than or equal to the current length of 3, so it gives up. It leaves the vector
with with W(10), Z(40), and Y(30). If the vector were longer, the bubble_down
logic would work, but with the short vector it gives up too soon. @masaori335
any ideas?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---