[master] 4e5ee71 Rename vcl_lookup{} back to vcl_hit{}.

Poul-Henning Kamp phk at varnish-cache.org
Mon Sep 9 11:20:42 CEST 2013


commit 4e5ee71f7b3e75edb6abe4d9fc9a05d301bad818
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 9 09:19:57 2013 +0000

    Rename vcl_lookup{} back to vcl_hit{}.
    
    The only real trouble was purges, and they now have their own vcl_purge{}
    
    Sorry for the detour...

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 9e0d35a..d5b8722 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -80,11 +80,11 @@ DOT acceptor -> recv [style=bold,color=green]
  *
 DOT	deliver [
 DOT		shape=record
-DOT		label="{cnt_deliver:|Filter obj.-\>resp.|{vcl_deliver\{\}|{req.|resp.}}|{<stream>deliver(stream)?|restart?|<deliver>deliver?}}"
+DOT		label="{cnt_deliver:|Filter obj.-\>resp.|{vcl_deliver\{\}|{req.|resp.}}|{restart?|<deliver>deliver?}}"
 DOT	]
 DOT deliver:deliver:s -> DONE [style=bold,color=green]
-DOT deliver:stream:s -> stream [style=bold,color=red]
-DOT deliver:stream:s -> stream [style=bold,color=blue]
+DOT deliver:deliver:s -> DONE [style=bold,color=red]
+DOT deliver:deliver:s -> DONE [style=bold,color=blue]
  *
  */
 
@@ -323,7 +323,7 @@ DOT		label="{<top>cnt_lookup:|hash lookup|{<busy>busy?|<e>exp?|<eb>exp+busy?|<h>
 DOT	]
 DOT	lookup2 [
 DOT		shape=record
-DOT		label="{<top>cnt_lookup:|{vcl_lookup\{\}|req.*, obj.*}|{<deliver>deliver?|error?|restart?|<fetch>fetch?|<pass>pass?}}"
+DOT		label="{<top>cnt_lookup:|{vcl_hit\{\}|req.*, obj.*}|{<deliver>deliver?|error?|restart?|<fetch>fetch?|<pass>pass?}}"
 DOT	]
 DOT }
 DOT lookup:busy:w -> lookup:top:w [label="(waitinglist)"]
@@ -411,7 +411,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
 
 	VSLb(req->vsl, SLT_Hit, "%u", req->obj->vxid);
 
-	VCL_lookup_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_hit_method(req->vcl, wrk, req, NULL, req->http->ws);
 
 	switch (wrk->handling) {
 	case VCL_RET_DELIVER:
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 36b2a43..e4aecb1 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -496,7 +496,7 @@ VRT_purge(const struct vrt_ctx *ctx, double ttl, double grace)
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(ctx->req->wrk, WORKER_MAGIC);
-	if (ctx->method == VCL_MET_LOOKUP)
+	if (ctx->method == VCL_MET_HIT)
 		HSH_Purge(ctx->req->wrk, ctx->req->obj->objcore->objhead,
 		    ttl, grace);
 	else if (ctx->method == VCL_MET_MISS)
diff --git a/bin/varnishd/default.vcl b/bin/varnishd/default.vcl
index 569cea2..46d3a21 100644
--- a/bin/varnishd/default.vcl
+++ b/bin/varnishd/default.vcl
@@ -97,7 +97,7 @@ sub vcl_purge {
     return (error(200, "Purged"));
 }
 
-sub vcl_lookup {
+sub vcl_hit {
     if (obj.ttl >= 0s) {
 	// A pure unadultered hit, deliver it
 	return (deliver);
diff --git a/bin/varnishtest/tests/b00019.vtc b/bin/varnishtest/tests/b00019.vtc
index 91c0e68..5566723 100644
--- a/bin/varnishtest/tests/b00019.vtc
+++ b/bin/varnishtest/tests/b00019.vtc
@@ -21,7 +21,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend {
-	sub vcl_lookup {
+	sub vcl_hit {
 	       return (restart);
 	}
 
diff --git a/bin/varnishtest/tests/c00010.vtc b/bin/varnishtest/tests/c00010.vtc
index e9c78a9..238dada 100644
--- a/bin/varnishtest/tests/c00010.vtc
+++ b/bin/varnishtest/tests/c00010.vtc
@@ -10,7 +10,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend { 
-	sub vcl_lookup {
+	sub vcl_hit {
 		return(pass);
 	}
 } -start
diff --git a/bin/varnishtest/tests/c00041.vtc b/bin/varnishtest/tests/c00041.vtc
index e9dd2cd..c51cf53 100644
--- a/bin/varnishtest/tests/c00041.vtc
+++ b/bin/varnishtest/tests/c00041.vtc
@@ -40,7 +40,7 @@ server s1 {
 
 varnish v1 -vcl+backend {
 	sub vcl_miss { if (req.http.purge == "yes") { purge; } }
-	sub vcl_lookup { if (req.http.purge == "yes") { purge; return(restart);} }
+	sub vcl_hit { if (req.http.purge == "yes") { purge; return(restart);} }
 } -start
 
 client c1 {
diff --git a/bin/varnishtest/tests/p00001.vtc b/bin/varnishtest/tests/p00001.vtc
index adfc1f0..ac95149 100644
--- a/bin/varnishtest/tests/p00001.vtc
+++ b/bin/varnishtest/tests/p00001.vtc
@@ -24,7 +24,7 @@ client c1 {
 varnish v1 -stop
 
 varnish v1 -vcl+backend {
-	sub vcl_lookup {
+	sub vcl_hit {
 		set obj.ttl = 1 s;
 	}
 }
diff --git a/bin/varnishtest/tests/r00310.vtc b/bin/varnishtest/tests/r00310.vtc
index 8097a6b..6a5ce22 100644
--- a/bin/varnishtest/tests/r00310.vtc
+++ b/bin/varnishtest/tests/r00310.vtc
@@ -1,9 +1,9 @@
-varnishtest "Test obj.http.x-cache in vcl_lookup"
+varnishtest "Test obj.http.x-cache in vcl_hit"
 
-varnish v1 -errvcl {'obj.http.x-cache': cannot be set in method 'vcl_lookup'.} {
+varnish v1 -errvcl {'obj.http.x-cache': cannot be set in method 'vcl_hit'.} {
 	backend foo { .host = "localhost"; }
 
-	sub vcl_lookup {
+	sub vcl_hit {
 		set obj.http.x-cache = "hit";
 	}
 }
diff --git a/bin/varnishtest/tests/r00365.vtc b/bin/varnishtest/tests/r00365.vtc
index a703a66..dc1d590 100644
--- a/bin/varnishtest/tests/r00365.vtc
+++ b/bin/varnishtest/tests/r00365.vtc
@@ -1,4 +1,4 @@
-varnishtest "Test restarts in vcl_lookup"
+varnishtest "Test restarts in vcl_hit"
 
 server s1 {
 	rxreq
@@ -10,7 +10,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend { 
-	sub vcl_lookup {
+	sub vcl_hit {
 		set obj.ttl = 0s;
 		return (restart);
 	}
diff --git a/bin/varnishtest/tests/r00411.vtc b/bin/varnishtest/tests/r00411.vtc
index 3d1e832..98c478e 100644
--- a/bin/varnishtest/tests/r00411.vtc
+++ b/bin/varnishtest/tests/r00411.vtc
@@ -11,7 +11,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend { 
-	sub vcl_lookup {
+	sub vcl_hit {
 		if (obj.http.X-Magic-Redirect == "1") {
 			set req.url = obj.http.Location;
 			return (restart);
diff --git a/bin/varnishtest/tests/r00444.vtc b/bin/varnishtest/tests/r00444.vtc
index 2448b93..899ab57 100644
--- a/bin/varnishtest/tests/r00444.vtc
+++ b/bin/varnishtest/tests/r00444.vtc
@@ -25,7 +25,7 @@ varnish v1 -vcl+backend {
 			return (hash);
 		}
 	}
-	sub vcl_lookup {
+	sub vcl_hit {
 		if (req.method == "POST") {
 			/* Get rid of this object */
 			set obj.ttl = 0s;
diff --git a/bin/varnishtest/tests/r00956.vtc b/bin/varnishtest/tests/r00956.vtc
index c8196d1..2744a44 100644
--- a/bin/varnishtest/tests/r00956.vtc
+++ b/bin/varnishtest/tests/r00956.vtc
@@ -11,7 +11,7 @@ varnish v1 -vcl+backend {
 		set beresp.http.fooB = beresp.ttl;
 		set beresp.http.barB = "xxx";
 	}
-	sub vcl_lookup {
+	sub vcl_hit {
 		set req.http.foo = obj.ttl;
 		set obj.ttl = 7s;
 		set obj.grace = 120s;
diff --git a/bin/varnishtest/tests/r01113.vtc b/bin/varnishtest/tests/r01113.vtc
index debeb90..75fa317 100644
--- a/bin/varnishtest/tests/r01113.vtc
+++ b/bin/varnishtest/tests/r01113.vtc
@@ -15,7 +15,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend {
-	sub vcl_lookup {
+	sub vcl_hit {
 		if (req.url == "/hit") {
 			return(restart);
 		}
diff --git a/bin/varnishtest/tests/v00018.vtc b/bin/varnishtest/tests/v00018.vtc
index 6b6fa1f..748e92f 100644
--- a/bin/varnishtest/tests/v00018.vtc
+++ b/bin/varnishtest/tests/v00018.vtc
@@ -2,14 +2,14 @@ varnishtest "VCL compiler coverage test: vcc_action.c"
 
 varnish v1 -vcl {
 	backend b { .host = "127.0.0.1"; }
-	sub vcl_lookup { return (restart) ; }
+	sub vcl_hit { return (restart) ; }
 	sub vcl_miss { rollback; return (restart); }
 }
 
 varnish v1 -vcl {
 	backend b { .host = "127.0.0.1"; }
 	sub vcl_miss { return(error(100,req.url)); }
-	sub vcl_lookup { return(error(100,"the butter please")); }
+	sub vcl_hit { return(error(100,"the butter please")); }
 }
 
 varnish v1 -errvcl {Variable 'server.port' is read only.} {
diff --git a/bin/varnishtest/tests/v00023.vtc b/bin/varnishtest/tests/v00023.vtc
index 10f9bb3..ca36194 100644
--- a/bin/varnishtest/tests/v00023.vtc
+++ b/bin/varnishtest/tests/v00023.vtc
@@ -10,7 +10,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend { 
-	sub vcl_lookup {
+	sub vcl_hit {
 		set obj.ttl = 0s;
 		return (restart);
 	}
diff --git a/bin/varnishtest/tests/v00025.vtc b/bin/varnishtest/tests/v00025.vtc
index 26f3384..a191969 100644
--- a/bin/varnishtest/tests/v00025.vtc
+++ b/bin/varnishtest/tests/v00025.vtc
@@ -25,7 +25,7 @@ sub vcl_backend_response {
 	}
 }
 
-sub vcl_lookup {
+sub vcl_hit {
 	if (obj.grace < 3m) {
 		set obj.grace = 1m;
 	} else {
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index 0125d73..979f2b1 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -84,7 +84,7 @@ returns =(
 	('hash',		"C", ('lookup',)),
 	('purge',		"C", ('error', 'fetch',)),
 	('miss',		"C", ('error', 'restart', 'pass', 'fetch',)),
-	('lookup',		"C", ('error', 'restart', 'pass', 'fetch', 'deliver',)),
+	('hit',			"C", ('error', 'restart', 'pass', 'fetch', 'deliver',)),
 	('backend_fetch',	"B", ('fetch', 'abandon')),
 	('backend_response',	"B", ('deliver', 'retry', 'abandon')),
 	('deliver',		"C", ('restart', 'deliver',)),
@@ -359,8 +359,8 @@ sp_variables = [
 	),
 	('obj.proto',
 		'STRING',
-		( 'lookup', 'error',),
-		( 'lookup', 'error',),
+		( 'hit', 'error',),
+		( 'hit', 'error',),
 	),
 	('obj.status',
 		'INT',
@@ -374,37 +374,37 @@ sp_variables = [
 	),
 	('obj.hits',
 		'INT',
-		( 'lookup', 'deliver',),
+		( 'hit', 'deliver',),
 		( ),
 	),
 	('obj.http.',
 		'HEADER',
-		( 'lookup', 'error',),
+		( 'hit', 'error',),
 		( 'error',),		# XXX ?
 	),
 	('obj.ttl',
 		'DURATION',
-		( 'lookup', 'error',),
-		( 'lookup', 'error',),
+		( 'hit', 'error',),
+		( 'hit', 'error',),
 	),
 	('obj.grace',
 		'DURATION',
-		( 'lookup', 'error',),
-		( 'lookup', 'error',),
+		( 'hit', 'error',),
+		( 'hit', 'error',),
 	),
 	('obj.keep',
 		'DURATION',
-		( 'lookup', 'error',),
-		( 'lookup', 'error',),
+		( 'hit', 'error',),
+		( 'hit', 'error',),
 	),
 	('obj.lastuse',
 		'DURATION',
-		( 'lookup', 'deliver', 'error',),
+		( 'hit', 'deliver', 'error',),
 		( ),
 	),
 	('obj.uncacheable',
 		'BOOL',
-		( 'lookup', 'deliver', 'error',),
+		( 'hit', 'deliver', 'error',),
 		( ),
 	),
 	('resp.proto',
diff --git a/lib/libvcl/vcc_action.c b/lib/libvcl/vcc_action.c
index 6b08b34..1b31fb7 100644
--- a/lib/libvcl/vcc_action.c
+++ b/lib/libvcl/vcc_action.c
@@ -408,7 +408,7 @@ static struct action_table {
 	{ "error",		parse_error },
 	{ "hash_data",		parse_hash_data, VCL_MET_HASH },
 	{ "new",		parse_new, VCL_MET_INIT},
-	{ "purge",		parse_purge, VCL_MET_MISS | VCL_MET_LOOKUP },
+	{ "purge",		parse_purge, VCL_MET_MISS | VCL_MET_HIT },
 	{ "remove",		parse_unset }, /* backward compatibility */
 	{ "return",		parse_return },
 	{ "rollback",		parse_rollback },



More information about the varnish-commit mailing list