r4191 - in trunk/varnish-cache: bin/varnishd lib/libvarnishapi
phk at projects.linpro.no
phk at projects.linpro.no
Tue Aug 18 12:08:02 CEST 2009
Author: phk
Date: 2009-08-18 12:08:02 +0200 (Tue, 18 Aug 2009)
New Revision: 4191
Modified:
trunk/varnish-cache/bin/varnishd/cache_expire.c
trunk/varnish-cache/lib/libvarnishapi/shmlog.c
Log:
Make the -d option to varnishlog et all exit when the log is emptied.
Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c 2009-08-18 09:17:21 UTC (rev 4190)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2009-08-18 10:08:02 UTC (rev 4191)
@@ -264,31 +264,36 @@
continue;
}
- o = oc->obj;
- CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
- CHECK_OBJ_NOTNULL(o->objhead, OBJHEAD_MAGIC);
- assert(oc->flags & OC_F_ONLRU);
+ /* It's time... */
+
+ /* Remove from binheap */
assert(oc->timer_idx != BINHEAP_NOIDX);
binheap_delete(exp_heap, oc->timer_idx);
assert(oc->timer_idx == BINHEAP_NOIDX);
- lru = STV_lru(o->objstore);
- AN(lru);
- VTAILQ_REMOVE(lru, o->objcore, lru_list);
- oc->flags &= ~OC_F_ONLRU;
- { /* Sanity checking */
- struct objcore *oc2 = binheap_root(exp_heap);
- if (oc2 != NULL) {
- assert(oc2->timer_idx != BINHEAP_NOIDX);
- assert(oc2->timer_when >= oc->timer_when);
- }
+ /* And from LRU */
+ if (oc->flags & OC_F_ONLRU) {
+ assert(!(oc->flags & OC_F_PERSISTENT));
+ lru = STV_lru(o->objstore);
+ AN(lru);
+ VTAILQ_REMOVE(lru, o->objcore, lru_list);
+ oc->flags &= ~OC_F_ONLRU;
+ } else {
+ assert(oc->flags & OC_F_PERSISTENT);
}
VSL_stats->n_expired++;
+
Lck_Unlock(&exp_mtx);
+
+ if (!(oc->flags & OC_F_PERSISTENT)) {
+ o = oc->obj;
+ CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
+ HSH_Deref(sp->wrk, &o);
+ CHECK_OBJ_NOTNULL(o->objhead, OBJHEAD_MAGIC);
+ }
WSL(sp->wrk, SLT_ExpKill, 0, "%u %d",
o->xid, (int)(o->ttl - t));
- HSH_Deref(sp->wrk, &o);
}
}
Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2009-08-18 09:17:21 UTC (rev 4190)
+++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2009-08-18 10:08:02 UTC (rev 4191)
@@ -540,7 +540,10 @@
switch (arg) {
case 'b': vd->b_opt = !vd->b_opt; return (1);
case 'c': vd->c_opt = !vd->c_opt; return (1);
- case 'd': vd->d_opt = !vd->d_opt; return (1);
+ case 'd':
+ vd->d_opt = !vd->d_opt;
+ vd->flags |= F_NON_BLOCKING;
+ return (1);
case 'i': case 'x': return (vsl_ix_arg(vd, opt, arg));
case 'r': return (vsl_r_arg(vd, opt));
case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg));
More information about the varnish-commit
mailing list