Aiven-Open / karapace

Karapace - Your Apache Kafka® essentials in one tool
https://karapace.io
Apache License 2.0
450 stars 68 forks source link

karapace: avoid starting until topic its successfully created #904

Open eliax1996 opened 2 months ago

eliax1996 commented 2 months ago

Since the underlying create_topics function unless the operation_timeout its async (the effects of this call aren't immediately visible after the call its performed), if karapace its started on a cluster that its slow enough in creating the topic, we get an unhandled exception in the startup of the service of type:

aiokafka.errors.UnknownTopicOrPartitionError: [Error 3] UnknownTopicOrPartitionError

The fix its simple, try to query from the cluster (immediately after having commanded the creation of the topic) the offsets of the topic. If the returned status its OFFSET_UNINITIALIZED we simply need to try again shortly later.

About this change - What it does

References: #xxxxx

Why this way