r5102 - in trunk/varnish-cache: bin/varnishd include
phk at varnish-cache.org
phk at varnish-cache.org
Fri Aug 13 12:14:06 CEST 2010
Author: phk
Date: 2010-08-13 12:14:05 +0200 (Fri, 13 Aug 2010)
New Revision: 5102
Modified:
trunk/varnish-cache/bin/varnishd/cache_center.c
trunk/varnish-cache/include/vsc_fields.h
Log:
Retry backend fetches one time if we got a recycled conncetion and
the transfer failed before we received anything.
Fixes: #749
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2010-08-13 09:40:18 UTC (rev 5101)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2010-08-13 10:14:05 UTC (rev 5102)
@@ -439,6 +439,15 @@
http_Setup(sp->wrk->beresp, sp->wrk->ws);
i = FetchHdr(sp);
+ /*
+ * If we recycle a backend connection, there is a finite chance
+ * that the backend closed it before we get a request to it.
+ * Do a single retry in that case.
+ */
+ if (i == 1) {
+ VSC_main->backend_retry++;
+ i = FetchHdr(sp);
+ }
/*
* Save a copy before it might get mangled in VCL. When it comes to
Modified: trunk/varnish-cache/include/vsc_fields.h
===================================================================
--- trunk/varnish-cache/include/vsc_fields.h 2010-08-13 09:40:18 UTC (rev 5101)
+++ trunk/varnish-cache/include/vsc_fields.h 2010-08-13 10:14:05 UTC (rev 5102)
@@ -55,6 +55,7 @@
VSC_F_MAIN(backend_toolate, uint64_t, 0, 'a', "Backend conn. was closed")
VSC_F_MAIN(backend_recycle, uint64_t, 0, 'a', "Backend conn. recycles")
VSC_F_MAIN(backend_unused, uint64_t, 0, 'a', "Backend conn. unused")
+VSC_F_MAIN(backend_retry, uint64_t, 0, 'a', "Backend conn. retry")
VSC_F_MAIN(fetch_head, uint64_t, 1, 'a', "Fetch head")
VSC_F_MAIN(fetch_length, uint64_t, 1, 'a', "Fetch with Length")
More information about the varnish-commit
mailing list