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
74c03d48
Commit
74c03d48
authored
Aug 30, 2016
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify what makes a VCL warm or cold
parent
b1419a63
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+12
-7
No files found.
bin/varnishd/cache/cache_vcl.c
View file @
74c03d48
...
@@ -53,6 +53,12 @@ static const char * const VCL_TEMP_BUSY = "busy";
...
@@ -53,6 +53,12 @@ static const char * const VCL_TEMP_BUSY = "busy";
static
const
char
*
const
VCL_TEMP_COOLING
=
"cooling"
;
static
const
char
*
const
VCL_TEMP_COOLING
=
"cooling"
;
static
const
char
*
const
VCL_TEMP_LABEL
=
"label"
;
static
const
char
*
const
VCL_TEMP_LABEL
=
"label"
;
/* NB: The COOLING temperature is neither COLD nor WARM. And LABEL is not a
* temperature, it's a state.
*/
#define VCL_WARM(v) ((v)->temp == VCL_TEMP_WARM || (v)->temp == VCL_TEMP_BUSY)
#define VCL_COLD(v) ((v)->temp == VCL_TEMP_INIT || (v)->temp == VCL_TEMP_COLD)
struct
vcl
{
struct
vcl
{
unsigned
magic
;
unsigned
magic
;
#define VCL_MAGIC 0x214188f2
#define VCL_MAGIC 0x214188f2
...
@@ -176,7 +182,7 @@ vcl_get(struct vcl **vcc, struct vcl *vcl)
...
@@ -176,7 +182,7 @@ vcl_get(struct vcl **vcc, struct vcl *vcl)
{
{
CHECK_OBJ_NOTNULL
(
vcl
,
VCL_MAGIC
);
CHECK_OBJ_NOTNULL
(
vcl
,
VCL_MAGIC
);
assert
(
vcl
->
temp
==
VCL_TEMP_WARM
);
assert
(
VCL_WARM
(
vcl
)
);
Lck_Lock
(
&
vcl_mtx
);
Lck_Lock
(
&
vcl_mtx
);
AN
(
vcl
);
AN
(
vcl
);
if
(
vcl
->
label
==
NULL
)
if
(
vcl
->
label
==
NULL
)
...
@@ -204,7 +210,7 @@ void
...
@@ -204,7 +210,7 @@ void
VCL_Refresh
(
struct
vcl
**
vcc
)
VCL_Refresh
(
struct
vcl
**
vcc
)
{
{
CHECK_OBJ_NOTNULL
(
vcl_active
,
VCL_MAGIC
);
CHECK_OBJ_NOTNULL
(
vcl_active
,
VCL_MAGIC
);
assert
(
vcl_active
->
temp
==
VCL_TEMP_WARM
);
assert
(
VCL_WARM
(
vcl_active
)
);
if
(
*
vcc
==
vcl_active
)
if
(
*
vcc
==
vcl_active
)
return
;
return
;
if
(
*
vcc
!=
NULL
)
if
(
*
vcc
!=
NULL
)
...
@@ -217,7 +223,7 @@ VCL_Ref(struct vcl *vcl)
...
@@ -217,7 +223,7 @@ VCL_Ref(struct vcl *vcl)
{
{
CHECK_OBJ_NOTNULL
(
vcl
,
VCL_MAGIC
);
CHECK_OBJ_NOTNULL
(
vcl
,
VCL_MAGIC
);
assert
(
vcl
->
temp
!=
VCL_TEMP_INIT
&&
vcl
->
temp
!=
VCL_TEMP_COLD
);
assert
(
!
VCL_COLD
(
vcl
)
);
Lck_Lock
(
&
vcl_mtx
);
Lck_Lock
(
&
vcl_mtx
);
assert
(
vcl
->
busy
>
0
);
assert
(
vcl
->
busy
>
0
);
vcl
->
busy
++
;
vcl
->
busy
++
;
...
@@ -260,7 +266,7 @@ VCL_AddBackend(struct vcl *vcl, struct backend *be)
...
@@ -260,7 +266,7 @@ VCL_AddBackend(struct vcl *vcl, struct backend *be)
VTAILQ_INSERT_TAIL
(
&
vcl
->
backend_list
,
be
,
vcl_list
);
VTAILQ_INSERT_TAIL
(
&
vcl
->
backend_list
,
be
,
vcl_list
);
Lck_Unlock
(
&
vcl_mtx
);
Lck_Unlock
(
&
vcl_mtx
);
if
(
vcl
->
temp
==
VCL_TEMP_WARM
||
vcl
->
temp
==
VCL_TEMP_BUSY
)
if
(
VCL_WARM
(
vcl
)
)
/* Only when adding backend to already warm VCL */
/* Only when adding backend to already warm VCL */
VBE_Event
(
be
,
VCL_EVENT_WARM
);
VBE_Event
(
be
,
VCL_EVENT_WARM
);
else
if
(
vcl
->
temp
!=
VCL_TEMP_INIT
)
else
if
(
vcl
->
temp
!=
VCL_TEMP_INIT
)
...
@@ -470,7 +476,7 @@ VRT_ref_vcl(VRT_CTX, const char *desc)
...
@@ -470,7 +476,7 @@ VRT_ref_vcl(VRT_CTX, const char *desc)
vcl
=
ctx
->
vcl
;
vcl
=
ctx
->
vcl
;
CHECK_OBJ_NOTNULL
(
vcl
,
VCL_MAGIC
);
CHECK_OBJ_NOTNULL
(
vcl
,
VCL_MAGIC
);
xxxassert
(
vcl
->
temp
==
VCL_TEMP_WARM
);
assert
(
VCL_WARM
(
vcl
)
);
ALLOC_OBJ
(
ref
,
VCLREF_MAGIC
);
ALLOC_OBJ
(
ref
,
VCLREF_MAGIC
);
AN
(
ref
);
AN
(
ref
);
...
@@ -618,8 +624,7 @@ vcl_set_state(struct vrt_ctx *ctx, const char *state)
...
@@ -618,8 +624,7 @@ vcl_set_state(struct vrt_ctx *ctx, const char *state)
switch
(
state
[
0
])
{
switch
(
state
[
0
])
{
case
'0'
:
case
'0'
:
assert
(
vcl
->
temp
!=
VCL_TEMP_COLD
);
assert
(
vcl
->
temp
!=
VCL_TEMP_COLD
);
if
(
vcl
->
busy
==
0
&&
(
vcl
->
temp
==
VCL_TEMP_WARM
||
if
(
vcl
->
busy
==
0
&&
VCL_WARM
(
vcl
))
{
vcl
->
temp
==
VCL_TEMP_BUSY
))
{
vcl
->
temp
=
VTAILQ_EMPTY
(
&
vcl
->
ref_list
)
?
vcl
->
temp
=
VTAILQ_EMPTY
(
&
vcl
->
ref_list
)
?
VCL_TEMP_COLD
:
VCL_TEMP_COOLING
;
VCL_TEMP_COLD
:
VCL_TEMP_COOLING
;
...
...
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