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
13a03e3a
Commit
13a03e3a
authored
Apr 15, 2021
by
Reza Naghibi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow shard.reconfigure() to work on empty directors
Also move the lock up to cover more operations.
parent
349abc76
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
4 deletions
+39
-4
d06001.vtc
bin/varnishtest/tests/d06001.vtc
+30
-0
shard_cfg.c
lib/libvmod_directors/shard_cfg.c
+9
-4
No files found.
bin/varnishtest/tests/d06001.vtc
0 → 100644
View file @
13a03e3a
varnishtest "Empty shard reconfig"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
import directors;
sub vcl_init {
new shard1 = directors.shard();
new shard2 = directors.shard();
shard1.reconfigure();
shard2.add_backend(s1);
shard2.reconfigure();
}
sub vcl_recv {
set req.backend_hint = shard2.backend();
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
} -run
lib/libvmod_directors/shard_cfg.c
View file @
13a03e3a
...
...
@@ -616,14 +616,19 @@ shardcfg_reconfigure(VRT_CTX, struct vmod_priv *priv,
return
(
0
);
}
sharddir_wrlock
(
shardd
);
change
=
shard_change_get
(
ctx
,
priv
,
shardd
);
if
(
change
==
NULL
)
if
(
change
==
NULL
)
{
sharddir_unlock
(
shardd
);
return
(
0
);
}
if
(
VSTAILQ_FIRST
(
&
change
->
tasks
)
==
NULL
)
if
(
VSTAILQ_FIRST
(
&
change
->
tasks
)
==
NULL
)
{
shard_change_finish
(
change
);
sharddir_unlock
(
shardd
);
return
(
1
);
sharddir_wrlock
(
shardd
);
}
shardcfg_apply_change
(
ctx
,
shardd
,
change
,
replicas
);
shard_change_finish
(
change
);
...
...
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