Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
15ee0c7c
Commit
15ee0c7c
authored
Jun 27, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement backend_fetch_response( return (retry); )
parent
a28ad1e0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
3 deletions
+69
-3
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+10
-1
params.h
bin/varnishd/common/params.h
+3
-0
mgt_param_tbl.c
bin/varnishd/mgt/mgt_param_tbl.c
+4
-0
c00056.vtc
bin/varnishtest/tests/c00056.vtc
+50
-0
v00017.vtc
bin/varnishtest/tests/v00017.vtc
+1
-1
generate.py
lib/libvcl/generate.py
+1
-1
No files found.
bin/varnishd/cache/cache_fetch.c
View file @
15ee0c7c
...
...
@@ -58,7 +58,8 @@ vbf_release_req(struct req ***reqpp)
*/
static
enum
fetch_step
vbf_stp_mkbereq
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
,
const
struct
req
*
req
)
vbf_stp_mkbereq
(
const
struct
worker
*
wrk
,
struct
busyobj
*
bo
,
const
struct
req
*
req
)
{
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
...
...
@@ -205,6 +206,14 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo, struct req ***reqpp)
if
(
wrk
->
handling
==
VCL_RET_DELIVER
)
return
(
F_STP_FETCH
);
if
(
wrk
->
handling
==
VCL_RET_RETRY
)
{
bo
->
retries
++
;
if
(
bo
->
retries
<=
cache_param
->
max_retries
)
{
VDI_CloseFd
(
&
bo
->
vbc
);
return
(
F_STP_STARTFETCH
);
}
// XXX: wrk->handling = VCL_RET_SYNTH;
}
return
(
F_STP_NOTYET
);
}
...
...
bin/varnishd/common/params.h
View file @
15ee0c7c
...
...
@@ -143,6 +143,9 @@ struct params {
/* Maximum restarts allowed */
unsigned
max_restarts
;
/* Maximum backend retriesallowed */
unsigned
max_retries
;
/* Maximum esi:include depth allowed */
unsigned
max_esi_depth
;
...
...
bin/varnishd/mgt/mgt_param_tbl.c
View file @
15ee0c7c
...
...
@@ -319,6 +319,10 @@ const struct parspec mgt_parspec[] = {
"the backend, so don't increase thoughtlessly.
\n
"
,
0
,
"4"
,
"restarts"
},
{
"max_retries"
,
tweak_uint
,
&
mgt_param
.
max_retries
,
0
,
UINT_MAX
,
"Upper limit on how many times a backend fetch can retry.
\n
"
,
0
,
"4"
,
"retries"
},
{
"esi_syntax"
,
tweak_uint
,
&
mgt_param
.
esi_syntax
,
0
,
UINT_MAX
,
"Bitmap controlling ESI parsing code:
\n
"
...
...
bin/varnishtest/tests/c00056.vtc
0 → 100644
View file @
15ee0c7c
varnishtest "vcl_backend_response{} retry"
server s1 {
rxreq
txresp -hdr "foo: 1"
accept
rxreq
txresp -hdr "foo: 2"
} -start
varnish v1 -vcl+backend {
sub vcl_recv { return (pass); }
sub vcl_backend_response {
set beresp.http.bar = bereq.retries;
if (beresp.http.foo != bereq.http.stop) {
return (retry);
}
}
} -start
varnish v1 -cliok "param.set debug +syncvsl"
client c1 {
txreq -hdr "stop: 2"
rxresp
expect resp.http.foo == 2
} -run
delay .1
server s1 {
rxreq
txresp -hdr "foo: 1"
accept
rxreq
txresp -hdr "foo: 2"
accept
rxreq
txresp -hdr "foo: 3"
} -start
varnish v1 -cliok "param.set max_retries 2"
client c1 {
txreq -hdr "stop: 3"
rxresp
expect resp.http.foo == 3
} -run
# XXX: Add a test which exceeds max_retries and gets 503 back
bin/varnishtest/tests/v00017.vtc
View file @
15ee0c7c
...
...
@@ -67,7 +67,7 @@ varnish v1 -vcl {
varnish v1 -vcl {
backend b { .host = "127.0.0.1"; }
sub vcl_recv { if (client.ip == "127.0.0.1") { return(pass); } }
sub vcl_backend_response { if (client.ip != "127.0.0.1") { return(re
start
); } }
sub vcl_backend_response { if (client.ip != "127.0.0.1") { return(re
try
); } }
}
varnish v1 -errvcl {Operator > not possible on IP} {
...
...
lib/libvcl/generate.py
View file @
15ee0c7c
...
...
@@ -86,7 +86,7 @@ returns =(
(
'miss'
,
"C"
,
(
'error'
,
'restart'
,
'pass'
,
'fetch'
,)),
(
'lookup'
,
"C"
,
(
'error'
,
'restart'
,
'pass'
,
'deliver'
,)),
(
'backend_fetch'
,
"B"
,
(
'fetch'
,
'abandon'
)),
(
'backend_response'
,
"B"
,
(
'deliver'
,
're
start'
,
'error
'
)),
(
'backend_response'
,
"B"
,
(
'deliver'
,
're
try'
,
'abandon
'
)),
(
'deliver'
,
"C"
,
(
'restart'
,
'deliver'
,)),
(
'error'
,
"C"
,
(
'restart'
,
'deliver'
,)),
(
'init'
,
""
,
(
'ok'
,)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment