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
ce59124f
Commit
ce59124f
authored
Mar 09, 2018
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shard: replace magic defaults with optional arguments
parent
ee25c1b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
15 deletions
+17
-15
shard_cfg.c
lib/libvmod_directors/shard_cfg.c
+1
-2
vmod.vcc
lib/libvmod_directors/vmod.vcc
+4
-4
vmod_shard.c
lib/libvmod_directors/vmod_shard.c
+12
-9
No files found.
lib/libvmod_directors/shard_cfg.c
View file @
ce59124f
...
...
@@ -656,8 +656,7 @@ shardcfg_get_rampup(const struct sharddir *shardd, int host)
// assert sharddir_rdlock_held(shardd);
assert
(
host
<
shardd
->
n_backend
);
// magic value for default
if
(
shardd
->
backend
[
host
].
rampup
==
973279260
)
if
(
isnan
(
shardd
->
backend
[
host
].
rampup
))
r
=
shardd
->
rampup_duration
;
else
r
=
shardd
->
backend
[
host
].
rampup
;
...
...
lib/libvmod_directors/vmod.vcc
View file @
ce59124f
...
...
@@ -368,7 +368,7 @@ The association can be changed per backend request using the `param`
argument of `func_shard.backend`_.
$Method BOOL .add_backend(PRIV_TASK, BACKEND backend,
STRING ident=0, DURATION rampup=973279260
)
[STRING ident], [DURATION rampup]
)
Add a backend `backend` to the director.
...
...
@@ -380,13 +380,13 @@ backend name.
`ident` allows to add multiple instances of the same backend.
`rampup`: Optionally specify a specific rampup time for this
backend.
The magic default value of `973279260s` instructs the shard
director to use the default rampup time (see
:ref:`func_shard.set_rampup`).
backend.
Otherwise, the per-director rampup time is used (see
:ref:`func_shard.set_rampup`).
NOTE: Backend changes need to be finalized with `shard.reconfigure()`
and are only supported on one shard director at a time.
$Method BOOL .remove_backend(PRIV_TASK,
BACKEND backend=0, STRING ident=0
)
$Method BOOL .remove_backend(PRIV_TASK,
[BACKEND backend=0], [STRING ident=0]
)
Remove backend(s) from the director. Either `backend` or `ident` must
be specified. `ident` removes a specific instance. If `backend` is
...
...
lib/libvmod_directors/vmod_shard.c
View file @
ce59124f
...
...
@@ -297,26 +297,29 @@ vmod_shard_associate(VRT_CTX,
VCL_BOOL
v_matchproto_
(
td_directors_shard_add_backend
)
vmod_shard_add_backend
(
VRT_CTX
,
struct
vmod_directors_shard
*
vshard
,
struct
vmod_priv
*
priv
,
VCL_BACKEND
be
,
VCL_STRING
ident
,
VCL_DURATION
rampup
)
struct
vmod_shard_add_backend_arg
*
args
)
{
CHECK_OBJ_NOTNULL
(
vshard
,
VMOD_SHARD_SHARD_MAGIC
);
if
(
be
==
NULL
)
{
if
(
args
->
backend
==
NULL
)
{
shard_err0
(
ctx
,
vshard
->
shardd
,
".backend_add() NULL backend given"
);
return
0
;
return
(
0
)
;
}
return
shardcfg_add_backend
(
ctx
,
priv
,
vshard
->
shardd
,
be
,
ident
,
rampup
);
return
shardcfg_add_backend
(
ctx
,
args
->
arg1
,
vshard
->
shardd
,
args
->
backend
,
args
->
valid_ident
?
args
->
ident
:
NULL
,
args
->
valid_rampup
?
args
->
rampup
:
nan
(
""
));
}
VCL_BOOL
v_matchproto_
(
td_directors_shard_remove_backend
)
vmod_shard_remove_backend
(
VRT_CTX
,
struct
vmod_directors_shard
*
vshard
,
struct
vmod_priv
*
priv
,
VCL_BACKEND
be
,
VCL_STRING
ident
)
struct
vmod_shard_remove_backend_arg
*
args
)
{
VCL_BACKEND
be
=
args
->
valid_backend
?
args
->
backend
:
NULL
;
VCL_STRING
ident
=
args
->
ident
?
args
->
ident
:
NULL
;
CHECK_OBJ_NOTNULL
(
vshard
,
VMOD_SHARD_SHARD_MAGIC
);
if
(
be
==
NULL
&&
ident
==
NULL
)
{
...
...
@@ -326,7 +329,7 @@ vmod_shard_remove_backend(VRT_CTX, struct vmod_directors_shard *vshard,
return
0
;
}
return
shardcfg_remove_backend
(
ctx
,
priv
,
vshard
->
shardd
,
return
shardcfg_remove_backend
(
ctx
,
args
->
arg1
,
vshard
->
shardd
,
be
,
ident
);
}
...
...
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