dajac opened a new pull request, #24300:
URL: https://github.com/apache/kafka/pull/24300

   The Javadoc of `BalanceExtraPartitions` misstated or left out a few
   points: what the receiver tie-break counts, the list order that the
   topic tie-break relies on, the end of the step with several
   subscriptions, and what `countsFit` compares. Most of its tests started
   from quotas that the first two steps never produce, and several
   mutations of the step that break the balance passed them.
   
   This patch fixes the Javadoc, removes a condition that is never true,
   and checks the step against a direct implementation of its rule.
   
   Changes:
   - Document what the receiver tie-break counts, the order of the lists
     of free and owned extra partitions, the end of the step once every
     member with an extra partition is parked, what the resume positions
     are for, and that the counts per cohort take two entries per member
     and cohort.
   - Start the heap of the givers with room for twice its members, like
     the heaps of the receivers.
   - Drop the check for a giver without extra partitions in the main loop,
     since an entry that is not stale implies one.
   - Replace `canTakeOne` with `findLastTopicIndex`, and move the
     computation of the counts per cohort into `computeCountsIfAbsent`.
   - Compare both ways of counting with a direct implementation of the
     rule on random groups, half of them with quotas from the first two
     steps.
   - Run both ways of counting in every test, give the tests current
     assignments from which the first two steps produce their quotas where
     possible, and add tests for a receiver found in another cohort, an
     extra partition owned at exactly the minimum quota, and the
     receiver-owns preference among owned extra partitions.
   - Add `QuotasFixture.copy`.
   
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to