[master] 1199d24 Give SLT_Begin and SLT_Link a third field "why", and normalise the first field to the type of entity.

Poul-Henning Kamp phk at FreeBSD.org
Tue Jan 7 14:55:22 CET 2014


commit 1199d2419382943603ed0b8c2e4eaa204f785468
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jan 7 13:53:45 2014 +0000

    Give SLT_Begin and SLT_Link a third field "why", and normalise the
    first field to the type of entity.
    
    Martin will commit corresponding and necessary changes to the
    API in a matter of milliseconds or possibly hours or days, so
    minor weirdness from varnishlog/ncsa can be expected for a brief
    amount of time.
    
    Testcase l00000 & l00001 are also broken until the API catches up.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 2fe14f3..58c1b3c 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -844,7 +844,7 @@ double BAN_Time(const struct ban *ban);
 
 /* cache_busyobj.c */
 void VBO_Init(void);
-struct busyobj *VBO_GetBusyObj(struct worker *, struct req *);
+struct busyobj *VBO_GetBusyObj(struct worker *, const struct req *);
 void VBO_DerefBusyObj(struct worker *wrk, struct busyobj **busyobj);
 void VBO_Free(struct busyobj **vbo);
 void VBO_extend(struct busyobj *, ssize_t);
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index 5519168..2466404 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -89,7 +89,7 @@ VBO_Free(struct busyobj **bop)
 }
 
 struct busyobj *
-VBO_GetBusyObj(struct worker *wrk, struct req *req)
+VBO_GetBusyObj(struct worker *wrk, const struct req *req)
 {
 	struct busyobj *bo = NULL;
 	uint16_t nhttp;
@@ -136,8 +136,6 @@ VBO_GetBusyObj(struct worker *wrk, struct req *req)
 	sz = cache_param->vsl_buffer;
 	VSL_Setup(bo->vsl, p, sz);
 	bo->vsl->wid = VXID_Get(&wrk->vxid_pool) | VSL_BACKENDMARKER;
-	VSLb(bo->vsl, SLT_Begin, "bereq %u", req->vsl->wid & VSL_IDENTMASK);
-	VSLb(req->vsl, SLT_Link, "bereq %u", bo->vsl->wid & VSL_IDENTMASK);
 	p += sz;
 	p = (void*)PRNDUP(p);
 	assert(p < bo->end);
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 76fc1c5..a2904c8 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -61,8 +61,8 @@ ved_include(struct req *preq, const char *src, const char *host)
 
 	req = SES_GetReq(wrk, preq->sp);
 	req->req_body_status = REQ_BODY_NONE;
-	VSLb(req->vsl, SLT_Begin, "esireq %u", preq->vsl->wid & VSL_IDENTMASK);
-	VSLb(preq->vsl, SLT_Link, "esireq %u", req->vsl->wid & VSL_IDENTMASK);
+	VSLb(req->vsl, SLT_Begin, "req %u esi", preq->vsl->wid & VSL_IDENTMASK);
+	VSLb(preq->vsl, SLT_Link, "req %u esi", req->vsl->wid & VSL_IDENTMASK);
 	req->esi_level = preq->esi_level + 1;
 
 	HTTP_Copy(req->http0, preq->http0);
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 3a00269..f261f70 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -724,6 +724,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
     struct object *oldobj, enum vbf_fetch_mode_e mode)
 {
 	struct busyobj *bo;
+	const char *how;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
@@ -732,6 +733,19 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
 
 	bo = VBO_GetBusyObj(wrk, req);
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+
+	switch(mode) {
+	case VBF_PASS:		how = "pass"; break;
+	case VBF_NORMAL:	how = "fetch"; break;
+	case VBF_BACKGROUND:	how = "bgfetch"; break;
+	default:		WRONG("Wrong fetch mode");
+	}
+
+	VSLb(bo->vsl, SLT_Begin, "bereq %u %s ",
+	    req->vsl->wid & VSL_IDENTMASK, how);
+	VSLb(req->vsl, SLT_Link, "bereq %u %s ",
+	    bo->vsl->wid & VSL_IDENTMASK, how);
+
 	bo->refcount = 2;
 
 	oc->busyobj = bo;
diff --git a/bin/varnishd/cache/cache_http1_fsm.c b/bin/varnishd/cache/cache_http1_fsm.c
index c1564be..7818260 100644
--- a/bin/varnishd/cache/cache_http1_fsm.c
+++ b/bin/varnishd/cache/cache_http1_fsm.c
@@ -286,9 +286,9 @@ http1_dissect(struct worker *wrk, struct req *req)
 	 */
 	if (req->vsl->wid == 0) {
 		req->vsl->wid = VXID_Get(&wrk->vxid_pool) | VSL_CLIENTMARKER;
-		VSLb(req->vsl, SLT_Begin, "req %u",
+		VSLb(req->vsl, SLT_Begin, "req %u rxreq",
 		    req->sp->vxid & VSL_IDENTMASK);
-		VSL(SLT_Link, req->sp->vxid, "req %u",
+		VSL(SLT_Link, req->sp->vxid, "req %u rxreq",
 		    req->vsl->wid & VSL_IDENTMASK);
 	}
 
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 048bcc3..92aeb19 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -642,12 +642,12 @@ cnt_restart(struct worker *wrk, struct req *req)
 	} else {
 		wid = VXID_Get(&wrk->vxid_pool);
 		// XXX: ReqEnd + ReqAcct ?
-		VSLb(req->vsl, SLT_Link, "req %u", wid);
+		VSLb(req->vsl, SLT_Link, "req %u restart", wid);
 		VSLb(req->vsl, SLT_End, "");
 		VSL_Flush(req->vsl, 0);
 		owid = req->vsl->wid & VSL_IDENTMASK;
 		req->vsl->wid = wid | VSL_CLIENTMARKER;
-		VSLb(req->vsl, SLT_Begin, "req %u", owid);
+		VSLb(req->vsl, SLT_Begin, "req %u restart", owid);
 		
 		req->err_code = 0;
 		req->req_step = R_STP_RECV;
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 7b38cef..83ed4cd 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -197,7 +197,7 @@ ses_vsl_socket(struct sess *sp, const char *lsockname)
 	sp->client_port_str = WS_Copy(sp->ws, lport, -1);
 	VTCP_name(sess_local_addr(sp), laddr, sizeof laddr,
 	    lport, sizeof lport);
-	VSL(SLT_Begin, sp->vxid, "sess");
+	VSL(SLT_Begin, sp->vxid, "sess 0 HTTP/1");
 	VSL(SLT_SessOpen, sp->vxid, "%s %s %s %s %s %.6f %d",
 	    sp->client_addr_str, sp->client_port_str, lsockname, laddr, lport,
 	    sp->t_open, sp->fd);
@@ -389,8 +389,9 @@ SES_GetReq(struct worker *wrk, struct sess *sp)
 	sz = cache_param->vsl_buffer;
 	VSL_Setup(req->vsl, p, sz);
 	req->vsl->wid = VXID_Get(&wrk->vxid_pool) | VSL_CLIENTMARKER;
-	VSLb(req->vsl, SLT_Begin, "req %u", sp->vxid & VSL_IDENTMASK);
-	VSL(SLT_Link, req->sp->vxid, "req %u", req->vsl->wid & VSL_IDENTMASK);
+	VSLb(req->vsl, SLT_Begin, "req %u rxreq", sp->vxid & VSL_IDENTMASK);
+	VSL(SLT_Link, req->sp->vxid, "req %u rxreq",
+	    req->vsl->wid & VSL_IDENTMASK);
 	p += sz;
 	p = (void*)PRNDUP(p);
 



More information about the varnish-commit mailing list