diff options
author | Mike Fischer <mike@originstech.com> | 2017-04-24 13:24:15 +0800 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2017-06-18 23:17:31 -0700 |
commit | 2a41fa1fe4cee892604786f460e916dc0d96378f (patch) | |
tree | bc37ae275b6506ec412fe22abcec34c2bd3a115f /kafka/protocol/commit.py | |
parent | 26a810220acbca57200a805132c5f32108a7fc9c (diff) | |
download | kafka-python-2a41fa1fe4cee892604786f460e916dc0d96378f.tar.gz |
Deal with brokers that disappear, reappear with different IP address (#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.
Diffstat (limited to 'kafka/protocol/commit.py')
0 files changed, 0 insertions, 0 deletions