Mailing List Archive

[master] 060175fec Add connection reuse status to BackendOpen and BackendClose
commit 060175fec8856ea598e8ecf9d48d719ecad97e00
Author: Reza Naghibi <reza@naghibi.com>
Date: Wed Jun 10 08:52:19 2020 -0400

Add connection reuse status to BackendOpen and BackendClose

diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index fb289c7a1..4eb18b8b9 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -202,8 +202,9 @@ vbe_dir_getfd(VRT_CTX, struct worker *wrk, struct backend *bp,

PFD_LocalName(pfd, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1);
PFD_RemoteName(pfd, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2);
- VSLb(bo->vsl, SLT_BackendOpen, "%d %s %s %s %s %s",
- *fdp, VRT_BACKEND_string(bp->director), abuf2, pbuf2, abuf1, pbuf1);
+ VSLb(bo->vsl, SLT_BackendOpen, "%d %s %s %s %s %s %s",
+ *fdp, VRT_BACKEND_string(bp->director), abuf2, pbuf2, abuf1, pbuf1,
+ PFD_State(pfd) == PFD_STATE_STOLEN ? "reuse" : "connect");

INIT_OBJ(bo->htc, HTTP_CONN_MAGIC);
bo->htc->priv = pfd;
@@ -235,14 +236,14 @@ vbe_dir_finish(VRT_CTX, VCL_BACKEND d)
assert(bo->htc->doclose == SC_TX_PIPE ||
bo->htc->doclose == SC_RX_TIMEOUT);
if (bo->htc->doclose != SC_NULL || bp->proxy_header != 0) {
- VSLb(bo->vsl, SLT_BackendClose, "%d %s", *PFD_Fd(pfd),
+ VSLb(bo->vsl, SLT_BackendClose, "%d %s close", *PFD_Fd(pfd),
VRT_BACKEND_string(bp->director));
VTP_Close(&pfd);
AZ(pfd);
Lck_Lock(&bp->mtx);
} else {
assert (PFD_State(pfd) == PFD_STATE_USED);
- VSLb(bo->vsl, SLT_BackendClose, "%d %s", *PFD_Fd(pfd),
+ VSLb(bo->vsl, SLT_BackendClose, "%d %s recycle", *PFD_Fd(pfd),
VRT_BACKEND_string(bp->director));
Lck_Lock(&bp->mtx);
VSC_C_main->backend_recycle++;
diff --git a/bin/varnishtest/tests/b00060.vtc b/bin/varnishtest/tests/b00060.vtc
index 959e765d6..a8bfba950 100644
--- a/bin/varnishtest/tests/b00060.vtc
+++ b/bin/varnishtest/tests/b00060.vtc
@@ -24,5 +24,5 @@ logexpect l2 -v v1 -d 1 -g vxid {

logexpect l3 -v v1 -d 1 -g vxid {
expect * * Begin ^bereq
- expect * = BackendOpen "0.0.0.0 0 0.0.0.0 0$"
+ expect * = BackendOpen "0.0.0.0 0 0.0.0.0 0 connect$"
} -run
diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h
index bebfa738b..ceb7ff917 100644
--- a/include/tbl/vsl_tags.h
+++ b/include/tbl/vsl_tags.h
@@ -106,14 +106,15 @@ SLTM(SessClose, 0, "Client connection closed",
SLTM(BackendOpen, 0, "Backend connection opened",
"Logged when a new backend connection is opened.\n\n"
"The format is::\n\n"
- "\t%d %s %s %s %s %s\n"
- "\t| | | | | |\n"
- "\t| | | | | +- Local port\n"
- "\t| | | | +---- Local address\n"
- "\t| | | +------- Remote port\n"
- "\t| | +---------- Remote address\n"
- "\t| +------------- Backend display name\n"
- "\t+---------------- Connection file descriptor\n"
+ "\t%d %s %s %s %s %s %s\n"
+ "\t| | | | | | |\n"
+ "\t| | | | | | +- \"connect\" or \"reuse\"\n"
+ "\t| | | | | +---- Local port\n"
+ "\t| | | | +------- Local address\n"
+ "\t| | | +---------- Remote port\n"
+ "\t| | +------------- Remote address\n"
+ "\t| +---------------- Backend display name\n"
+ "\t+------------------- Connection file descriptor\n"
"\n"
)

@@ -132,11 +133,12 @@ SLTM(BackendReuse, 0, "Backend connection put up for reuse",
SLTM(BackendClose, 0, "Backend connection closed",
"Logged when a backend connection is closed.\n\n"
"The format is::\n\n"
- "\t%d %s [ %s ]\n"
- "\t| | |\n"
- "\t| | +- Optional reason\n"
- "\t| +------ Backend display name\n"
- "\t+--------- Connection file descriptor\n"
+ "\t%d %s %s [ %s ]\n"
+ "\t| | | |\n"
+ "\t| | | +- Optional reason\n"
+ "\t| | +------ \"close\" or \"recycle\"\n"
+ "\t| +--------- Backend display name\n"
+ "\t+------------ Connection file descriptor\n"
"\n"
)

_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit