Summary:
We have DNS cache controlled by gflag dns_cache_expiration_ms (60000 by default).
When new RPC call to node with hostname is started and existing record has expired, we start new DNS resolution.
And RPC call waits until this DNS resolution completes.
But, actually, we don't have to wait until it completes.
The address from previous resolution could be used for this RPC call, while cache update could happen in background.
Once response to a new DNS request is received, we could update cached entry and use new address for all new RPC calls.
This diff implements such behaviour.
Also added flag dns_cache_failure_expiration_ms (2s by default) to control the time before DNS resolution retry in case of failure.
Added metric dns_resolve_latency that reflects time spend by DNS resolution.
Jira: DB-11847, DB-11222
Original commit: bf0fb4bae839eb15568b78693ab4a811aa0a52e7/D35993
Test Plan: Jenkins
Reviewers: qhu, rthallam, slingam
Reviewed By: qhu
Subscribers: ybase, slingam
Tags: #jenkins-ready
Differential Revision: https://phorge.dev.yugabyte.com/D36403