[master] 0f1d40cfa Introduce VCL_use SLT which tells us which VCL we're running in

Poul-Henning Kamp phk at FreeBSD.org
Mon Jan 14 11:22:08 UTC 2019


commit 0f1d40cfa05563ed36167d84804b936fb4a9cfba
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 14 11:19:47 2019 +0000

    Introduce VCL_use SLT which tells us which VCL we're running in

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 02ad2cc56..1e42d0201 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -896,6 +896,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
 
 	bo = VBO_GetBusyObj(wrk, req);
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	AN(bo->vcl);
 
 	boc = HSH_RefBoc(oc);
 	CHECK_OBJ_NOTNULL(boc, BOC_MAGIC);
@@ -917,6 +918,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
 	}
 
 	VSLb(bo->vsl, SLT_Begin, "bereq %u %s", VXID(req->vsl->wid), how);
+	VSLb(bo->vsl, SLT_VCL_use, "%s", VCL_Name(bo->vcl));
 	VSLb(req->vsl, SLT_Link, "bereq %u %s", VXID(bo->vsl->wid), how);
 
 	THR_SetBusyobj(bo);
@@ -924,8 +926,6 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
 	bo->sp = req->sp;
 	SES_Ref(bo->sp);
 
-	AN(bo->vcl);
-
 	oc->boc->vary = req->vary_b;
 	req->vary_b = NULL;
 
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index f5e6b16f7..f11fd96bf 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -1029,6 +1029,7 @@ CNT_Embark(struct worker *wrk, struct req *req)
 		VCL_Refresh(&wrk->vcl);
 		req->vcl = wrk->vcl;
 		wrk->vcl = NULL;
+		VSLb(req->vsl, SLT_VCL_use, "%s", VCL_Name(req->vcl));
 	}
 
 	AN(req->vcl);
diff --git a/bin/varnishd/cache/cache_vrt_vcl.c b/bin/varnishd/cache/cache_vrt_vcl.c
index 051d16c9f..bfd4effe6 100644
--- a/bin/varnishd/cache/cache_vrt_vcl.c
+++ b/bin/varnishd/cache/cache_vrt_vcl.c
@@ -344,8 +344,8 @@ VRT_vcl_select(VRT_CTX, VCL_VCL vcl)
 	VCL_TaskLeave(req->vcl, req->privs);
 	VCL_Rel(&req->vcl);
 	vcl_get(&req->vcl, vcl);
-	/* XXX: better logging */
-	VSLb(ctx->req->vsl, SLT_Debug, "Now using %s VCL", vcl->loaded_name);
+	VSLb(ctx->req->vsl, SLT_VCL_use, "%s via %s",
+	    req->vcl->loaded_name, vcl->loaded_name);
 	VCL_TaskEnter(req->vcl, req->privs);
 }
 
diff --git a/bin/varnishtest/tests/u00010.vtc b/bin/varnishtest/tests/u00010.vtc
index dd37a15d0..329f92567 100644
--- a/bin/varnishtest/tests/u00010.vtc
+++ b/bin/varnishtest/tests/u00010.vtc
@@ -20,7 +20,7 @@ client c1 {
 
 varnish v1 -vsl_catchup
 
-process p1 -expect-text 1 1 {list length 64}
+process p1 -expect-text 1 1 {list length 65}
 
 process p1 -writehex 0c
 
diff --git a/doc/sphinx/Makefile.am b/doc/sphinx/Makefile.am
index d9be207ac..0ff57bd96 100644
--- a/doc/sphinx/Makefile.am
+++ b/doc/sphinx/Makefile.am
@@ -192,7 +192,7 @@ include/varnishstat_synopsis.rst: $(top_builddir)/bin/varnishstat/varnishstat
 BUILT_SOURCES += include/varnishstat_options.rst \
 	 include/varnishstat_synopsis.rst
 
-include/vsl-tags.rst: $(top_builddir)/lib/libvarnishapi/vsl2rst
+include/vsl-tags.rst: $(top_builddir)/lib/libvarnishapi/vsl2rst 
 	$(top_builddir)/lib/libvarnishapi/vsl2rst > ${@}_
 	mv ${@}_ ${@}
 BUILT_SOURCES += include/vsl-tags.rst
diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h
index 49b27cf9b..cc02f18d4 100644
--- a/include/tbl/vsl_tags.h
+++ b/include/tbl/vsl_tags.h
@@ -642,6 +642,15 @@ SLTM(SessError, 0, "Client connection accept failed",
 	"\n"
 )
 
+SLTM(VCL_use, 0, "VCL in use",
+	"Records the name of the VCL being used.\n\n"
+	"The format is::\n\n"
+	"\t%s [via %s]\n"
+	"\t|       |\n"
+	"\t|       +- Name of label used to find it (optional)\n"
+	"\t+--------- Name of VCL put in use\n"
+)
+
 #undef NODEF_NOTICE
 #undef SLTM
 


More information about the varnish-commit mailing list