[6.0] 177e40e82 For warmup/rampup, only consider healthy backends
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Wed Nov 7 10:04:06 UTC 2018
commit 177e40e82030425357897eed249fd9118994011f
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Tue Nov 6 10:56:44 2018 +0100
For warmup/rampup, only consider healthy backends
For healthy == IGNORE, we return before the call to shard_next(), so
at this point we do want to consider health state - and it makes
absolutely no sense to give up a healthy backend in favor of an un-
healthy one anyway.
Fixes #2823
diff --git a/bin/varnishtest/tests/d00023.vtc b/bin/varnishtest/tests/d00023.vtc
index 36ebe8e78..12c494f56 100644
--- a/bin/varnishtest/tests/d00023.vtc
+++ b/bin/varnishtest/tests/d00023.vtc
@@ -13,6 +13,9 @@ server s3 {
rxreq
expect req.http.healthy == "true"
txresp -body "xiuFi3Pe"
+ rxreq
+ expect req.http.healthy == "true"
+ txresp -body "xiuFi3Pe"
} -start
varnish v1 -vcl+backend {
@@ -29,8 +32,16 @@ varnish v1 -vcl+backend {
}
sub vcl_recv {
- set req.backend_hint = vd.backend(by=KEY,
- key=1756955383);
+ if (req.url == "/warmup") {
+ # key for which the order is s3->s1->s2
+ # we do not want to hit s1/s2 because they are down
+ set req.backend_hint = vd.backend(by=KEY,
+ key=192192123, warmup=1.0);
+ } else {
+ # key for which the order is s1->s2->s3
+ set req.backend_hint = vd.backend(by=KEY,
+ key=1756955383);
+ }
set req.http.healthy = std.healthy(req.backend_hint);
return(pass);
}
@@ -50,4 +61,7 @@ client c1 {
txreq
rxresp
expect resp.body == "xiuFi3Pe"
+ txreq -url "/warmup"
+ rxresp
+ expect resp.body == "xiuFi3Pe"
} -run
diff --git a/doc/changes.rst b/doc/changes.rst
index 5f8d3b90c..6f98e77a3 100644
--- a/doc/changes.rst
+++ b/doc/changes.rst
@@ -93,6 +93,9 @@ Varnish Cache 6.0.2 (unreleased)
* Fix VRT_priv_task for calls from vcl_pipe {} and test for it (2820_)
+* Shard director: For warmup/rampup, only consider healthy backends
+ (2823_)
+
.. _2418: https://github.com/varnishcache/varnish-cache/issues/2418
.. _2589: https://github.com/varnishcache/varnish-cache/issues/2589
.. _2654: https://github.com/varnishcache/varnish-cache/issues/2654
@@ -122,6 +125,7 @@ Varnish Cache 6.0.2 (unreleased)
.. _2794: https://github.com/varnishcache/varnish-cache/issues/2794
.. _2800: https://github.com/varnishcache/varnish-cache/issues/2800
.. _2820: https://github.com/varnishcache/varnish-cache/issues/2820
+.. _2823: https://github.com/varnishcache/varnish-cache/issues/2823
================================
diff --git a/lib/libvmod_directors/shard_dir.c b/lib/libvmod_directors/shard_dir.c
index a83fc44dc..01f044fff 100644
--- a/lib/libvmod_directors/shard_dir.c
+++ b/lib/libvmod_directors/shard_dir.c
@@ -394,7 +394,7 @@ sharddir_pick_be(VRT_CTX, struct sharddir *shardd,
/* short path for cases we dont want ramup/warmup or can't */
if (alt > 0 || healthy == IGNORE || (!rampup && warmup == 0) ||
- shard_next(&state, 0, 0) == -1)
+ shard_next(&state, 0, 1) == -1)
goto ok;
assert(alt == 0);
More information about the varnish-commit
mailing list