[master] e0db8b0 Retire the obj.cacheable VCL variable. Whatever our thinking at the time might have been, it clearly was woollen, and all it did was confuse people.

Poul-Henning Kamp phk at varnish-cache.org
Fri Jan 28 22:38:37 CET 2011


commit e0db8b06a229058bb759962cb3a3db5e14828e25
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Jan 28 21:37:38 2011 +0000

    Retire the obj.cacheable VCL variable.  Whatever our thinking at the
    time might have been, it clearly was woollen, and all it did was
    confuse people.

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 980ab6f..c2051b3 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -432,7 +432,6 @@ struct object {
 	unsigned		response;
 
 	/* XXX: make bitmap */
-	unsigned		cacheable;
 	unsigned		gziped;
 	/* Bit positions in the gzip stream */
 	ssize_t			gzip_start;
diff --git a/bin/varnishd/cache_ban.c b/bin/varnishd/cache_ban.c
index ab06261..50d29e3 100644
--- a/bin/varnishd/cache_ban.c
+++ b/bin/varnishd/cache_ban.c
@@ -476,7 +476,6 @@ ban_check_object(struct object *o, const struct sess *sp, int has_req)
 		return (0);
 	} else {
 		o->ttl = 0;
-		o->cacheable = 0;
 		oc->ban = NULL;
 		oc_updatemeta(oc);
 		/* BAN also changed, but that is not important any more */
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 08458c6..fc8de44 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -667,10 +667,7 @@ cnt_fetch(struct sess *sp)
 
 	sp->obj->xid = sp->xid;
 	sp->obj->response = sp->err_code;
-	sp->obj->cacheable = sp->wrk->cacheable;
 	sp->obj->grace = sp->wrk->grace;
-	if (sp->obj->ttl == 0. && sp->obj->grace == 0.)
-		sp->obj->cacheable = 0;
 	sp->obj->age = sp->wrk->age;
 	sp->obj->entered = sp->wrk->entered;
 	WS_Assert(sp->obj->ws_o);
@@ -733,7 +730,6 @@ cnt_fetch(struct sess *sp)
 		WRONG("Illegal action in vcl_fetch{}");
 	}
 
-	sp->obj->cacheable = 1;
 	if (sp->wrk->cacheable) {
 		EXP_Insert(sp->obj);
 		AN(sp->obj->objcore);
diff --git a/bin/varnishd/cache_expire.c b/bin/varnishd/cache_expire.c
index 19ec70c..3afadea 100644
--- a/bin/varnishd/cache_expire.c
+++ b/bin/varnishd/cache_expire.c
@@ -138,7 +138,6 @@ EXP_Insert(struct object *o)
 	oc = o->objcore;
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
 	AssertObjBusy(o);
-	assert(o->cacheable);
 	HSH_Ref(oc);
 
 	assert(o->entered != 0 && !isnan(o->entered));
diff --git a/bin/varnishd/cache_hash.c b/bin/varnishd/cache_hash.c
index 7266a56..3694a75 100644
--- a/bin/varnishd/cache_hash.c
+++ b/bin/varnishd/cache_hash.c
@@ -362,8 +362,6 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
 		o = oc_getobj(sp->wrk, oc);
 		CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
 
-		if (!o->cacheable)
-			continue;
 		if (o->ttl == 0)
 			continue;
 		if (BAN_CheckObject(o, sp))
@@ -579,7 +577,6 @@ HSH_Drop(struct sess *sp)
 	o = sp->obj;
 	CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
 	AssertObjPassOrBusy(o);
-	o->cacheable = 0;
 	o->ttl = 0;
 	if (o->objcore != NULL)		/* Pass has no objcore */
 		HSH_Unbusy(sp);
diff --git a/bin/varnishd/cache_vrt_var.c b/bin/varnishd/cache_vrt_var.c
index d0af3f3..44f7ec3 100644
--- a/bin/varnishd/cache_vrt_var.c
+++ b/bin/varnishd/cache_vrt_var.c
@@ -367,28 +367,6 @@ VRT_r_obj_ttl(const struct sess *sp)
 	return (sp->obj->ttl - sp->t_req);
 }
 
-
-/*--------------------------------------------------------------------*/
-
-#define VOBJ(type,onm,field)						\
-void									\
-VRT_l_obj_##onm(const struct sess *sp, type a)				\
-{									\
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);				\
-	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);	/* XXX */	\
-	sp->obj->field = a;						\
-}									\
-									\
-type									\
-VRT_r_obj_##onm(const struct sess *sp)					\
-{									\
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);				\
-	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);	/* XXX */	\
-	return (sp->obj->field);					\
-}
-
-VOBJ(unsigned, cacheable, cacheable)
-
 /*--------------------------------------------------------------------*/
 
 void
diff --git a/bin/varnishd/default.vcl b/bin/varnishd/default.vcl
index a1a7587..350e0a7 100644
--- a/bin/varnishd/default.vcl
+++ b/bin/varnishd/default.vcl
@@ -94,9 +94,6 @@ sub vcl_hash {
 }
 
 sub vcl_hit {
-    if (!obj.cacheable) {
-        return (pass);
-    }
     return (deliver);
 }
 
diff --git a/bin/varnishtest/tests/r00365.vtc b/bin/varnishtest/tests/r00365.vtc
index f7daf85..33ad869 100644
--- a/bin/varnishtest/tests/r00365.vtc
+++ b/bin/varnishtest/tests/r00365.vtc
@@ -13,7 +13,7 @@ server s1 {
 
 varnish v1 -vcl+backend { 
 	sub vcl_hit {
-		set obj.cacheable = false;
+		set obj.ttl = 0s;
 		return (restart);
 	}
 } -start
diff --git a/bin/varnishtest/tests/r00444.vtc b/bin/varnishtest/tests/r00444.vtc
index 2ee3456..c6f3b3b 100644
--- a/bin/varnishtest/tests/r00444.vtc
+++ b/bin/varnishtest/tests/r00444.vtc
@@ -30,7 +30,6 @@ varnish v1 -vcl+backend {
 	sub vcl_hit {
 		if (req.request == "POST") {
 			/* Get rid of this object */
-			set obj.cacheable = false;
 			set obj.ttl = 0s;
 			return (pass);
 		}
diff --git a/bin/varnishtest/tests/v00018.vtc b/bin/varnishtest/tests/v00018.vtc
index 1ec304a..13e39e0 100644
--- a/bin/varnishtest/tests/v00018.vtc
+++ b/bin/varnishtest/tests/v00018.vtc
@@ -63,27 +63,27 @@ varnish v1 -vcl {
 
 varnish v1 -badvcl {
 	backend b { .host = "127.0.0.1"; }
-	sub vcl_fetch { set obj.cacheable += 1; }
+	sub vcl_fetch { set beresp.do_gzip += 1; }
 }
 
 varnish v1 -vcl {
 	backend b { .host = "127.0.0.1"; }
-	sub vcl_fetch { set beresp.cacheable = true; }
+	sub vcl_fetch { set beresp.do_gzip = true; }
 }
 
 varnish v1 -vcl {
 	backend b { .host = "127.0.0.1"; }
-	sub vcl_fetch { set beresp.cacheable = false; }
+	sub vcl_fetch { set beresp.do_gzip = false; }
 }
 
 varnish v1 -badvcl {
 	backend b { .host = "127.0.0.1"; }
-	sub vcl_fetch { set beresp.cacheable = mu; }
+	sub vcl_fetch { set beresp.do_gzip = mu; }
 }
 
 varnish v1 -badvcl {
 	backend b { .host = "127.0.0.1"; }
-	sub vcl_fetch { unset beresp.cacheable; }
+	sub vcl_fetch { unset beresp.do_gzip; }
 }
 
 varnish v1 -badvcl {
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index dd59251..56c6f4d 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -416,7 +416,9 @@ varnish_stop(struct varnish *v)
 	vtc_log(v->vl, 2, "Stop");
 	(void)varnish_ask_cli(v, "stop", NULL);
 	while (1) {
+		r = NULL;
 		(void)varnish_ask_cli(v, "status", &r);
+		AN(r);
 		if (!strcmp(r, "Child in state stopped"))
 			break;
 		free(r);
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index 7b0e9fa..922ca94 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -382,12 +382,6 @@ sp_variables = (
 		( 'error',),		# XXX ?
 		'const struct sess *'
 	),
-	('obj.cacheable',
-		'BOOL',
-		( 'hit',),
-		( 'hit',),
-		'const struct sess *'
-	),
 	('obj.ttl',
 		'DURATION',
 		( 'hit', 'error',),



More information about the varnish-commit mailing list