]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove the dead dns_expire_ttl code path and deletettl stats counter
authorOndřej Surý <ondrej@isc.org>
Mon, 30 Mar 2026 09:54:34 +0000 (11:54 +0200)
committerOndřej Surý <ondrej@isc.org>
Mon, 30 Mar 2026 19:46:44 +0000 (21:46 +0200)
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.

lib/dns/cache.c
lib/dns/include/dns/stats.h
lib/dns/include/dns/types.h
lib/dns/qpcache.c

index 04e7133f46d4447a8e47d1247379f93f0eaace83..f0bc00ab85ad13562929b69bc576458ffbd33bb4 100644 (file)
@@ -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);
index ed0e9878984eca352abcbe83584fd73145209dd8..cc4b5532f9f746d2979f295dfe85b4ff6b6cc610 100644 (file)
@@ -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).
index ea65a16bf9527c2427790af5a4a59be12260efd0..18816cc21da5aa36995cf3c163c855ccf784a6f6 100644 (file)
@@ -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;
 
 /*
index 7c85dc3f647491dfbb12583255f7880ef9aec021..690cf753941dbad7bb4f778552f35eb9625bdedb 100644 (file)
@@ -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);