You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deal with brokers that disappear, reappear with different IP address (dpkp#1085)
When KafkaClient connects to a broker in _maybe_connect,
it inserts into self._conns a BrokerConnection configured
with the current host/port for that node. The BrokerConnection
remains there forever, though, so if the broker's IP or host
ever changes, KafkaClient has no way to deal with this.
The fix is to compare the latest metadata with the current
node's connection, and if the host/IP has changed, decommission
the old connection and allow a new one to be created.
There's also a common race condition on broker startup where
the initial metadata request sometimes returns an empty list
of brokers, but subsequent requests behave normally. So, we
must deal with broker being None here. This change is conservative
in that it doesn't remove the connection from self._conns unless
the new broker metadata contains an entry for that same node
with a new IP/port.
# Conflicts:
# kafka/client_async.py
0 commit comments