r5096 - in trunk/varnish-cache/bin: varnishd varnishtest varnishtest/tests

phk at varnish-cache.org phk at varnish-cache.org
Thu Aug 12 10:13:15 CEST 2010


Author: phk
Date: 2010-08-12 10:13:15 +0200 (Thu, 12 Aug 2010)
New Revision: 5096

Added:
   trunk/varnish-cache/bin/varnishtest/tests/c00035.vtc
Modified:
   trunk/varnish-cache/bin/varnishd/cache_backend_poll.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishtest/vtc_server.c
Log:
Set backend health good if we stop polling the health.



Modified: trunk/varnish-cache/bin/varnishd/cache_backend_poll.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend_poll.c	2010-08-11 20:52:20 UTC (rev 5095)
+++ trunk/varnish-cache/bin/varnishd/cache_backend_poll.c	2010-08-12 08:13:15 UTC (rev 5096)
@@ -557,10 +557,14 @@
 
 	/* No more polling for this backend */
 
+	b->healthy = 1;
+
 	vt->stop = 1;
 	AZ(pthread_cancel(vt->thread));
 	AZ(pthread_join(vt->thread, &ret));
 
+	b->healthy = 1;
+
 	VTAILQ_REMOVE(&vbp_list, vt, list);
 	b->probe = NULL;
 	vsb_delete(vt->vsb);

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2010-08-11 20:52:20 UTC (rev 5095)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2010-08-12 08:13:15 UTC (rev 5096)
@@ -396,7 +396,7 @@
 		i = HTC_Rx(sp->wrk->htc);
 		if (i < 0) {
 			WSP(sp, SLT_FetchError,
-			    "http read error: %d", errno);
+			    "http read error: %d (%s)", errno, strerror(errno));
 			VDI_CloseFd(sp);
 			/* XXX: other cleanup ? */
 			return (__LINE__);

Added: trunk/varnish-cache/bin/varnishtest/tests/c00035.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00035.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00035.vtc	2010-08-12 08:13:15 UTC (rev 5096)
@@ -0,0 +1,48 @@
+# $Id$
+
+test "Dropping polling of a backend"
+
+server s1 -repeat 1 {
+	rxreq
+	txresp
+} -start
+
+varnish v1 -vcl {
+	backend s1 {
+		.host = "${s1_addr}";
+		.port = "${s1_port}";
+		.probe = {
+			.window = 8;
+			.initial = 7;
+			.threshold = 8;
+			.interval = 0.1s;
+		}
+	}
+} -start
+
+delay 1
+
+varnish v1 -vcl {
+	backend s1 {
+		.host = "${s1_addr}";
+		.port = "${s1_port}";
+	}
+} -cliok "vcl.use vcl2" -cliok "vcl.discard vcl1"
+
+delay .5
+
+varnish v1 -cliok "vcl.list"
+varnish v1 -cliok "debug.health"
+
+server s1 {
+	rxreq
+	expect req.url == /foo
+	txresp -bodylen 4
+} -start
+
+client c1 {
+	txreq -url /foo
+	rxresp
+	expect resp.status == 200
+	expect resp.bodylen == 4
+} -run

Modified: trunk/varnish-cache/bin/varnishtest/vtc_server.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_server.c	2010-08-11 20:52:20 UTC (rev 5095)
+++ trunk/varnish-cache/bin/varnishtest/vtc_server.c	2010-08-12 08:13:15 UTC (rev 5096)
@@ -112,9 +112,6 @@
 			vtc_log(vl, 0, "Shutdown failed: %s", strerror(errno));
 		TCP_close(&fd);
 	}
-	macro_def(s->vl, s->name, "addr", NULL);
-	macro_def(s->vl, s->name, "port", NULL);
-	macro_def(s->vl, s->name, "sock", NULL);
 	vtc_log(vl, 2, "Ending");
 	return (NULL);
 }
@@ -155,6 +152,9 @@
 {
 
 	CHECK_OBJ_NOTNULL(s, SERVER_MAGIC);
+	macro_def(s->vl, s->name, "addr", NULL);
+	macro_def(s->vl, s->name, "port", NULL);
+	macro_def(s->vl, s->name, "sock", NULL);
 	vtc_logclose(s->vl);
 	free(s->name);
 	/* XXX: MEMLEAK (?) (VSS ??) */




More information about the varnish-commit mailing list