[v9_9] Maintain ZEROTTL cache entries at the tail of the LRU lists

4662.	[performance]	Improve cache memory cleanup of zero TTL records
			by putting them at the tail of LRU header lists.
			[RT #45274]

(cherry picked from commit e924155211)
This commit is contained in:
Evan Hunt
2017-07-28 00:14:08 -07:00
parent 0991321029
commit 681e286ada
2 changed files with 25 additions and 7 deletions
+4
View File
@@ -1,3 +1,7 @@
4662. [performance] Improve cache memory cleanup of zero TTL records
by putting them at the tail of LRU header lists.
[RT #45274]
4661. [bug] A race condition could occur if a zone was reloaded
while resigning, triggering a crash in
rbtdb.c:closeversion(). [RT #45276]
+21 -7
View File
@@ -6453,8 +6453,12 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion,
idx = newheader->node->locknum;
if (IS_CACHE(rbtdb)) {
ISC_LIST_PREPEND(rbtdb->rdatasets[idx],
newheader, link);
if (ZEROTTL(newheader))
ISC_LIST_APPEND(rbtdb->rdatasets[idx],
newheader, link);
else
ISC_LIST_PREPEND(rbtdb->rdatasets[idx],
newheader, link);
INSIST(rbtdb->heaps != NULL);
(void)isc_heap_insert(rbtdb->heaps[idx],
newheader);
@@ -6480,8 +6484,12 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion,
}
idx = newheader->node->locknum;
if (IS_CACHE(rbtdb)) {
ISC_LIST_PREPEND(rbtdb->rdatasets[idx],
newheader, link);
if (ZEROTTL(newheader))
ISC_LIST_APPEND(rbtdb->rdatasets[idx],
newheader, link);
else
ISC_LIST_PREPEND(rbtdb->rdatasets[idx],
newheader, link);
/*
* XXXMLG We don't check the return value
* here. If it fails, we will not do TTL
@@ -6555,8 +6563,12 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion,
}
idx = newheader->node->locknum;
if (IS_CACHE(rbtdb)) {
ISC_LIST_PREPEND(rbtdb->rdatasets[idx],
newheader, link);
if (ZEROTTL(newheader))
ISC_LIST_APPEND(rbtdb->rdatasets[idx],
newheader, link);
else
ISC_LIST_PREPEND(rbtdb->rdatasets[idx],
newheader, link);
isc_heap_insert(rbtdb->heaps[idx], newheader);
} else if (RESIGN(newheader)) {
resign_delete(rbtdb, rbtversion, header);
@@ -9569,7 +9581,9 @@ rdataset_putadditional(dns_acache_t *acache, dns_rdataset_t *rdataset,
static inline isc_boolean_t
need_headerupdate(rdatasetheader_t *header, isc_stdtime_t now) {
if ((header->attributes &
(RDATASET_ATTR_NONEXISTENT|RDATASET_ATTR_STALE)) != 0)
(RDATASET_ATTR_NONEXISTENT |
RDATASET_ATTR_STALE |
RDATASET_ATTR_ZEROTTL)) != 0)
return (ISC_FALSE);
#if DNS_RBTDB_LIMITLRUUPDATE