2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

incremental cleaning should actually clean.

end_cleaning wants busy not idle
This commit is contained in:
Mark Andrews
2001-06-27 14:48:21 +00:00
parent c86b6051b6
commit ba94ff2e56

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: cache.c,v 1.41 2001/06/07 18:31:54 gson Exp $ */ /* $Id: cache.c,v 1.42 2001/06/27 14:48:21 marka Exp $ */
#include <config.h> #include <config.h>
@@ -43,7 +43,7 @@
* CLEANERINTERVAL is the minimum amount of time between passes. * CLEANERINTERVAL is the minimum amount of time between passes.
*/ */
#define DNS_CACHE_MINSIZE 2097152 /* Bytes. 2097152 = 2 MB */ #define DNS_CACHE_MINSIZE 2097152 /* Bytes. 2097152 = 2 MB */
#define DNS_CACHE_CLEANERINCREMENT 100 /* Number of nodes. */ #define DNS_CACHE_CLEANERINCREMENT 1000 /* Number of nodes. */
#define DNS_CACHE_CLEANERINTERVAL 6 /* Seconds. */ #define DNS_CACHE_CLEANERINTERVAL 6 /* Seconds. */
/*** /***
@@ -681,6 +681,7 @@ incremental_cleaning_action(isc_task_t *task, isc_event_t *event) {
isc_interval_t interval; isc_interval_t interval;
isc_result_t result; isc_result_t result;
int n_names; int n_names;
isc_stdtime_t now;
UNUSED(task); UNUSED(task);
@@ -689,6 +690,7 @@ incremental_cleaning_action(isc_task_t *task, isc_event_t *event) {
event->ev_type == ISC_TIMEREVENT_TICK); event->ev_type == ISC_TIMEREVENT_TICK);
if (cleaner->state == cleaner_s_done) { if (cleaner->state == cleaner_s_done) {
cleaner->state = cleaner_s_busy;
end_cleaning(cleaner, event); end_cleaning(cleaner, event);
return; return;
} }
@@ -699,6 +701,8 @@ incremental_cleaning_action(isc_task_t *task, isc_event_t *event) {
REQUIRE(DNS_DBITERATOR_VALID(cleaner->iterator)); REQUIRE(DNS_DBITERATOR_VALID(cleaner->iterator));
isc_stdtime_get(&now);
while (n_names-- > 0) { while (n_names-- > 0) {
dns_dbnode_t *node = NULL; dns_dbnode_t *node = NULL;
@@ -713,6 +717,18 @@ incremental_cleaning_action(isc_task_t *task, isc_event_t *event) {
return; return;
} }
result = dns_db_expirenode(cleaner->cache->db, node, now);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"cache cleaner: "
"incremental_cleaning_action() "
"failed: %s",
dns_result_totext(result));
/*
* Continue anyway.
*/
}
/* /*
* The node was not needed, but was required by * The node was not needed, but was required by
* dns_dbiterator_current(). Give up its reference. * dns_dbiterator_current(). Give up its reference.