Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kafka sink: fix data race in kafka sink #565

Merged
merged 1 commit into from
May 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cdc/sink/mqProducer/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ func NewKafkaSaramaProducer(ctx context.Context, address string, topic string, c
return k, nil
}

func init() {
sarama.MaxRequestSize = 1024 * 1024 * 1024 // 1GB
}

// NewSaramaConfig return the default config and set the according version and metrics
func newSaramaConfig(ctx context.Context, c KafkaConfig) (*sarama.Config, error) {
config := sarama.NewConfig()
Expand All @@ -255,7 +259,6 @@ func newSaramaConfig(ctx context.Context, c KafkaConfig) (*sarama.Config, error)

config.ClientID = fmt.Sprintf("TiCDC_sarama_producer_%s_%s_%s", role, captureID, changefeedID)
config.Version = version
sarama.MaxRequestSize = int32(c.MaxMessageBytes)
config.Producer.Flush.MaxMessages = c.MaxMessageBytes
config.Metadata.Retry.Max = 20
config.Metadata.Retry.Backoff = 500 * time.Millisecond
Expand Down