...
When the request timeout has been reached, we do the following:
- Refresh metadata
- disconnect and create a new TCP connection.
- Refresh metadata
- Retry the request on the new TCP connection.
In most cases, metadata refresh should be able to pick up the new leader if a broker is down. If a broker was not down but just slow, as long as request timeout is set to a reasonable value, we should not see dramatic increase in TCP connections when a broker was not down but just slow.
...