Merge pull request #4310 from sysown/v2.x_update_dns_records_count

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
v2.6-deprecate_old_clickhouse
René Cannaò 3 years ago committed by GitHub
commit ef17fca532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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