Commit 31726a95 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

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



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@223 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 614113cf
......@@ -104,6 +104,7 @@ struct sess {
};
struct backend {
const char *vcl_name;
const char *hostname;
const char *portname;
unsigned ip;
......
......@@ -204,7 +204,7 @@ FetchSession(struct worker *w, struct sess *sp)
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);
......
......@@ -110,23 +110,19 @@ CacheWorker(void *priv)
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;
......
......@@ -212,15 +212,11 @@ CheckHandling(struct sess *sp, const char *func, unsigned bitmap)
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 @@ VCL_##func##_method(struct sess *sp) \
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)
......
......@@ -102,6 +102,12 @@ VRT_set_backend_portname(struct backend *be, const char *p)
be->portname = p;
}
void
VRT_set_backend_name(struct backend *be, const char *p)
{
be->vcl_name = p;
}
void
VRT_alloc_backends(struct VCL_conf *cp)
{
......
......@@ -7,6 +7,7 @@
*/
SLTM(Debug)
SLTM(Error)
SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionReuse)
......@@ -16,7 +17,12 @@ SLTM(BackendReuse)
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)
......
......@@ -40,6 +40,7 @@ void VRT_handling(struct sess *sp, unsigned hand);
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 *);
......
......@@ -42,8 +42,8 @@
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <sbuf.h>
#include <stdio.h>
#include <sbuf.h>
#include <stdlib.h>
#include <string.h>
#include <queue.h>
......@@ -1241,6 +1241,11 @@ Backend(struct tokenlist *tl)
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);
......
......@@ -485,6 +485,7 @@ vcl_output_lang_h(FILE *f)
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment