Bug Report Clearly and accurately describe the issue you found. Providing any steps to reproduce the issue can help the development team address it promptly.
[TiDB Version]
Tidb7.1.1
[Impact of the Bug]
The partition-num parameter of Ticdc is ineffective, resulting in the inability to specify the number of partitions for synchronizing data to Kafka.
The number of partitions for the Kafka topic should be consistent with the value of the partition-num parameter. Try setting the number of Kafka partitions to 1 or 2. Otherwise, if the number of partitions for the Kafka topic is 3, TiCDC will synchronize data to all partitions regardless of the partition-num setting.
So what is the significance of this parameter? No matter what value it is set to, it will be synchronized to all partitions. Wouldn’t the effect be the same if this parameter were removed?
Additionally, I tried Tidb4.0.15, and in the case where the Kafka topic has 3 partitions, when Ticdc is set with partition-num=1, it will only synchronize to 1 partition and will not synchronize to 3 partitions.
What needs to be adjusted in Kafka? Is it the number of partitions?
Assuming Kafka has 10 partitions, and I only want to synchronize one of them, then setting partition-num=1 should fulfill this requirement.
In fact, version 4.0.15 did achieve this.
However, in version 7.1.1, this parameter suddenly became ineffective.
From your screenshot, it can be seen that in higher versions, the number of synchronization partitions is mainly based on the number of topic partitions. If the partition-num is less than the number of topic partitions, then this parameter is invalid. In lower versions, it is based on partition-num. You can set the value of the partition-num parameter higher, exceeding the number of topic partitions, and then check the synchronization numbers between different versions.
All errors occurred, indicating that the number of partition-num set is greater than the number of partitions in the Kafka topic. The error message is the same:
[CDC:ErrKafkaNewSaramaProducer][CDC:ErrKafkaInvalidPartitionNum] the number of partitions (5) specified in sink-uri is more than that of the actual topic (3)
From your error message, it looks like the partition-num exceeds the number of topics. It is estimated that this value cannot exceed the number of topics. There might be an issue with this in higher versions of the cluster. You can consult the official personnel for more information.