diff --git a/src/Common/DNSResolver.cpp b/src/Common/DNSResolver.cpp index 66f67caf456..1a3eaf91f68 100644 --- a/src/Common/DNSResolver.cpp +++ b/src/Common/DNSResolver.cpp @@ -123,7 +123,10 @@ static DNSResolver::IPAddresses resolveIPAddressImpl(const std::string & host) } if (addresses.empty()) + { + ProfileEvents::increment(ProfileEvents::DNSError); throw Exception("Not found address of host: " + host, ErrorCodes::DNS_ERROR); + } return addresses; } @@ -142,8 +145,8 @@ static String reverseResolveImpl(const Poco::Net::IPAddress & address) struct DNSResolver::Impl { - using HostWithConsecutiveFailures = std::unordered_map; - using AddressWithConsecutiveFailures = std::unordered_map; + using HostWithConsecutiveFailures = std::unordered_map; + using AddressWithConsecutiveFailures = std::unordered_map; CachedFn<&resolveIPAddressImpl> cache_host; CachedFn<&reverseResolveImpl> cache_address; @@ -275,7 +278,6 @@ bool DNSResolver::updateCacheImpl( tryLogCurrentException(log, __PRETTY_FUNCTION__); continue; } - ProfileEvents::increment(ProfileEvents::DNSError); if (!lost_elems.empty()) lost_elems += ", "; lost_elems += cacheElemToString(it->first);