Mailing List Archive

[master] ea640d472 expire: Add hits to EXP_Expired log statement
commit ea640d4720451f9747dcf55b9454454847fa1f02
Author: AlveElde <alve_elde@hotmail.com>
Date: Tue Jan 3 02:59:02 2023 +0100

expire: Add hits to EXP_Expired log statement

This makes it easier to estimate the popularity of expired objects.

diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 0392d191d..c179f94f8 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -354,8 +354,9 @@ exp_expire(struct exp_priv *ep, vtim_real now)
assert(oc->timer_idx == VBH_NOIDX);

CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
- VSLb(&ep->vsl, SLT_ExpKill, "EXP_Expired xid=%ju t=%.0f",
- VXID(ObjGetXID(ep->wrk, oc)), EXP_Ttl(NULL, oc) - now);
+ VSLb(&ep->vsl, SLT_ExpKill, "EXP_Expired x=%ju t=%.0f h=%ld",
+ VXID(ObjGetXID(ep->wrk, oc)), EXP_Ttl(NULL, oc) - now,
+ oc->hits);
ObjSendEvent(ep->wrk, oc, OEV_EXPIRE);
(void)HSH_DerefObjCore(ep->wrk, &oc, 0);
}
diff --git a/bin/varnishtest/tests/r02339.vtc b/bin/varnishtest/tests/r02339.vtc
index 60848137d..a19c22ce7 100644
--- a/bin/varnishtest/tests/r02339.vtc
+++ b/bin/varnishtest/tests/r02339.vtc
@@ -21,7 +21,7 @@ varnish v1 -vcl+backend {
varnish v1 -cliok "param.set timeout_idle 2"

logexpect l0 -v v1 -g raw {
- expect * 0 ExpKill "EXP_Expired xid=1002"
+ expect * 0 ExpKill "EXP_Expired x=1002"
} -start

logexpect l2 -v v1 -g raw {
@@ -109,4 +109,4 @@ varnish v1 -errvcl "Not available in subroutine 'vcl_backend_response'" {
sub vcl_backend_response {
if (bereq.url == "response") { purge.hard(); }
}
-}
\ No newline at end of file
+}
diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h
index ebcb3ac36..c65257dcc 100644
--- a/include/tbl/vsl_tags.h
+++ b/include/tbl/vsl_tags.h
@@ -367,7 +367,7 @@ SLTM(ExpKill, 0, "Object expiry event",
"\tEXP_Inbox p=%p e=%f f=0x%x\n"
"\tEXP_Kill p=%p e=%f f=0x%x\n"
"\tEXP_When p=%p e=%f f=0x%x\n"
- "\tEXP_Expired x=%u t=%f\n"
+ "\tEXP_Expired x=%u t=%f h=%u\n"
"\tLRU_Cand p=%p f=0x%x r=%d\n"
"\tLRU x=%u\n"
"\tLRU_Fail\n"
@@ -380,6 +380,7 @@ SLTM(ExpKill, 0, "Object expiry event",
"\tf=0x%x Objcore flags\n"
"\tr=%d Objcore refcount\n"
"\tx=%u Object VXID\n"
+ "\th=%u Objcore hits\n"
"\n"
)

diff --git a/vmod/tests/purge_c00000.vtc b/vmod/tests/purge_c00000.vtc
index 8cf199a12..267f4b882 100644
--- a/vmod/tests/purge_c00000.vtc
+++ b/vmod/tests/purge_c00000.vtc
@@ -68,7 +68,7 @@ logexpect l2 -v v1 -q "Begin ~ bgfetch" {
} -start

logexpect l3 -v v1 -g raw -q "vxid == 0" {
- expect * * ExpKill xid=1008
+ expect * * ExpKill x=1008
} -start

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