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

   A subtopology has as many tasks as its source topic with the most 
partitions, so a smaller
   source topic has no partition for the higher task IDs.
   
   `EndpointToPartitionsManager` clamped the reported partitions by comparing 
the topic's
   partition count against the *number* of tasks the member owns, then keeping 
the lowest task
   IDs. That only coincides with the correct answer when a single member owns 
the whole
   subtopology. For a member owning a non-prefix task set the check does not 
fire, and the task
   IDs are reported verbatim as partitions of the smaller topic — advertising 
partitions that do
   not exist.
   
   Example: subtopology reads `A` (5 partitions) and `B` (2 partitions), member 
owns tasks `0_1`
   and `0_3`. For `B` it should report only `B-1`, since task `0_3` has no `B` 
partition. It
   reports `B-1` and `B-3`.
   
   Filter the task IDs by value, and omit a source topic entirely when none of 
the member's tasks
   map to one of its partitions. This mirrors 
`PartitionGrouper#partitionGroups`, which computes
   the same mapping for the classic protocol.
   
   ### Testing
   
   Two unit tests in `EndpointToPartitionsManagerTest`, both failing before the 
fix:
   - a non-prefix task set where the smaller topic keeps some partitions
   - a task set entirely beyond the smaller topic, which is then not reported 
at all
   
   The existing coverage only exercised a single member owning the whole 
subtopology, which is
   the one shape where the old check happened to be right.
   
   Unblocks #23006, which otherwise cannot assert correct output for a 
realistic multi-member
   task distribution.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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