From c7365ba96cd4953832208eb6604910643a2bb0ee Mon Sep 17 00:00:00 2001 From: Ling Jin Date: Sun, 7 Nov 2021 02:35:07 +0800 Subject: [PATCH] fix parameters. --- cdc/sink/producer/kafka/kafka.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cdc/sink/producer/kafka/kafka.go b/cdc/sink/producer/kafka/kafka.go index ccf55cab2ff..8d687c9b6bb 100644 --- a/cdc/sink/producer/kafka/kafka.go +++ b/cdc/sink/producer/kafka/kafka.go @@ -459,7 +459,11 @@ func topicPreProcess(config *Config, saramaConfig *sarama.Config) error { return nil } - // topic should have already created by the user, `realPartitionCount` won't be 0. + // if `auto-create-topic` is disabled by user, we would assume topic should have already created + if !ok { + return cerror.ErrKafkaInvalidConfig.GenWithStack("auto-create-topic is false, and topic not found") + } + if config.PartitionNum == 0 { config.PartitionNum = realPartitionCount return nil