diff --git a/lib/dns/cache.c b/lib/dns/cache.c index 82030594b2..b63996ed18 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -1167,6 +1167,7 @@ dns_cache_flush(dns_cache_t *cache) { } dns_db_detach(&cache->db); cache->db = db; + dns_db_setcachestats(cache->db, cache->stats); UNLOCK(&cache->cleaner.lock); UNLOCK(&cache->lock); diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 3d85e995f2..4241df7d80 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -706,6 +706,7 @@ free_rbtdb_callback(isc_task_t *task, isc_event_t *event) { static void update_cachestats(dns_rbtdb_t *rbtdb, isc_result_t result) { INSIST(IS_CACHE(rbtdb)); + INSIST(rbtdb->cachestats != NULL); switch (result) { case ISC_R_SUCCESS: @@ -7633,7 +7634,6 @@ dns_rbtdb_create } rbtdb->cachestats = NULL; - rbtdb->rrsetstats = NULL; if (IS_CACHE(rbtdb)) { result = dns_rdatasetstats_create(mctx, &rbtdb->rrsetstats);