Commit 241be56b authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

expire: New MAIN.n_superseded counter

parent e8264aaf
......@@ -149,12 +149,16 @@ EXP_RefNewObjcore(struct objcore *oc)
*/
void
EXP_Remove(struct objcore *oc)
EXP_Remove(struct objcore *oc, const struct objcore *new_oc)
{
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
CHECK_OBJ_ORNULL(new_oc, OBJCORE_MAGIC);
if (oc->exp_flags & OC_EF_REFD) {
Lck_Lock(&exphdl->mtx);
if (new_oc != NULL)
VSC_C_main->n_superseded++;
if (oc->exp_flags & OC_EF_NEW) {
/* EXP_Insert has not been called for this object
* yet. Mark it for removal, and EXP_Insert will
......
......@@ -453,7 +453,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp)
if (BAN_CheckObject(wrk, oc, req)) {
oc->flags |= OC_F_DYING;
EXP_Remove(oc);
EXP_Remove(oc, NULL);
continue;
}
......@@ -743,7 +743,7 @@ HSH_Purge(struct worker *wrk, struct objhead *oh, vtim_real ttl_now,
for (i = 0; i < j; i++) {
CHECK_OBJ_NOTNULL(ocp[i], OBJCORE_MAGIC);
if (is_purge)
EXP_Remove(ocp[i]);
EXP_Remove(ocp[i], NULL);
else
EXP_Rearm(ocp[i], ttl_now, ttl, grace, keep);
(void)HSH_DerefObjCore(wrk, &ocp[i], 0);
......@@ -919,7 +919,7 @@ HSH_Kill(struct objcore *oc)
Lck_Lock(&oc->objhead->mtx);
oc->flags |= OC_F_DYING;
Lck_Unlock(&oc->objhead->mtx);
EXP_Remove(oc);
EXP_Remove(oc, NULL);
}
/*====================================================================
......@@ -946,7 +946,7 @@ HSH_Snipe(const struct worker *wrk, struct objcore *oc)
Lck_Unlock(&oc->objhead->mtx);
}
if (retval)
EXP_Remove(oc);
EXP_Remove(oc, NULL);
return (retval);
}
......
......@@ -207,7 +207,7 @@ vtim_real EXP_Ttl(const struct req *, const struct objcore *);
vtim_real EXP_Ttl_grace(const struct req *, const struct objcore *oc);
void EXP_RefNewObjcore(struct objcore *);
void EXP_Insert(struct worker *wrk, struct objcore *oc);
void EXP_Remove(struct objcore *);
void EXP_Remove(struct objcore *, const struct objcore *);
#define EXP_Dttl(req, oc) (oc->ttl - (req->t_req - oc->t_origin))
......
......@@ -397,6 +397,12 @@
Number of objects that expired from cache because of old age.
.. varnish_vsc:: n_superseded
:level: diag
:oneliner: Number of superseded objects
Number of times an object was superseded by a new one.
.. varnish_vsc:: n_lru_nuked
:oneliner: Number of LRU nuked objects
......
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