r223 - in trunk/varnish-cache: bin/varnishd include lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Sat Jun 24 21:41:55 CEST 2006


Author: phk
Date: 2006-06-24 21:41:55 +0200 (Sat, 24 Jun 2006)
New Revision: 223

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_pool.c
   trunk/varnish-cache/bin/varnishd/cache_vcl.c
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/include/shmlog_tags.h
   trunk/varnish-cache/include/vrt.h
   trunk/varnish-cache/lib/libvcl/vcl_compile.c
   trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c
Log:
Add more shmemlog tags:
	one for each VCL method to record the return
	one for errors
	one for linking a client session to a backend connection
Use them sensibly.
Put VCL name of backend into struct backend to improve log messages



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2006-06-22 16:17:10 UTC (rev 222)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2006-06-24 19:41:55 UTC (rev 223)
@@ -104,6 +104,7 @@
 };
 
 struct backend {
+	const char	*vcl_name;
 	const char	*hostname;
 	const char	*portname;
 	unsigned	ip;

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-06-22 16:17:10 UTC (rev 222)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-06-24 19:41:55 UTC (rev 223)
@@ -204,7 +204,7 @@
 
 	fd = VBE_GetFd(sp->backend, &fd_token);
 	assert(fd != -1);
-	VSL(SLT_Handling, sp->fd, "Fetch fd %d", fd);
+	VSL(SLT_Backend, sp->fd, "%d %s", fd, sp->backend->vcl_name);
 
 	hp = http_New();
 	http_BuildSbuf(1, w->sb, sp->http);

Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2006-06-22 16:17:10 UTC (rev 222)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2006-06-24 19:41:55 UTC (rev 223)
@@ -110,23 +110,19 @@
 		for (done = 0; !done; ) {
 			switch(sp->handling) {
 			case VCL_RET_LOOKUP:
-				VSL(SLT_Handling, sp->fd, "Lookup");
 				done = LookupSession(&w, sp);
 				break;
 			case VCL_RET_FETCH:
 				done = FetchSession(&w, sp);
 				break;
 			case VCL_RET_DELIVER:
-				VSL(SLT_Handling, sp->fd, "Deliver");
 				done = DeliverSession(&w, sp);
 				break;
 			case VCL_RET_PIPE:
-				VSL(SLT_Handling, sp->fd, "Pipe");
 				PipeSession(&w, sp);
 				done = 1;
 				break;
 			case VCL_RET_PASS:
-				VSL(SLT_Handling, sp->fd, "Pass");
 				PassSession(&w, sp);
 				done = 1;
 				break;

Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vcl.c	2006-06-22 16:17:10 UTC (rev 222)
+++ trunk/varnish-cache/bin/varnishd/cache_vcl.c	2006-06-24 19:41:55 UTC (rev 223)
@@ -212,15 +212,11 @@
 
 	u = sp->handling;
 	n = HandlingName(u);
-	if (n != NULL)
-		VSL(SLT_Handling, sp->fd, "%s(): %s", func, n);
-	else
-		VSL(SLT_Handling, sp->fd, "%s(): Illegal: 0x%x", func, u);
 	if (u & (u - 1))
-		VSL(SLT_Debug, sp->fd,
+		VSL(SLT_Error, sp->fd,
 		    "Illegal handling after %s function: 0x%x", func, u);
 	else if (!(u & bitmap))
-		VSL(SLT_Debug, sp->fd,
+		VSL(SLT_Error, sp->fd,
 		    "Wrong handling after %s function: 0x%x", func, u);
 	else
 		return;
@@ -235,6 +231,7 @@
 	sp->handling = 0;			\
 	sp->vcl->func##_func(sp);		\
 	CheckHandling(sp, #func, (bitmap));	\
+	VSL(SLT_vcl_##func, sp->fd, "%s", HandlingName(sp->handling)); \
 }
 
 #define VCL_RET_MAC(l,u,b)

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2006-06-22 16:17:10 UTC (rev 222)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2006-06-24 19:41:55 UTC (rev 223)
@@ -103,6 +103,12 @@
 }
 
 void
+VRT_set_backend_name(struct backend *be, const char *p)
+{
+	be->vcl_name = p;
+}
+
+void
 VRT_alloc_backends(struct VCL_conf *cp)
 {
 	int i;

Modified: trunk/varnish-cache/include/shmlog_tags.h
===================================================================
--- trunk/varnish-cache/include/shmlog_tags.h	2006-06-22 16:17:10 UTC (rev 222)
+++ trunk/varnish-cache/include/shmlog_tags.h	2006-06-24 19:41:55 UTC (rev 223)
@@ -7,6 +7,7 @@
  */
 
 SLTM(Debug)
+SLTM(Error)
 SLTM(CLI)
 SLTM(SessionOpen)
 SLTM(SessionReuse)
@@ -16,7 +17,12 @@
 SLTM(BackendClose)
 SLTM(HttpError)
 SLTM(ClientAddr)
-SLTM(Handling)
+#define VCL_RET_MAC(l,u,b)
+#define VCL_MET_MAC(l,u,b) SLTM(vcl_##l)
+#include "vcl_returns.h"
+#undef VCL_MET_MAC
+#undef VCL_RET_MAC
+SLTM(Backend)
 SLTM(Request)
 SLTM(Response)
 SLTM(Status)

Modified: trunk/varnish-cache/include/vrt.h
===================================================================
--- trunk/varnish-cache/include/vrt.h	2006-06-22 16:17:10 UTC (rev 222)
+++ trunk/varnish-cache/include/vrt.h	2006-06-24 19:41:55 UTC (rev 223)
@@ -40,6 +40,7 @@
 int VRT_obj_valid(struct sess *);
 int VRT_obj_cacheable(struct sess *);
 
+void VRT_set_backend_name(struct backend *, const char *);
 void VRT_set_backend_hostname(struct backend *, const char *);
 void VRT_set_backend_portname(struct backend *, const char *);
 

Modified: trunk/varnish-cache/lib/libvcl/vcl_compile.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcl_compile.c	2006-06-22 16:17:10 UTC (rev 222)
+++ trunk/varnish-cache/lib/libvcl/vcl_compile.c	2006-06-24 19:41:55 UTC (rev 223)
@@ -42,8 +42,8 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <netdb.h>
+#include <stdio.h>
 #include <sbuf.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <queue.h>
@@ -1241,6 +1241,11 @@
 	    tl->t->e - tl->t->b,
 	    tl->t->e - tl->t->b, tl->t->b);
 	I(tl); sbuf_printf(tl->fc, "\tconst char *p;\n");
+	I(tl); sbuf_printf(tl->fc, "\n");
+	I(tl); sbuf_printf(tl->fc,
+	    "\tVRT_set_backend_name(backend, \"%*.*s\");\n",
+	    tl->t->e - tl->t->b,
+	    tl->t->e - tl->t->b, tl->t->b);
 	NextToken(tl);
 	ExpectErr(tl, '{');
 	NextToken(tl);

Modified: trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c	2006-06-22 16:17:10 UTC (rev 222)
+++ trunk/varnish-cache/lib/libvcl/vcl_fixed_token.c	2006-06-24 19:41:55 UTC (rev 223)
@@ -485,6 +485,7 @@
 	fputs("int VRT_obj_valid(struct sess *);\n", f);
 	fputs("int VRT_obj_cacheable(struct sess *);\n", f);
 	fputs("\n", f);
+	fputs("void VRT_set_backend_name(struct backend *, const char *);\n", f);
 	fputs("void VRT_set_backend_hostname(struct backend *, const char *);\n", f);
 	fputs("void VRT_set_backend_portname(struct backend *, const char *);\n", f);
 	fputs("\n", f);




More information about the varnish-commit mailing list