]> err.no Git - varnish/commitdiff
Log objects banned to shmlog
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 29 Jun 2006 19:19:18 +0000 (19:19 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 29 Jun 2006 19:19:18 +0000 (19:19 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@270 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_expire.c
varnish-cache/bin/varnishd/cache_hash.c
varnish-cache/include/shmlog_tags.h

index 3018ef077f843d0e21bf30ed3548bb82e014c89d..e74ee821030b68d927721444115f677618c9cb80 100644 (file)
@@ -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);
index 2334c2b63389ce0b63c9ad0aeb6faaeec1fb3c9f..522addcda7389f132073541931fa7de5b15ed688 100644 (file)
@@ -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;
index 1ad722447659e964f1ea42891f9e9dd8b4618db9..fd5a0015819a83d1736c26ed394c079acd14dcfa 100644 (file)
@@ -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--;
index 3a5ef0fe58d100c7257ea37564b94dfeb68204c6..307e7101ab89827f068c792133f6ed517e63b0d3 100644 (file)
@@ -31,5 +31,6 @@ SLTM(VCL_call)
 SLTM(VCL_trace)
 SLTM(VCL_return)
 SLTM(XID)
+SLTM(ExpBan)
 SLTM(ExpPick)
 SLTM(ExpKill)