[4.1] 9920174 Increment fetch_failed for all causes

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Wed Feb 8 10:27:05 CET 2017


commit 9920174ed39f42eff8f49fa2918b180828b52814
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Sun Jan 15 20:11:48 2017 +0000

    Increment fetch_failed for all causes
    
    IOW if we ended up in vcl_backend_error{} or failed after returning
    delivery in vcl_backend_response{} (e.g. we did not receive enough bytes)
    we will bump this counter.
    
    Conflicts:
    	bin/varnishd/cache/cache_fetch.c
    	bin/varnishtest/tests/r01624.vtc
    	include/tbl/vsc_f_main.h

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 98336ed..8cb14fe 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -687,6 +687,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 			// XXX: doclose = ?
 			return (F_STP_ERROR);
 		} else {
+			wrk->stats->fetch_failed++;
 			return (F_STP_FAIL);
 		}
 	}
@@ -763,6 +764,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
 		(void)VFP_Error(bo->vfc, "Template object failed");
 	if (bo->vfc->failed) {
 		VDI_Finish(bo->wrk, bo);
+		wrk->stats->fetch_failed++;
 		return (F_STP_FAIL);
 	}
 
@@ -799,6 +801,8 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
 	AN(bo->fetch_objcore->flags & OC_F_BUSY);
 	assert(bo->director_state == DIR_S_NULL);
 
+	wrk->stats->fetch_failed++;
+
 	now = W_TIM_real(wrk);
 	VSLb_ts_busyobj(bo, "Error", now);
 
@@ -899,7 +903,6 @@ vbf_stp_fail(struct worker *wrk, struct busyobj *bo)
 		EXP_Rearm(bo->fetch_objcore,
 		    bo->fetch_objcore->exp.t_origin, 0, 0, 0);
 	}
-	wrk->stats->fetch_failed++;
 	VBO_setstate(bo, BOS_FAILED);
 	return (F_STP_DONE);
 }
diff --git a/bin/varnishtest/tests/b00020.vtc b/bin/varnishtest/tests/b00020.vtc
index 8427742..80353a7 100644
--- a/bin/varnishtest/tests/b00020.vtc
+++ b/bin/varnishtest/tests/b00020.vtc
@@ -46,4 +46,4 @@ client c1 {
 
 varnish v1 -expect n_object == 1
 varnish v1 -expect n_objectcore == 1
-
+varnish v1 -expect fetch_failed == 1
diff --git a/bin/varnishtest/tests/b00023.vtc b/bin/varnishtest/tests/b00023.vtc
index 7685f66..d418904 100644
--- a/bin/varnishtest/tests/b00023.vtc
+++ b/bin/varnishtest/tests/b00023.vtc
@@ -17,7 +17,6 @@ client c1 {
 	expect resp.status == 503
 } -run
 
-
 server s1 {
 	rxreq
 	delay 0.5
@@ -29,3 +28,5 @@ client c1 {
 	rxresp
 	expect resp.status == 200
 } -run
+
+varnish v1 -expect fetch_failed == 1
diff --git a/bin/varnishtest/tests/b00038.vtc b/bin/varnishtest/tests/b00038.vtc
index b963b4f..871ce93 100644
--- a/bin/varnishtest/tests/b00038.vtc
+++ b/bin/varnishtest/tests/b00038.vtc
@@ -35,3 +35,5 @@ client c1 {
 	rxresp
 	expect resp.status == 503
 } -run
+
+varnish v1 -expect fetch_failed == 1
diff --git a/bin/varnishtest/tests/c00061.vtc b/bin/varnishtest/tests/c00061.vtc
index b22f259..4c38f0e 100644
--- a/bin/varnishtest/tests/c00061.vtc
+++ b/bin/varnishtest/tests/c00061.vtc
@@ -22,3 +22,6 @@ client c1 {
 	rxresp
 	expect resp.status == 504
 } -run
+
+varnish v1 -expect backend_fail == 3
+varnish v1 -expect fetch_failed == 3
diff --git a/bin/varnishtest/tests/r01624.vtc b/bin/varnishtest/tests/r01624.vtc
index 23fefc0..e1dadb0 100644
--- a/bin/varnishtest/tests/r01624.vtc
+++ b/bin/varnishtest/tests/r01624.vtc
@@ -25,9 +25,10 @@ varnish v1 -vcl+backend {} -start
 
 client c1 {
 	txreq
+	rxresphdrs
+	expect resp.status == 200
 	non-fatal
-	timeout 3
-	rxresp
+	rxrespbody
 } -run
 
 delay .2
@@ -38,3 +39,5 @@ client c1 {
 	rxresp
 	expect resp.bodylen == 7
 } -run
+
+varnish v1 -expect fetch_failed == 1
diff --git a/bin/varnishtest/tests/r01648.vtc b/bin/varnishtest/tests/r01648.vtc
index de0c364..7de0d00 100644
--- a/bin/varnishtest/tests/r01648.vtc
+++ b/bin/varnishtest/tests/r01648.vtc
@@ -73,3 +73,5 @@ client c3 {
 	expect resp.status == 200
 	expect resp.body == "abcdef"
 } -run
+
+varnish v1 -expect fetch_failed == 2
diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h
index 9d05eff..ab926d9 100644
--- a/include/tbl/vsc_f_main.h
+++ b/include/tbl/vsc_f_main.h
@@ -184,7 +184,7 @@ VSC_F(fetch_304,		uint64_t, 1, 'c', 'i', info,
 	"beresp with no body because of 304 response."
 )
 VSC_F(fetch_failed,		uint64_t, 1, 'c', 'i', info,
-    "Fetch failed (all causes), where we do get hold of the backend.",
+    "Fetch failed (all causes)",
 	"beresp fetch failed."
 )
 VSC_F(fetch_no_thread,		uint64_t, 1, 'c', 'i', info,



More information about the varnish-commit mailing list