Status

Current state: Accepted

Discussion thread: here (not that there is an old discussion thread here)

JIRA: here

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

Currently with Kafka you cannot have duplicate listeners on the same port. This makes sense when you only have a single IP stack but since we now have both IPv4 and IPv6 there is no reason why you cannot have an IPv4 address and another IPv6 address on the same port.

Note that this change only applies to listeners, advertised listeners already have this feature.

Public Interfaces

"PLAINTEXT://127.0.0.1:9092,PLAINTEXT://[::1]:9092"
"PLAINTEXT://[::1]:9093,PLAINTEXT://127.0.0.1:9093"
"PLAINTEXT://127.0.0.1:9094,PLAINTEXT://[::1]:9094,PLAINTEXT://127.0.0.1:9095,PLAINTEXT://[::1]:9095"
"PLAINTEXT://[::1]:9096,PLAINTEXT://127.0.0.1:9096,PLAINTEXT://[::1]:9097,PLAINTEXT://127.0.0.1:9097"



Are now considered valid which means that Kafka will attempt to start with such configurations rather than short circuiting with an error. Specifically this means if and only if you have 2 listeners on the same port and one is IPv4 and the other is IPv6 then this is considered an accepted listener configuration.

Proposed Changes

In summary the proposed changes involve loosening the validation on listenerListToEndPoints in kafka.utils.CoreUtils.scala so that duplicates ports are allowed if and only if

Apart from adding some extra information that gets thrown when the validation in listenerListToEndPoints  fails there are no changes outside of this specific case.

Examples of listener configurations which will pass the validation proposed in this KIP

"PLAINTEXT://127.0.0.1:9092,PLAINTEXT://[::1]:9092"
"PLAINTEXT://[::1]:9093,PLAINTEXT://127.0.0.1:9093"
"PLAINTEXT://127.0.0.1:9094,PLAINTEXT://[::1]:9094,PLAINTEXT://127.0.0.1:9095,PLAINTEXT://[::1]:9095"
"PLAINTEXT://[::1]:9096,PLAINTEXT://127.0.0.1:9096,PLAINTEXT://[::1]:9097,PLAINTEXT://127.0.0.1:9097"

And here are examples of listener configurations which will fail the validation (i.e. no change in behavior)

"PLAINTEXT://[::1]:9092,PLAINTEXT://[::1]:9092"
"PLAINTEXT://127.0.0.1:9092,PLAINTEXT://127.0.0.1:9092"
"PLAINTEXT://127.0.0.1:9092,PLAINTEXT://127.0.0.1:9092,PLAINTEXT://127.0.0.1:9092"
"PLAINTEXT://127.0.0.1:9092,SSL://127.0.0.1:9092,SASL_PLAINTEXT://127.0.0.1:9092"


Compatibility, Deprecation, and Migration Plan

Rejected Alternatives

As far as I am aware there aren't any rejected alternatives.