From: phk Date: Thu, 29 Jun 2006 19:19:18 +0000 (+0000) Subject: Log objects banned to shmlog X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e05bd34f5890599a460f56d60f6294d72c29018a;p=varnish Log objects banned to shmlog git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@270 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 3018ef07..e74ee821 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -162,6 +162,7 @@ int BAN_CheckObject(struct object *o, const char *url); /* cache_expiry.c */ void EXP_Insert(struct object *o); void EXP_Init(void); +void EXP_TTLchange(struct object *o); /* cache_fetch.c */ int FetchSession(struct worker *w, struct sess *sp); diff --git a/varnish-cache/bin/varnishd/cache_expire.c b/varnish-cache/bin/varnishd/cache_expire.c index 2334c2b6..522addcd 100644 --- a/varnish-cache/bin/varnishd/cache_expire.c +++ b/varnish-cache/bin/varnishd/cache_expire.c @@ -31,6 +31,15 @@ EXP_Insert(struct object *o) AZ(pthread_mutex_unlock(&exp_mtx)); } +void +EXP_TTLchange(struct object *o) +{ + AZ(pthread_mutex_lock(&exp_mtx)); + binheap_delete(exp_heap, o->heap_idx); + binheap_insert(exp_heap, o); + AZ(pthread_mutex_unlock(&exp_mtx)); +} + /*-------------------------------------------------------------------- * This thread monitors deathrow and kills objects when they time out. */ @@ -77,7 +86,7 @@ exp_prefetch(void *arg) time(&t); AZ(pthread_mutex_lock(&exp_mtx)); o = binheap_root(exp_heap); - if (o == NULL || o->ttl - t > expearly) { + if (o == NULL || o->ttl > t + expearly) { AZ(pthread_mutex_unlock(&exp_mtx)); sleep(1); continue; diff --git a/varnish-cache/bin/varnishd/cache_hash.c b/varnish-cache/bin/varnishd/cache_hash.c index 1ad72244..fd5a0015 100644 --- a/varnish-cache/bin/varnishd/cache_hash.c +++ b/varnish-cache/bin/varnishd/cache_hash.c @@ -51,10 +51,11 @@ HSH_Lookup(struct worker *w, struct http *h) AZ(pthread_cond_wait(&o->cv, &oh->mtx)); /* XXX: check TTL */ if (o->ttl == 0) { - VSL(SLT_Debug, 0, "Object %p had 0 ttl", o); + /* Object banned but not reaped yet */ } else if (BAN_CheckObject(o, b)) { o->ttl = 0; - VSL(SLT_Debug, 0, "Object %p was banned", o); + VSL(SLT_ExpBan, 0, "%u was banned", o->xid); + EXP_TTLchange(o); } else break; o->refcnt--; diff --git a/varnish-cache/include/shmlog_tags.h b/varnish-cache/include/shmlog_tags.h index 3a5ef0fe..307e7101 100644 --- a/varnish-cache/include/shmlog_tags.h +++ b/varnish-cache/include/shmlog_tags.h @@ -31,5 +31,6 @@ SLTM(VCL_call) SLTM(VCL_trace) SLTM(VCL_return) SLTM(XID) +SLTM(ExpBan) SLTM(ExpPick) SLTM(ExpKill)