From: Ondřej Surý Date: Mon, 30 Mar 2026 09:54:34 +0000 (+0200) Subject: Remove the dead dns_expire_ttl code path and deletettl stats counter X-Git-Tag: v9.21.21~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e40f6508cf8c04d62b64441b663dbaf81f2a749;p=thirdparty%2Fbind9.git Remove the dead dns_expire_ttl code path and deletettl stats counter Now that TTL-based cleaning has been removed, the dns_expire_ttl enum value, its switch case in expireheader(), and the deletettl stats counter (text, XML, JSON) are all dead code. Remove them so the stats channel no longer reports a permanently-zero counter. --- diff --git a/lib/dns/cache.c b/lib/dns/cache.c index 04e7133f46d..f0bc00ab85a 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -562,9 +562,6 @@ dns_cache_dumpstats(dns_cache_t *cache, FILE *fp) { fprintf(fp, "%20" PRIu64 " %s\n", values[dns_cachestatscounter_deletelru], "cache records deleted due to memory exhaustion"); - fprintf(fp, "%20" PRIu64 " %s\n", - values[dns_cachestatscounter_deletettl], - "cache records deleted due to TTL expiration"); fprintf(fp, "%20" PRIu64 " %s\n", values[dns_cachestatscounter_coveringnsec], "covering nsec returned"); @@ -617,8 +614,6 @@ dns_cache_renderxml(dns_cache_t *cache, void *writer0) { values[dns_cachestatscounter_querymisses], writer)); TRY0(renderstat("DeleteLRU", values[dns_cachestatscounter_deletelru], writer)); - TRY0(renderstat("DeleteTTL", values[dns_cachestatscounter_deletettl], - writer)); TRY0(renderstat("CoveringNSEC", values[dns_cachestatscounter_coveringnsec], writer)); @@ -672,10 +667,6 @@ dns_cache_renderjson(dns_cache_t *cache, void *cstats0) { CHECKMEM(obj); json_object_object_add(cstats, "DeleteLRU", obj); - obj = json_object_new_int64(values[dns_cachestatscounter_deletettl]); - CHECKMEM(obj); - json_object_object_add(cstats, "DeleteTTL", obj); - obj = json_object_new_int64(values[dns_cachestatscounter_coveringnsec]); CHECKMEM(obj); json_object_object_add(cstats, "CoveringNSEC", obj); diff --git a/lib/dns/include/dns/stats.h b/lib/dns/include/dns/stats.h index ed0e9878984..cc4b5532f9f 100644 --- a/lib/dns/include/dns/stats.h +++ b/lib/dns/include/dns/stats.h @@ -120,10 +120,9 @@ enum { dns_cachestatscounter_queryhits = 3, dns_cachestatscounter_querymisses = 4, dns_cachestatscounter_deletelru = 5, - dns_cachestatscounter_deletettl = 6, - dns_cachestatscounter_coveringnsec = 7, + dns_cachestatscounter_coveringnsec = 6, - dns_cachestatscounter_max = 8, + dns_cachestatscounter_max = 7, /*% * Query statistics counters (obsolete). diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index ea65a16bf95..18816cc21da 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -249,8 +249,7 @@ typedef enum { typedef enum { dns_expire_lru = 0, - dns_expire_ttl = 1, - dns_expire_flush = 2, + dns_expire_flush = 1, } dns_expire_t; /* diff --git a/lib/dns/qpcache.c b/lib/dns/qpcache.c index 7c85dc3f647..690cf753941 100644 --- a/lib/dns/qpcache.c +++ b/lib/dns/qpcache.c @@ -920,10 +920,6 @@ expireheader(dns_slabheader_t *header, isc_rwlocktype_t *nlocktypep, } switch (reason) { - case dns_expire_ttl: - isc_stats_increment(qpdb->cachestats, - dns_cachestatscounter_deletettl); - break; case dns_expire_lru: isc_stats_increment(qpdb->cachestats, dns_cachestatscounter_deletelru);