Commit 70923dc0 authored by Geoff Simmons's avatar Geoff Simmons

Add SLT tag HitMiss to log hits on hit-for-miss objects.

parent f464a94c
......@@ -443,6 +443,8 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
oc = NULL;
} else if (oc->flags & OC_F_PASS) {
wrk->stats->cache_hitmiss++;
VSLb(req->vsl, SLT_HitMiss, "%u",
ObjGetXID(wrk, oc));
oc = NULL;
*bocp = hsh_insert_busyobj(wrk, oh);
} else {
......@@ -466,6 +468,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
if (exp_oc != NULL && exp_oc->flags & OC_F_PASS) {
wrk->stats->cache_hitmiss++;
VSLb(req->vsl, SLT_HitMiss, "%u", ObjGetXID(wrk, exp_oc));
exp_oc = NULL;
busy_found = 0;
}
......
varnishtest "Test hit for pass (pass from fetch)"
varnishtest "Test hit for miss (beresp.uncacheable = true)"
server s1 {
rxreq
......@@ -22,6 +22,10 @@ varnish v1 -vcl+backend {
}
} -start
logexpect l1 -v v1 -g vxid {
expect 1003 * HitMiss "^1002$"
} -start
client c1 {
txreq -url "/foo"
rxresp
......@@ -49,3 +53,5 @@ client c1 {
}
client c1 -run
logexpect l1 -wait
......@@ -22,6 +22,11 @@ varnish v1 -vcl+backend {
}
} -start
# Tests logging hit-for-miss on an expired object
logexpect l1 -v v1 -g vxid {
expect 1003 * HitMiss "^1002$"
} -start
client c1 {
txreq
rxresp
......@@ -36,3 +41,4 @@ client c1 {
expect resp.body == "bar"
} -run
logexpect l1 -wait
......@@ -541,6 +541,11 @@ SLTM(H2TxBody, 0, "Transmitted HTTP2 frame body",
"Binary data"
)
SLTM(HitMiss, 0, "Hit for miss object in cache.",
"Hit-for-miss object looked up in cache. Shows the VXID of the"
" hit-for-miss object.\n\n"
)
#undef NODEF_NOTICE
#undef SLTM
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment