question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enhancement: Support Coercing `replication-factor` when default and Broker defines a policy

See original GitHub issue

Use Case: When using the spring cloud stream binder, I would like to be able to auto-provision topics with minimal boilerplate code. When connecting to a broker that defines a policy for items like replication-factor i would like the binder to coerce the default selection (in this case 1) to the required selection (in this case 3).

Reproduction: When using Confluent Cloud as my Kafka provider, I can connect to the broker successfully by attaching my configuration set to the spring.cloud.stream.kafka.binder.configuration. However, if spring attempts to create a Topic that does not exist the following error will be thrown.

ERROR 19109 --- [           main] o.s.c.s.b.k.p.KafkaTopicProvisioner      : Failed to create topics
org.apache.kafka.common.errors.PolicyViolationException: Topic replication factor must be 3 

Preventing topic creation and ultimately application startup.

Solutions: I see that the Kafka Topic provisioner does have a feature currently that coerces the partition tolerance down if allowed by the configuration properties and notifies the user as such. Can we include a default override for policy violations such as this? For example, knowing that I set the value as 2 means that i would see an error but leaving the default as 1 would allow the system to coerce it to the broker defined policy value of 3.

Thanks for reading, I look forward to input. -Derrick

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
garyrussellcommented, Nov 27, 2019

We might want to keep this open and track for 3.1; it may make sense to change the default to -1.

0reactions
garyrussellcommented, Nov 27, 2019

I’ve tested it with a 2.4 broker and setting the binder property to -1.

spring.cloud.stream.kafka.binder.replication-factor=-1

has the desired effect.

The kafka server.properties needs

default.replication.factor=2

So, we’re all set when the 2.4 broker is available.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Apache Kafka
Kafka® is a distributed, partitioned, replicated commit log service. ... create it with the default replication factor and number of partitions.
Read more >
Post Kafka Deployment | Confluent Documentation
As part of increasing the replication factor, the example adds more replicas on brokers 6 and 7. The first step is to create...
Read more >
Kogito Documentation - Red Hat on GitHub
The core objective of Kogito is to help you mold a set of business processes and decisions into your own domain-specific cloud-native set...
Read more >
Optimizing Kafka broker configuration - Strimzi
In this case, you might want to set the replication factor to at least three replicas so that data is more durable by...
Read more >
Verifying the keyspace replication factor - Pega Documentation
Troubleshoot keyspace-related errors, such as incorrect replication, by checking whether a specific keyspace exists and whether the keyspace belongs to the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found