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
cfb92230
Commit
cfb92230
authored
Jan 05, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach VCC how to put backend-VSC's into a VSM-cluster.
parent
849fcd3b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
4 deletions
+58
-4
cache_backend.c
bin/varnishd/cache/cache_backend.c
+17
-2
cache_vrt.c
bin/varnishd/cache/cache_vrt.c
+10
-0
vrt.h
include/vrt.h
+5
-0
vcc_backend.c
lib/libvcc/vcc_backend.c
+16
-1
vcc_compile.c
lib/libvcc/vcc_compile.c
+5
-1
vcc_compile.h
lib/libvcc/vcc_compile.h
+2
-0
vsctool.py
lib/libvcc/vsctool.py
+3
-0
No files found.
bin/varnishd/cache/cache_backend.c
View file @
cfb92230
...
...
@@ -423,8 +423,16 @@ vbe_panic(const struct director *d, struct vsb *vsb)
* Create a new static or dynamic director::backend instance.
*/
struct
director
*
VRT_new_backend
(
VRT_CTX
,
const
struct
vrt_backend
*
vrt
)
size_t
v_matchproto_
()
VRT_backend_vsm_need
(
VRT_CTX
)
{
(
void
)
ctx
;
return
(
VSC_vbe_size
);
}
struct
director
*
v_matchproto_
()
VRT_new_backend_clustered
(
VRT_CTX
,
struct
vsm_cluster
*
vc
,
const
struct
vrt_backend
*
vrt
)
{
struct
backend
*
be
;
struct
director
*
d
;
...
...
@@ -433,6 +441,7 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
int
retval
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
(
void
)
vc
;
CHECK_OBJ_NOTNULL
(
vrt
,
VRT_BACKEND_MAGIC
);
assert
(
vrt
->
ipv4_suckaddr
!=
NULL
||
vrt
->
ipv6_suckaddr
!=
NULL
);
...
...
@@ -495,6 +504,12 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
return
(
NULL
);
}
struct
director
*
v_matchproto_
()
VRT_new_backend
(
VRT_CTX
,
const
struct
vrt_backend
*
vrt
)
{
return
(
VRT_new_backend_clustered
(
ctx
,
NULL
,
vrt
));
}
/*--------------------------------------------------------------------
* Delete a dynamic director::backend instance. Undeleted dynamic and
* static instances are GC'ed when the VCL is discarded (in cache_vcl.c)
...
...
bin/varnishd/cache/cache_vrt.c
View file @
cfb92230
...
...
@@ -622,6 +622,16 @@ VRT_purge(VRT_CTX, double ttl, double grace, double keep)
ttl
,
grace
,
keep
));
}
/*--------------------------------------------------------------------
*/
struct
vsm_cluster
*
VRT_VSM_Cluster
(
size_t
sz
)
{
AN
(
sz
);
return
((
void
*
)
VRT_VSM_Cluster
);
}
/*--------------------------------------------------------------------
* Simple stuff
*/
...
...
include/vrt.h
View file @
cfb92230
...
...
@@ -387,9 +387,14 @@ void VRT_synth_page(VRT_CTX, const char *, ...);
/* Backend related */
struct
director
*
VRT_new_backend
(
VRT_CTX
,
const
struct
vrt_backend
*
);
struct
director
*
VRT_new_backend_clustered
(
VRT_CTX
,
struct
vsm_cluster
*
,
const
struct
vrt_backend
*
);
size_t
VRT_backend_vsm_need
(
VRT_CTX
);
void
VRT_delete_backend
(
VRT_CTX
,
struct
director
**
);
int
VRT_backend_healthy
(
VRT_CTX
,
struct
director
*
);
/* VSM related */
struct
vsm_cluster
*
VRT_VSM_Cluster
(
size_t
);
/* cache_director.c */
int
VRT_Healthy
(
VRT_CTX
,
VCL_BACKEND
);
...
...
lib/libvcc/vcc_backend.c
View file @
cfb92230
...
...
@@ -449,7 +449,8 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
ifp
=
New_IniFin
(
tl
);
VSB_printf
(
ifp
->
ini
,
"
\t
%s =
\n\t
VRT_new_backend(ctx, &vgc_dir_priv_%s);"
,
"
\t
%s =
\n\t
VRT_new_backend_clustered(ctx, vc,
\n
"
"
\t\t
&vgc_dir_priv_%s);"
,
vgcname
,
vgcname
);
}
...
...
@@ -463,6 +464,7 @@ vcc_ParseBackend(struct vcc *tl)
struct
token
*
t_first
,
*
t_be
;
struct
symbol
*
sym
;
tl
->
ndirector
++
;
t_first
=
tl
->
t
;
vcc_NextToken
(
tl
);
/* ID: backend */
...
...
@@ -492,3 +494,16 @@ vcc_ParseBackend(struct vcc *tl)
tl
->
t_default_director
=
t_be
;
}
}
void
vcc_Backend_Init
(
struct
vcc
*
tl
)
{
struct
inifin
*
ifp
;
ifp
=
New_IniFin
(
tl
);
VSB_printf
(
ifp
->
ini
,
"
\t
struct vsm_cluster *vc;
\n
"
);
VSB_printf
(
ifp
->
ini
,
"
\n
"
);
VSB_printf
(
ifp
->
ini
,
"
\t
vc = VRT_VSM_Cluster(ndirector * VRT_backend_vsm_need(ctx));
\n
"
);
VSB_printf
(
ifp
->
ini
,
"
\t
if (vc == 0)
\n\t\t
return(1);"
);
}
lib/libvcc/vcc_compile.c
View file @
cfb92230
...
...
@@ -298,7 +298,9 @@ EmitInitFini(const struct vcc *tl)
* LOAD
*/
Fc
(
tl
,
0
,
"
\n
static int
\n
VGC_Load(VRT_CTX)
\n
{
\n\n
"
);
Fc
(
tl
,
0
,
"
\t
vgc_inistep = 0;
\n\n
"
);
Fc
(
tl
,
0
,
"
\t
vgc_inistep = 0;
\n
"
);
Fc
(
tl
,
0
,
"
\t
size_t ndirector = %dUL;
\n
"
,
tl
->
ndirector
);
Fc
(
tl
,
0
,
"
\n
"
);
VTAILQ_FOREACH
(
p
,
&
tl
->
inifin
,
list
)
{
AZ
(
VSB_finish
(
p
->
ini
));
assert
(
p
->
n
>
0
);
...
...
@@ -560,6 +562,8 @@ vcc_CompileSource(struct vcc *tl, struct source *sp)
vcc_Expr_Init
(
tl
);
vcc_Backend_Init
(
tl
);
for
(
v
=
vcc_vars
;
v
->
name
!=
NULL
;
v
++
)
{
if
(
v
->
fmt
==
HEADER
)
{
sym
=
VCC_Symbol
(
tl
,
NULL
,
v
->
name
,
NULL
,
...
...
lib/libvcc/vcc_compile.h
View file @
cfb92230
...
...
@@ -217,6 +217,7 @@ struct vcc {
int
nprobe
;
int
ndirector
;
const
char
*
default_director
;
struct
token
*
t_default_director
;
const
char
*
default_probe
;
...
...
@@ -252,6 +253,7 @@ int vcc_ParseAction(struct vcc *tl);
/* vcc_backend.c */
struct
fld_spec
;
void
vcc_Backend_Init
(
struct
vcc
*
tl
);
void
vcc_ParseProbe
(
struct
vcc
*
tl
);
void
vcc_ParseBackend
(
struct
vcc
*
tl
);
struct
fld_spec
*
vcc_FldSpec
(
struct
vcc
*
tl
,
const
char
*
first
,
...);
...
...
lib/libvcc/vsctool.py
View file @
cfb92230
...
...
@@ -143,6 +143,9 @@ class vscset(object):
fo
.
write
(
"};
\n
"
)
fo
.
write
(
"
\n
"
)
fo
.
write
(
"#define VSC_"
+
self
.
name
+
"_size PRNDUP(sizeof("
+
self
.
struct
+
"))
\n\n
"
)
fo
.
write
(
self
.
struct
+
" *VSC_"
+
self
.
name
+
"_New"
)
fo
.
write
(
"(struct vsm_cluster *,
\n
"
)
fo
.
write
(
" struct vsc_seg **, const char *fmt, ...);
\n
"
)
...
...
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