Skip to content

AIOKafkaAdminClient.create_topics fails randomly because it selects a node at random #939

@y4n9squared

Description

@y4n9squared

Describe the bug

The create_topics API call must be sent to the controller broker but instead it is sent to a random broker:

https://github.com/aio-libs/aiokafka/blob/master/aiokafka/admin/client.py#L225

Thus the request only succeeds with 1/N chance where N is the number of brokers in the cluster. On failures, returns

CreateTopicsResponse_v3(throttle_time_ms=0, topic_errors=[(topic='my_topic', error_code=41, error_message=None)])

where error code 41 is

error = [41] Not Controller: this is not the correct controller for this cluster

Expected behaviour

The self._client.send() call should be directed to the controller broker.

Reproducible example

Perform any create_topics request on a deployment with more than 1 broker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions