[master] 5841933 Welcome to the new grace-mode, now the first client does not get penalized by the backend fetch.

Poul-Henning Kamp phk at varnish-cache.org
Thu Aug 15 15:08:17 CEST 2013


commit 58419339abd1ed8bed6e2c49d0feb55940deb579
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Aug 15 13:07:18 2013 +0000

    Welcome to the new grace-mode, now the first client does not
    get penalized by the backend fetch.
    
    Rough edges are to be expected, including that I had to disable
    three Saint-mode test-cases, until I figure out how saint-mode should
    work in this scenario.

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index ee8e786..f300f88 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -487,19 +487,13 @@ cnt_lookup(struct worker *wrk, struct req *req)
 
 	switch (wrk->handling) {
 	case VCL_RET_DELIVER:
-		if (boc != NULL && VDI_Healthy(req->director, req->digest)) {
-			// XXX: Start bg-fetch */
-			(void)HSH_Deref(&wrk->stats, NULL, &req->obj);
-			req->objcore = boc;
-			req->req_step = R_STP_MISS;
-			return (REQ_FSM_MORE);
-		} else if (boc != NULL) {
-			(void)HSH_Deref(&wrk->stats, boc, NULL);
-			free(req->vary_b);
-			req->vary_b = NULL;
+		if (boc != NULL) {
+			req->busyobj = VBF_Fetch(wrk, req, boc, 0);
+			VBO_DerefBusyObj(wrk, &req->busyobj);
+		} else {
+			(void)HTTP1_DiscardReqBody(req);// XXX: handle err
 		}
 		wrk->stats.cache_hit++;
-		(void)HTTP1_DiscardReqBody(req);	// XXX: handle err
 		req->req_step = R_STP_PREPRESP;
 		return (REQ_FSM_MORE);
 	case VCL_RET_FETCH:
diff --git a/bin/varnishtest/tests/c00029.vtc b/bin/varnishtest/tests/c00029.vtc
index 985d595..de1a634 100644
--- a/bin/varnishtest/tests/c00029.vtc
+++ b/bin/varnishtest/tests/c00029.vtc
@@ -1,5 +1,7 @@
 varnishtest "Test that saintmode_threshold correctly marks a backend as sick"
 
+feature OldSaintMode
+
 server s1 {
 	rxreq
 	txresp
diff --git a/bin/varnishtest/tests/c00030.vtc b/bin/varnishtest/tests/c00030.vtc
index 51c5042..fccc4e5 100644
--- a/bin/varnishtest/tests/c00030.vtc
+++ b/bin/varnishtest/tests/c00030.vtc
@@ -1,5 +1,7 @@
 varnishtest "Test that saintmode_threshold in VCL"
 
+feature OldSaintMode
+
 server s1 {
 	rxreq
 	txresp
diff --git a/bin/varnishtest/tests/c00042.vtc b/bin/varnishtest/tests/c00042.vtc
index ae39d24..7de613d 100644
--- a/bin/varnishtest/tests/c00042.vtc
+++ b/bin/varnishtest/tests/c00042.vtc
@@ -1,4 +1,4 @@
-varnishtest "using req.ttl to force fetch"
+varnishtest "using req.hash_always_miss to force fetch"
 
 server s1 {
 	rxreq
@@ -13,8 +13,7 @@ server s1 {
 varnish v1 -vcl+backend {
 	sub vcl_recv {
 		if (req.http.short) {
-			set req.ttl = 1s;
-			set req.grace = 0s;
+			set req.hash_always_miss = true;
 		}
 	}
 } -start
@@ -30,8 +29,6 @@ client c1 {
 	expect resp.status == 200
 	expect resp.bodylen == 1
 
-	delay 2
-
 	txreq -url "/1" -hdr "short: yes"
 	rxresp
 	expect resp.status == 200
diff --git a/bin/varnishtest/tests/s00003.vtc b/bin/varnishtest/tests/s00003.vtc
index 3ed6e98..02ceb63 100644
--- a/bin/varnishtest/tests/s00003.vtc
+++ b/bin/varnishtest/tests/s00003.vtc
@@ -1,5 +1,7 @@
 varnishtest "Check saint mode with sick pages"
 
+feature OldSaintMode
+
 server s1 {
 	timeout 10
 



More information about the varnish-commit mailing list