[
https://issues.apache.org/jira/browse/KAFKA-9335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17007853#comment-17007853
]
Boyang Chen commented on KAFKA-9335:
------------------------------------
By applying your example, I could successfully reproduce the symptom. In fact,
this is not upgrade related but a 2.4 specific correctness bug.
The topology of the example used a chaining of 3 sub-topologies, which has a
dependency A -> B -> C all connected by repartition topics.
We gather the repartition topic metadata first, so that we created a mapping as
[A-output-rep, B-output-rep], and they all have no partitions defined yet.
Next, a lookup of C's input partition (= B-output-rep) will be informed that
the lookup fails, so it will try to look for the B's input partition
(=A-output-rep), here
as A-output is also a repartition topic which has no partition initialized
either, the passed-down assignment is invalid as we still use a numPartitions =
0 after the if block.
*To summarize, we need a chaining of 3 sub-topologies where both inputs for
non-source topologies are repartition topics, and the sink topology gets
initialized first.*
The explanation is bit tricky, but thanks so much for the reporting, and we
will propose a fix shortly.
> java.lang.IllegalArgumentException: Number of partitions must be at least 1.
> ----------------------------------------------------------------------------
>
> Key: KAFKA-9335
> URL: https://issues.apache.org/jira/browse/KAFKA-9335
> Project: Kafka
> Issue Type: Bug
> Components: streams
> Affects Versions: 2.4.0
> Reporter: Nitay Kufert
> Priority: Major
> Labels: bug
>
> Hey,
> When trying to upgrade our Kafka streams client to 2.4.0 (from 2.3.1) we
> encountered the following exception:
> {code:java}
> java.lang.IllegalArgumentException: Number of partitions must be at least 1.
> {code}
> It's important to notice that the exact same code works just fine at 2.3.1.
>
> I have created a "toy" example which reproduces this exception:
> [https://gist.github.com/nitayk/50da33b7bcce19ad0a7f8244d309cb8f]
> and I would love to get some insight regarding why its happening / ways to
> get around it
>
> Thanks
--
This message was sent by Atlassian Jira
(v8.3.4#803005)