[master] 720986b Add new SLT_Link records to link request VXIDs to session VXIDs and backend VXIDs to request VXIDs.

Poul-Henning Kamp phk at varnish-cache.org
Tue Nov 20 11:09:28 CET 2012


commit 720986b3e445c5d72bc92e1adebdd6c8a3b72ce3
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Nov 20 10:08:40 2012 +0000

    Add new SLT_Link records to link request VXIDs to session VXIDs and
    backend VXIDs to request VXIDs.
    
    Still TBD: where ESI fits into this.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 1383ffb..727073b 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -760,7 +760,7 @@ double BAN_Time(const struct ban *ban);
 
 /* cache_busyobj.c */
 void VBO_Init(void);
-struct busyobj *VBO_GetBusyObj(struct worker *wrk);
+struct busyobj *VBO_GetBusyObj(struct worker *, const struct req *);
 void VBO_DerefBusyObj(struct worker *wrk, struct busyobj **busyobj);
 void VBO_Free(struct busyobj **vbo);
 
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index 014e564..17ec871 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -87,7 +87,7 @@ VBO_Free(struct busyobj **bop)
 }
 
 struct busyobj *
-VBO_GetBusyObj(struct worker *wrk)
+VBO_GetBusyObj(struct worker *wrk, const struct req *req)
 {
 	struct busyobj *bo = NULL;
 	uint16_t nhttp;
@@ -129,6 +129,7 @@ VBO_GetBusyObj(struct worker *wrk)
 	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_Link, "req %u", req->vsl->wid & VSL_IDENTMASK);
 	p += sz;
 	p = (void*)PRNDUP(p);
 	assert(p < bo->end);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index edd986c..0a209a8 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -267,7 +267,7 @@ cnt_error(struct worker *wrk, struct req *req)
 	AZ(req->obj);
 	AZ(req->busyobj);
 
-	bo = VBO_GetBusyObj(wrk);
+	bo = VBO_GetBusyObj(wrk, req);
 	req->busyobj = bo;
 	AZ(bo->stats);
 	bo->stats = &wrk->stats;
@@ -807,7 +807,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
 	/* If we inserted a new object it's a miss */
 	if (oc->flags & OC_F_BUSY) {
 		AZ(req->busyobj);
-		bo = VBO_GetBusyObj(wrk);
+		bo = VBO_GetBusyObj(wrk, req);
 		req->busyobj = bo;
 		/* One ref for req, one for FetchBody */
 		bo->refcount = 2;
@@ -943,7 +943,7 @@ cnt_pass(struct worker *wrk, struct req *req)
 	AZ(req->obj);
 	AZ(req->busyobj);
 
-	req->busyobj = VBO_GetBusyObj(wrk);
+	req->busyobj = VBO_GetBusyObj(wrk, req);
 	bo = req->busyobj;
 	bo->refcount = 2;
 	HTTP_Setup(bo->bereq, bo->ws, bo->vsl, HTTP_Bereq);
@@ -1002,7 +1002,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
 	AZ(req->busyobj);
 
 	req->acct_req.pipe++;
-	req->busyobj = VBO_GetBusyObj(wrk);
+	req->busyobj = VBO_GetBusyObj(wrk, req);
 	bo = req->busyobj;
 	HTTP_Setup(bo->bereq, bo->ws, bo->vsl, HTTP_Bereq);
 	http_FilterReq(req, 0);
@@ -1090,7 +1090,6 @@ cnt_recv(const struct worker *wrk, struct req *req)
 	AZ(req->obj);
 	AZ(req->busyobj);
 
-	/* Assign XID and log */
 	VSLb(req->vsl, SLT_ReqStart, "%s %s", req->sp->addr, req->sp->port);
 
 	if (req->err_code) {
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 5caf03f..5fae4dd 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -386,6 +386,7 @@ SES_GetReq(struct worker *wrk, struct sess *sp)
 	sz = cache_param->workspace_thread;
 	VSL_Setup(req->vsl, p, sz);
 	req->vsl->wid = VXID_Get(&wrk->vxid_pool) | VSL_CLIENTMARKER;
+	VSLb(req->vsl, SLT_Link, "sess %u", sp->vxid & VSL_IDENTMASK);
 	p += sz;
 	p = (void*)PRNDUP(p);
 
diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h
index 9d970e1..dd12f91 100644
--- a/include/tbl/vsl_tags.h
+++ b/include/tbl/vsl_tags.h
@@ -156,3 +156,11 @@ SLTM(VCL_Log, "Log statement from VCL", "")
 SLTM(VCL_Error, "", "")
 
 SLTM(Gzip, "G(un)zip performed on object", "")
+
+SLTM(Link, "Linkage between different VXIDs",
+	"Links this records VXID to its parent VXID\n"
+	"The first field gives the type of the parent:\n"
+	"    req     Request\n"
+	"    sess    Session\n"
+	"The second field gives the VXID if the parent.\n"
+)



More information about the varnish-commit mailing list