Commit ed4ed27f authored by Nils Goroll's avatar Nils Goroll

Introduce HSH_HITPASS and HSH_HITMISS and clarify grace/keep HSH_HITMISS

parent 9cb08c1d
...@@ -444,14 +444,14 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp, ...@@ -444,14 +444,14 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
VSLb(req->vsl, SLT_HitPass, "%u %.6f", VSLb(req->vsl, SLT_HitPass, "%u %.6f",
ObjGetXID(wrk, oc), EXP_Dttl(req, oc)); ObjGetXID(wrk, oc), EXP_Dttl(req, oc));
oc = NULL; oc = NULL;
retval = HSH_MISS; retval = HSH_HITPASS;
} else if (oc->flags & OC_F_HFM) { } else if (oc->flags & OC_F_HFM) {
wrk->stats->cache_hitmiss++; wrk->stats->cache_hitmiss++;
VSLb(req->vsl, SLT_HitMiss, "%u %.6f", VSLb(req->vsl, SLT_HitMiss, "%u %.6f",
ObjGetXID(wrk, oc), EXP_Dttl(req, oc)); ObjGetXID(wrk, oc), EXP_Dttl(req, oc));
*bocp = hsh_insert_busyobj(wrk, oh); *bocp = hsh_insert_busyobj(wrk, oh);
oc->refcnt++; oc->refcnt++;
retval = HSH_MISS; retval = HSH_HITMISS;
} else { } else {
oc->refcnt++; oc->refcnt++;
if (oc->hits < LONG_MAX) if (oc->hits < LONG_MAX)
...@@ -473,11 +473,17 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp, ...@@ -473,11 +473,17 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
} }
if (exp_oc != NULL && exp_oc->flags & OC_F_HFM) { if (exp_oc != NULL && exp_oc->flags & OC_F_HFM) {
/*
* expired HFM ("grace/keep HFM")
*
* XXX should HFM objects actually have grace/keep ?
*/
wrk->stats->cache_hitmiss++; wrk->stats->cache_hitmiss++;
VSLb(req->vsl, SLT_HitMiss, "%u %.6f", ObjGetXID(wrk, exp_oc), VSLb(req->vsl, SLT_HitMiss, "%u %.6f", ObjGetXID(wrk, exp_oc),
EXP_Dttl(req, exp_oc)); EXP_Dttl(req, exp_oc));
exp_oc = NULL; *bocp = hsh_insert_busyobj(wrk, oh);
busy_found = 0; Lck_Unlock(&oh->mtx);
return (HSH_HITMISS);
} }
if (!busy_found) { if (!busy_found) {
......
...@@ -503,21 +503,23 @@ cnt_lookup(struct worker *wrk, struct req *req) ...@@ -503,21 +503,23 @@ cnt_lookup(struct worker *wrk, struct req *req)
} }
AZ(req->objcore); AZ(req->objcore);
if (lr == HSH_MISS) { if (lr == HSH_MISS || lr == HSH_HITMISS) {
if (busy != NULL) { AN(busy);
/* hitmiss, out-of-grace or ordinary miss */ AN(busy->flags & OC_F_BUSY);
AN(busy->flags & OC_F_BUSY); req->objcore = busy;
req->objcore = busy; req->stale_oc = oc;
req->stale_oc = oc; req->req_step = R_STP_MISS;
req->req_step = R_STP_MISS; return (REQ_FSM_MORE);
} else { }
/* hitpass */ if (lr == HSH_HITPASS) {
AZ(oc); AZ(busy);
req->req_step = R_STP_PASS; AZ(oc);
} req->req_step = R_STP_PASS;
return (REQ_FSM_MORE); return (REQ_FSM_MORE);
} }
assert(lr == HSH_HIT || lr == HSH_GRACE);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
AZ(oc->flags & OC_F_BUSY); AZ(oc->flags & OC_F_BUSY);
req->objcore = oc; req->objcore = oc;
......
...@@ -53,6 +53,8 @@ enum lookup_e { ...@@ -53,6 +53,8 @@ enum lookup_e {
HSH_MISS, HSH_MISS,
HSH_BUSY, HSH_BUSY,
HSH_HIT, HSH_HIT,
HSH_HITMISS,
HSH_HITPASS,
HSH_GRACE HSH_GRACE
}; };
......
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