mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-23 10:37:43 -04:00
Move ADB TTL-based cleanup into dump_adb()
Instead of doing a full sweep of all names and entries before dumping, expire stale entries lazily as they are encountered during the dump iteration. This aligns with the QPcache approach of avoiding separate TTL-based cleaning passes. dns_adb_flush() retains its explicit full sweep since it needs to force-expire everything.
This commit is contained in:
parent
dc9564f14d
commit
03ff80a1f7
1 changed files with 20 additions and 2 deletions
|
|
@ -2256,8 +2256,6 @@ dns_adb_dump(dns_adb_t *adb, FILE *f) {
|
|||
return;
|
||||
}
|
||||
|
||||
cleanup_names(adb, now);
|
||||
cleanup_entries(adb, now);
|
||||
dump_adb(adb, f, false, now);
|
||||
|
||||
rcu_read_unlock();
|
||||
|
|
@ -2291,7 +2289,19 @@ dump_adb(dns_adb_t *adb, FILE *f, bool debug, isc_stdtime_t now) {
|
|||
*/
|
||||
dns_adbname_t *adbname = NULL;
|
||||
cds_lfht_for_each_entry(adb->names_ht, &iter, adbname, ht_node) {
|
||||
dns_adbname_ref(adbname);
|
||||
LOCK(&adbname->lock);
|
||||
|
||||
/*
|
||||
* Lazily expire stale name hooks and names while dumping.
|
||||
*/
|
||||
maybe_expire_namehooks(adbname, now);
|
||||
if (maybe_expire_name(adbname, now)) {
|
||||
UNLOCK(&adbname->lock);
|
||||
dns_adbname_detach(&adbname);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Dump the names
|
||||
*/
|
||||
|
|
@ -2318,17 +2328,25 @@ dump_adb(dns_adb_t *adb, FILE *f, bool debug, isc_stdtime_t now) {
|
|||
print_find_list(f, adbname);
|
||||
}
|
||||
UNLOCK(&adbname->lock);
|
||||
dns_adbname_detach(&adbname);
|
||||
}
|
||||
|
||||
dns_adbentry_t *adbentry = NULL;
|
||||
|
||||
fprintf(f, ";\n; Unassociated entries\n;\n");
|
||||
cds_lfht_for_each_entry(adb->entries_ht, &iter, adbentry, ht_node) {
|
||||
dns_adbentry_ref(adbentry);
|
||||
LOCK(&adbentry->lock);
|
||||
if (maybe_expire_entry(adbentry, now)) {
|
||||
UNLOCK(&adbentry->lock);
|
||||
dns_adbentry_detach(&adbentry);
|
||||
continue;
|
||||
}
|
||||
if (ISC_LIST_EMPTY(adbentry->nhs)) {
|
||||
dump_entry(f, adb, adbentry, debug, now);
|
||||
}
|
||||
UNLOCK(&adbentry->lock);
|
||||
dns_adbentry_detach(&adbentry);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue