Commit 8b3a3007 authored by Kristian Lyngstøl's avatar Kristian Lyngstøl

Revert the return(refresh) patches

(better approach coming soon-ish)



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5078 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 2e979c25
...@@ -830,11 +830,6 @@ cnt_lookup(struct sess *sp) ...@@ -830,11 +830,6 @@ cnt_lookup(struct sess *sp)
return (0); return (0);
} }
static int
cnt_refresh(struct sess *sp)
{
return cnt_lookup(sp);
}
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* We had a miss, ask VCL, proceed as instructed * We had a miss, ask VCL, proceed as instructed
* *
...@@ -1070,9 +1065,6 @@ cnt_recv(struct sess *sp) ...@@ -1070,9 +1065,6 @@ cnt_recv(struct sess *sp)
/* XXX: discard req body, if any */ /* XXX: discard req body, if any */
sp->step = STP_LOOKUP; sp->step = STP_LOOKUP;
return (0); return (0);
case VCL_RET_REFRESH:
sp->step = STP_REFRESH;
return (0);
case VCL_RET_PIPE: case VCL_RET_PIPE:
if (sp->esis > 0) { if (sp->esis > 0) {
/* XXX: VSL something */ /* XXX: VSL something */
...@@ -1217,7 +1209,6 @@ CNT_Session(struct sess *sp) ...@@ -1217,7 +1209,6 @@ CNT_Session(struct sess *sp)
sp->step == STP_FIRST || sp->step == STP_FIRST ||
sp->step == STP_START || sp->step == STP_START ||
sp->step == STP_LOOKUP || sp->step == STP_LOOKUP ||
sp->step == STP_REFRESH ||
sp->step == STP_RECV); sp->step == STP_RECV);
/* /*
......
...@@ -402,8 +402,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh) ...@@ -402,8 +402,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
if (oc == NULL /* We found no live object */ if (oc == NULL /* We found no live object */
&& grace_oc != NULL /* There is a grace candidate */ && grace_oc != NULL /* There is a grace candidate */
&& (busy_oc != NULL /* Somebody else is already busy */ && (busy_oc != NULL /* Somebody else is already busy */
|| !VBE_Healthy(sp->t_req, sp->director, (uintptr_t)oh)) || !VBE_Healthy(sp->t_req, sp->director, (uintptr_t)oh))) {
&& sp->step != STP_REFRESH) {
/* Or it is impossible to fetch: */ /* Or it is impossible to fetch: */
o = grace_oc->obj; o = grace_oc->obj;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
...@@ -415,24 +414,16 @@ HSH_Lookup(struct sess *sp, struct objhead **poh) ...@@ -415,24 +414,16 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
o = oc->obj; o = oc->obj;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
assert(oc->objhead == oh); assert(oc->objhead == oh);
if (sp->step == STP_REFRESH) {
if (o->ttl >= sp->t_req) { /* We found an object we like */
o->ttl = sp->t_req - 1; oc->refcnt++;
o->grace = HSH_Grace(sp->grace); if (o->hits < INT_MAX)
EXP_Rearm(o); o->hits++;
} assert(oh->refcnt > 1);
o = NULL; Lck_Unlock(&oh->mtx);
} else { assert(hash->deref(oh));
/* We found an object we like */ *poh = oh;
oc->refcnt++; return (oc);
if (o->hits < INT_MAX)
o->hits++;
assert(oh->refcnt > 1);
Lck_Unlock(&oh->mtx);
assert(hash->deref(oh));
*poh = oh;
return (oc);
}
} }
if (busy_oc != NULL) { if (busy_oc != NULL) {
......
...@@ -36,7 +36,6 @@ STEP(start, START) ...@@ -36,7 +36,6 @@ STEP(start, START)
STEP(pipe, PIPE) STEP(pipe, PIPE)
STEP(pass, PASS) STEP(pass, PASS)
STEP(lookup, LOOKUP) STEP(lookup, LOOKUP)
STEP(refresh, REFRESH)
STEP(miss, MISS) STEP(miss, MISS)
STEP(hit, HIT) STEP(hit, HIT)
STEP(fetch, FETCH) STEP(fetch, FETCH)
......
# $Id: c00024.vtc 4651 2010-04-08 16:21:16Z phk $
test "Test return(refresh) in vcl_recv"
server s1 {
rxreq
txresp -hdr "Inc: 1"
rxreq
txresp -hdr "Inc: 2"
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.http.x-refresh == "1") {
return(refresh);
}
}
} -start
client c1 {
txreq -url "/"
rxresp
expect resp.status == 200
expect resp.http.Inc == "1"
txreq -url "/"
rxresp
expect resp.status == 200
expect resp.http.Inc == "1"
txreq -url "/" -hdr "x-refresh: 1"
rxresp
expect resp.status == 200
expect resp.http.Inc == "2"
txreq -url "/"
rxresp
expect resp.status == 200
expect resp.http.Inc == "2"
} -run
...@@ -310,11 +310,6 @@ vcl_recv ...@@ -310,11 +310,6 @@ vcl_recv
pipe pipe
Switch to pipe mode. Control will eventually pass to vcl_pipe. Switch to pipe mode. Control will eventually pass to vcl_pipe.
refresh
Go through normal caching channels, but guarantee a cache miss even if
there is valid content in the cache, thereby performing a controlled
refresh of the content.
lookup lookup
Look up the requested object in the cache. Control will Look up the requested object in the cache. Control will
eventually pass to vcl_hit or vcl_miss, depending on whether the eventually pass to vcl_hit or vcl_miss, depending on whether the
......
...@@ -84,7 +84,7 @@ tokens = { ...@@ -84,7 +84,7 @@ tokens = {
# Our methods and actions # Our methods and actions
returns =( returns =(
('recv', ('error', 'pass', 'pipe', 'refresh','lookup',)), ('recv', ('error', 'pass', 'pipe', 'lookup',)),
('pipe', ('error', 'pipe',)), ('pipe', ('error', 'pipe',)),
('pass', ('error', 'restart', 'pass',)), ('pass', ('error', 'restart', 'pass',)),
('hash', ('hash',)), ('hash', ('hash',)),
......
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