kafka-docker icon indicating copy to clipboard operation
kafka-docker copied to clipboard

Topic creator is too brittle during new cluster construction

Open otterley opened this issue 6 years ago • 3 comments

I'm building an automated test suite for some broker maintenance automation involving multiple brokers. As part of this test suite, I'm building a three-broker Kafka cluster, and desire to create a topic with a replication factor of three.

Since the brokers are started by a container scheduler, they're not necessarily all started at the same time. However, the topic creator script is run in the background immediately after a broker is started. If there aren't yet enough brokers in the cluster, the topic creator will fail hard with:

creating topics: test:1:3
Error while executing topic command : Replication factor: 3 larger than available brokers: 2.

What I'd like to happen is for the topic-creator to wait for the broker count to reach the desired replication factor before attempting to create the topic, or to retry until successful.

otterley avatar Sep 12 '18 16:09 otterley

I'm building an automated test suite for some broker maintenance automation involving multiple brokers.

I would have thought the broker maintenance automation should deal with topic creation / deletion / alteration?

Even so - there is some merit in making this less brittle, but on the other hand, for production use-cases it is likely you would want to manage topics outside of the create topics helper script. There are issues such as not being able to co-ordinate each broker trying to create topics concurrently which creates un-necessary errors.

sscaling avatar Oct 18 '18 07:10 sscaling

Related to (very) old PR https://github.com/wurstmeister/kafka-docker/pull/160

sscaling avatar Oct 20 '18 12:10 sscaling

Just came here to say I ran into this recently in a single broker setup. Is there a suggested path forward to avoid this error where topic creation happens before broker has completely started up?

masoncj avatar Feb 13 '20 01:02 masoncj