Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client: force a coordinator refresh if the coordinator is unknown
Previously, once we loaded a coordinator successfully, we would cache it. We would delete the cache entry if a response indicated NOT_COORDINATOR. This was fine. One problem with this scheme is that once we know the coordinator, the client still needs to map that number to a broker internally. If a metadata refresh cleared the broker from the client, then our cached coordinator would return errUnknownCoordinator, and then a request would fail in an unretriable way that would also not clear our cache. Now, if our cached coordinator cannot map to a broker, we clear the cache and restart from the top. This ensures a fresh coordinator lookup, which always proceeds to the number => broker mapping. If we fail *again*, then this is a fresh failure and we continue with the old behavior of returning errUnknownCoordinator, which fails the request. However, we now give the request one chance to retry and load a new coordinator, which is more resilient to leadership changes.
- Loading branch information