Increment DNS cache record count when the records are cleared from the DNS cache, given that both the MySQL servers and ProxySQL servers tables are empty.

pull/4310/head
Rahim Kanji 3 years ago
parent a97fd04a53
commit 8792a64c0a

@ -6631,11 +6631,15 @@ void DNS_Cache::remove(const std::string& hostname) {
}
void DNS_Cache::clear() {
size_t records_removed = 0;
int rc = pthread_rwlock_wrlock(&rwlock_);
assert(rc == 0);
records_removed = records.size();
records.clear();
rc = pthread_rwlock_unlock(&rwlock_);
assert(rc == 0);
if (records_removed)
__sync_fetch_and_add(&GloMyMon->dns_cache_record_updated, records_removed);
proxy_debug(PROXY_DEBUG_MYSQL_CONNECTION, 5, "DNS cache was cleared.\n");
}

Loading…
Cancel
Save