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
06df39d4
Commit
06df39d4
authored
Aug 13, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ever so slightly closer to The New World Order
parent
eac60c98
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
65 deletions
+48
-65
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+41
-54
default.vcl
bin/varnishd/default.vcl
+6
-10
generate.py
lib/libvcl/generate.py
+1
-1
No files found.
bin/varnishd/cache/cache_req_fsm.c
View file @
06df39d4
...
@@ -397,7 +397,7 @@ DOT label="{<top>cnt_lookup:|hash lookup|{<busy>busy?|<e>exp?|<eb>expbusy?|<h>h
...
@@ -397,7 +397,7 @@ DOT label="{<top>cnt_lookup:|hash lookup|{<busy>busy?|<e>exp?|<eb>expbusy?|<h>h
DOT ]
DOT ]
DOT lookup2 [
DOT lookup2 [
DOT shape=record
DOT shape=record
DOT label="{<top>cnt_lookup:|{vcl_lookup\{\}|{
xx|xx
}}}"
DOT label="{<top>cnt_lookup:|{vcl_lookup\{\}|{
req.*|obj.*|obj_stale.*
}}}"
DOT ]
DOT ]
DOT }
DOT }
DOT lookup:busy:w -> lookup:top:w [label="(waitinglist)"]
DOT lookup:busy:w -> lookup:top:w [label="(waitinglist)"]
...
@@ -440,10 +440,12 @@ cnt_lookup(struct worker *wrk, struct req *req)
...
@@ -440,10 +440,12 @@ cnt_lookup(struct worker *wrk, struct req *req)
return
(
REQ_FSM_DISEMBARK
);
return
(
REQ_FSM_DISEMBARK
);
}
}
if
(
boc
==
NULL
)
if
(
boc
==
NULL
)
{
VRY_Finish
(
req
,
DISCARD
);
VRY_Finish
(
req
,
DISCARD
);
else
}
else
{
AN
(
boc
->
flags
&
OC_F_BUSY
);
VRY_Finish
(
req
,
KEEP
);
VRY_Finish
(
req
,
KEEP
);
}
AZ
(
req
->
objcore
);
AZ
(
req
->
objcore
);
if
(
lr
==
HSH_MISS
)
{
if
(
lr
==
HSH_MISS
)
{
...
@@ -473,41 +475,6 @@ cnt_lookup(struct worker *wrk, struct req *req)
...
@@ -473,41 +475,6 @@ cnt_lookup(struct worker *wrk, struct req *req)
return
(
REQ_FSM_MORE
);
return
(
REQ_FSM_MORE
);
}
}
if
(
boc
!=
NULL
)
AN
(
boc
->
flags
&
OC_F_BUSY
);
switch
(
lr
)
{
case
HSH_EXP
:
/* Found expired object, and a busy already exists too */
VSLb
(
req
->
vsl
,
SLT_Debug
,
"XXXX EXP
\n
"
);
AZ
(
boc
);
break
;
case
HSH_EXPBUSY
:
/* Found expired object, inserted busy objcore */
VSLb
(
req
->
vsl
,
SLT_Debug
,
"XXXX EXPBUSY
\n
"
);
AN
(
boc
);
if
(
VDI_Healthy
(
req
->
director
,
req
->
digest
))
{
VSLb
(
req
->
vsl
,
SLT_Debug
,
"XXX EXPBUSY deref oc
\n
"
);
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
oc
,
NULL
);
req
->
objcore
=
boc
;
req
->
req_step
=
R_STP_MISS
;
return
(
REQ_FSM_MORE
);
}
VSLb
(
req
->
vsl
,
SLT_Debug
,
"XXX EXPBUSY drop boc
\n
"
);
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
boc
,
NULL
);
boc
=
NULL
;
free
(
req
->
vary_b
);
req
->
vary_b
=
NULL
;
break
;
case
HSH_HIT
:
/* Found hit */
VSLb
(
req
->
vsl
,
SLT_Debug
,
"XXXX HIT
\n
"
);
AZ
(
boc
);
break
;
default:
INCOMPL
();
}
oh
=
oc
->
objhead
;
oh
=
oc
->
objhead
;
CHECK_OBJ_NOTNULL
(
oh
,
OBJHEAD_MAGIC
);
CHECK_OBJ_NOTNULL
(
oh
,
OBJHEAD_MAGIC
);
...
@@ -518,36 +485,56 @@ cnt_lookup(struct worker *wrk, struct req *req)
...
@@ -518,36 +485,56 @@ cnt_lookup(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
req
->
obj
=
o
;
req
->
obj
=
o
;
wrk
->
stats
.
cache_hit
++
;
VSLb
(
req
->
vsl
,
SLT_Hit
,
"%u"
,
req
->
obj
->
vxid
);
VSLb
(
req
->
vsl
,
SLT_Hit
,
"%u"
,
req
->
obj
->
vxid
);
VCL_lookup_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
VCL_lookup_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
if
(
wrk
->
handling
==
VCL_RET_DELIVER
)
{
switch
(
wrk
->
handling
)
{
//AZ(req->busyobj->bereq->ws);
case
VCL_RET_DELIVER
:
//AZ(req->busyobj->beresp->ws);
if
(
boc
!=
NULL
&&
VDI_Healthy
(
req
->
director
,
req
->
digest
))
{
// XXX: Start bg-fetch */
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
NULL
,
&
req
->
obj
);
req
->
objcore
=
boc
;
req
->
req_step
=
R_STP_MISS
;
return
(
REQ_FSM_MORE
);
}
else
if
(
boc
!=
NULL
)
{
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
boc
,
NULL
);
free
(
req
->
vary_b
);
req
->
vary_b
=
NULL
;
}
wrk
->
stats
.
cache_hit
++
;
(
void
)
HTTP1_DiscardReqBody
(
req
);
// XXX: handle err
(
void
)
HTTP1_DiscardReqBody
(
req
);
// XXX: handle err
req
->
req_step
=
R_STP_PREPRESP
;
req
->
req_step
=
R_STP_PREPRESP
;
return
(
REQ_FSM_MORE
);
return
(
REQ_FSM_MORE
);
}
case
VCL_RET_FETCH
:
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
NULL
,
&
req
->
obj
);
/* Drop our object, we won't need it */
req
->
objcore
=
boc
;
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
NULL
,
&
req
->
obj
);
req
->
req_step
=
R_STP_MISS
;
req
->
objcore
=
NULL
;
return
(
REQ_FSM_MORE
);
case
VCL_RET_RESTART
:
switch
(
wrk
->
handling
)
{
req
->
req_step
=
R_STP_RESTART
;
case
VCL_RET_PASS
:
req
->
req_step
=
R_STP_PASS
;
break
;
break
;
case
VCL_RET_ERROR
:
case
VCL_RET_ERROR
:
req
->
req_step
=
R_STP_ERROR
;
req
->
req_step
=
R_STP_ERROR
;
break
;
break
;
case
VCL_RET_RESTART
:
case
VCL_RET_PASS
:
req
->
req_step
=
R_STP_RESTART
;
wrk
->
stats
.
cache_hit
++
;
req
->
req_step
=
R_STP_PASS
;
break
;
break
;
default:
default:
WRONG
(
"Illegal action in vcl_lookup{}"
);
INCOMPL
();
}
/* Drop our object, we won't need it */
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
NULL
,
&
req
->
obj
);
req
->
objcore
=
NULL
;
if
(
boc
!=
NULL
)
{
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
boc
,
NULL
);
free
(
req
->
vary_b
);
req
->
vary_b
=
NULL
;
}
}
return
(
REQ_FSM_MORE
);
return
(
REQ_FSM_MORE
);
}
}
...
...
bin/varnishd/default.vcl
View file @
06df39d4
...
@@ -98,21 +98,17 @@ sub vcl_purge {
...
@@ -98,21 +98,17 @@ sub vcl_purge {
}
}
sub vcl_lookup {
sub vcl_lookup {
/*
if (!obj) {
return (deliver);
}
if (obj.uncacheable) {
return (pass);
}
if (obj.ttl >= 0s) {
if (obj.ttl >= 0s) {
// A pure unadultered hit, deliver it
return (deliver);
return (deliver);
}
}
if (obj.ttl + obj.grace > 0s) {
if (obj.ttl + obj.grace > 0s) {
return (deliver_stale);
// Object is in grace, delive it
// Automatically triggers a background fetch
return (deliver);
}
}
*/
// fetch
&
deliver once we get the result
return (
deliver
);
return (
fetch
);
}
}
sub vcl_miss {
sub vcl_miss {
...
...
lib/libvcl/generate.py
View file @
06df39d4
...
@@ -84,7 +84,7 @@ returns =(
...
@@ -84,7 +84,7 @@ returns =(
(
'hash'
,
"C"
,
(
'lookup'
,)),
(
'hash'
,
"C"
,
(
'lookup'
,)),
(
'purge'
,
"C"
,
(
'error'
,
'fetch'
,)),
(
'purge'
,
"C"
,
(
'error'
,
'fetch'
,)),
(
'miss'
,
"C"
,
(
'error'
,
'restart'
,
'pass'
,
'fetch'
,)),
(
'miss'
,
"C"
,
(
'error'
,
'restart'
,
'pass'
,
'fetch'
,)),
(
'lookup'
,
"C"
,
(
'error'
,
'restart'
,
'pass'
,
'deliver'
,)),
(
'lookup'
,
"C"
,
(
'error'
,
'restart'
,
'pass'
,
'
fetch'
,
'
deliver'
,)),
(
'backend_fetch'
,
"B"
,
(
'fetch'
,
'abandon'
)),
(
'backend_fetch'
,
"B"
,
(
'fetch'
,
'abandon'
)),
(
'backend_response'
,
"B"
,
(
'deliver'
,
'retry'
,
'abandon'
)),
(
'backend_response'
,
"B"
,
(
'deliver'
,
'retry'
,
'abandon'
)),
(
'deliver'
,
"C"
,
(
'restart'
,
'deliver'
,)),
(
'deliver'
,
"C"
,
(
'restart'
,
'deliver'
,)),
...
...
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