r270 - in trunk/varnish-cache: bin/varnishd include

phk at projects.linpro.no phk at projects.linpro.no
Thu Jun 29 21:19:18 CEST 2006


Author: phk
Date: 2006-06-29 21:19:18 +0200 (Thu, 29 Jun 2006)
New Revision: 270

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_expire.c
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/include/shmlog_tags.h
Log:
Log objects banned to shmlog


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2006-06-29 19:06:44 UTC (rev 269)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2006-06-29 19:19:18 UTC (rev 270)
@@ -162,6 +162,7 @@
 /* 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);

Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c	2006-06-29 19:06:44 UTC (rev 269)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c	2006-06-29 19:19:18 UTC (rev 270)
@@ -31,6 +31,15 @@
 	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 @@
 		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;

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2006-06-29 19:06:44 UTC (rev 269)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2006-06-29 19:19:18 UTC (rev 270)
@@ -51,10 +51,11 @@
 			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--;

Modified: trunk/varnish-cache/include/shmlog_tags.h
===================================================================
--- trunk/varnish-cache/include/shmlog_tags.h	2006-06-29 19:06:44 UTC (rev 269)
+++ trunk/varnish-cache/include/shmlog_tags.h	2006-06-29 19:19:18 UTC (rev 270)
@@ -31,5 +31,6 @@
 SLTM(VCL_trace)
 SLTM(VCL_return)
 SLTM(XID)
+SLTM(ExpBan)
 SLTM(ExpPick)
 SLTM(ExpKill)




More information about the varnish-commit mailing list