r5568 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Sun Nov 21 10:48:57 CET 2010


Author: phk
Date: 2010-11-21 10:48:57 +0100 (Sun, 21 Nov 2010)
New Revision: 5568

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_backend.h
   trunk/varnish-cache/bin/varnishd/cache_dir.c
   trunk/varnish-cache/bin/varnishd/cache_dir_dns.c
   trunk/varnish-cache/bin/varnishd/cache_dir_random.c
   trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c
   trunk/varnish-cache/bin/varnishd/cache_hash.c
Log:
Reduce to just one backend health-check variant.



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2010-11-21 09:35:37 UTC (rev 5567)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2010-11-21 09:48:57 UTC (rev 5568)
@@ -526,7 +526,6 @@
 void VBE_UseHealth(const struct director *vdi);
 
 struct vbc *VDI_GetFd(const struct director *, struct sess *sp);
-int VDI_Healthy_x(double now, const struct director *, uintptr_t target);
 int VDI_Healthy(const struct director *, const struct sess *sp);
 void VDI_CloseFd(struct sess *sp);
 void VDI_RecycleFd(struct sess *sp);

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-11-21 09:35:37 UTC (rev 5567)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-11-21 09:48:57 UTC (rev 5568)
@@ -483,13 +483,13 @@
 }
 
 static unsigned
-vdi_simple_healthy(double now, const struct director *d, uintptr_t target)
+vdi_simple_healthy(const struct director *d, const struct sess *sp)
 {
 	struct vdi_simple *vs;
 
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC);
-	return (vbe_Healthy(now, target, vs));
+	return (vbe_Healthy(sp->t_req, (uintptr_t)(sp->objhead), vs));
 }
 
 static void

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.h	2010-11-21 09:35:37 UTC (rev 5567)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.h	2010-11-21 09:48:57 UTC (rev 5568)
@@ -79,8 +79,7 @@
 
 typedef struct vbc *vdi_getfd_f(const struct director *, struct sess *sp);
 typedef void vdi_fini_f(const struct director *);
-typedef unsigned vdi_healthy(double now, const struct director *,
-    uintptr_t target);
+typedef unsigned vdi_healthy(const struct director *, const struct sess *sp);
 
 struct director {
 	unsigned		magic;

Modified: trunk/varnish-cache/bin/varnishd/cache_dir.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir.c	2010-11-21 09:35:37 UTC (rev 5567)
+++ trunk/varnish-cache/bin/varnishd/cache_dir.c	2010-11-21 09:48:57 UTC (rev 5568)
@@ -116,13 +116,5 @@
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
-	return (d->healthy(sp->t_req, d, (uintptr_t)sp->objhead));
+	return (d->healthy(d, sp));
 }
-
-int
-VDI_Healthy_x(double now, const struct director *d, uintptr_t target)
-{
-
-	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
-	return (d->healthy(now, d, target));
-}

Modified: trunk/varnish-cache/bin/varnishd/cache_dir_dns.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_dns.c	2010-11-21 09:35:37 UTC (rev 5567)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_dns.c	2010-11-21 09:48:57 UTC (rev 5568)
@@ -398,15 +398,14 @@
 }
 
 static unsigned
-vdi_dns_healthy(double now, const struct director *dir, uintptr_t target)
+vdi_dns_healthy(const struct director *dir, const struct sess *sp)
 {
 	/* XXX: Fooling -Werror for a bit until it's actually implemented.
 	 */
-	if (now || dir || target)
-		return (1);
-	else
-		return (1);
+	(void)dir;
+	(void)sp;
 	return (1);
+
 	/*
 	struct vdi_dns *vs;
 	struct director *dir;

Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_random.c	2010-11-21 09:35:37 UTC (rev 5567)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c	2010-11-21 09:48:57 UTC (rev 5568)
@@ -188,7 +188,7 @@
 }
 
 static unsigned
-vdi_random_healthy(double now, const struct director *d, uintptr_t target)
+vdi_random_healthy(const struct director *d, const struct sess *sp)
 {
 	struct vdi_random *vs;
 	int i;
@@ -197,10 +197,10 @@
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_RANDOM_MAGIC);
 
 	for (i = 0; i < vs->nhosts; i++) {
-		if (VDI_Healthy_x(now, vs->hosts[i].backend, target))
-			return 1;
+		if (VDI_Healthy(vs->hosts[i].backend, sp))
+			return (1);
 	}
-	return 0;
+	return (0);
 }
 
 static void

Modified: trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c	2010-11-21 09:35:37 UTC (rev 5567)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c	2010-11-21 09:48:57 UTC (rev 5568)
@@ -85,7 +85,7 @@
 }
 
 static unsigned
-vdi_round_robin_healthy(double now, const struct director *d, uintptr_t target)
+vdi_round_robin_healthy(const struct director *d, const struct sess *sp)
 {
 	struct vdi_round_robin *vs;
 	struct director *backend;
@@ -96,10 +96,10 @@
 
 	for (i = 0; i < vs->nhosts; i++) {
 		backend = vs->hosts[i].backend;
-		if (VDI_Healthy_x(now, backend, target))
-			return 1;
+		if (VDI_Healthy(backend, sp))
+			return (1);
 	}
-	return 0;
+	return (0);
 }
 
 static void

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-11-21 09:35:37 UTC (rev 5567)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-11-21 09:48:57 UTC (rev 5568)
@@ -383,23 +383,26 @@
 
 	/*
 	 * If we have seen a busy object or the backend is unhealthy, and
-	 * have an object in grace, use it, if req.grace is also
+	 * we have an object in grace, use it, if req.grace is also
 	 * satisified.
 	 * XXX: Interesting footnote:  The busy object might be for a
 	 * XXX: different "Vary:" than we sought.  We have no way of knowing
 	 * XXX: this until the object is unbusy'ed, so in practice we
 	 * XXX: serialize fetch of all Vary's if grace is possible.
 	 */
+	AZ(sp->objhead);
+	sp->objhead = oh;		/* XXX: Hack */
 	if (oc == NULL			/* We found no live object */
 	    && grace_oc != NULL		/* There is a grace candidate */
 	    && (busy_oc != NULL		/* Somebody else is already busy */
-	    || !VDI_Healthy_x(sp->t_req, sp->director, (uintptr_t)oh))) {
+	    || !VDI_Healthy(sp->director, sp))) {
 					/* Or it is impossible to fetch */
 		o = oc_getobj(sp->wrk, grace_oc);
 		CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
 		if (o->ttl + HSH_Grace(sp->grace) >= sp->t_req)
 			oc = grace_oc;
 	}
+	sp->objhead = NULL;
 
 	if (oc != NULL && !sp->hash_always_miss) {
 		o = oc_getobj(sp->wrk, oc);




More information about the varnish-commit mailing list