shard: fix associated parameter set with resolve=NOW

When a parameter set is associated at the director level, it should be
in effect with resolve=NOW as with resolve=LAZY.
parent ad7ab013
......@@ -97,8 +97,9 @@ varnish v1 -vcl+backend {
}
sub vcl_backend_response {
if (bereq.http.layered) {
if (bereq.http.layered || bereq.http.resolve) {
set beresp.http.healthy = std.healthy(ll.backend());
set beresp.http.backend-now = l.backend(resolve=NOW);
} else {
set beresp.http.healthy = std.healthy(
vd.backend(resolve=LAZY, by=KEY, key=1));
......@@ -137,6 +138,7 @@ client c1 {
expect resp.http.healthy == "true"
expect resp.http.director == "ll"
expect resp.http.backend == "s1"
expect resp.http.backend == resp.http.backend-now
txreq -url /2 -hdr "layered: true"
rxresp
......@@ -144,6 +146,7 @@ client c1 {
expect resp.http.healthy == "true"
expect resp.http.director == "ll"
expect resp.http.backend == "s2"
expect resp.http.backend == resp.http.backend-now
txreq -url /3 -hdr "layered: true"
rxresp
......@@ -151,6 +154,7 @@ client c1 {
expect resp.http.healthy == "true"
expect resp.http.director == "ll"
expect resp.http.backend == "s3"
expect resp.http.backend == resp.http.backend-now
txreq -url /1 -hdr "resolve: true"
rxresp
......@@ -158,6 +162,7 @@ client c1 {
expect resp.http.healthy == "true"
expect resp.http.director == "s1"
expect resp.http.backend == "s1"
expect resp.http.backend == resp.http.backend-now
txreq -url /2 -hdr "resolve: true"
rxresp
......@@ -165,6 +170,7 @@ client c1 {
expect resp.http.healthy == "true"
expect resp.http.director == "s2"
expect resp.http.backend == "s2"
expect resp.http.backend == resp.http.backend-now
txreq -url /3 -hdr "resolve: true"
rxresp
......@@ -172,4 +178,5 @@ client c1 {
expect resp.http.healthy == "true"
expect resp.http.director == "s3"
expect resp.http.backend == "s3"
expect resp.http.backend == resp.http.backend-now
} -run
......@@ -608,6 +608,14 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
else
resolve = VENUM(NOW);
if (ctx->method & SHARD_VCL_TASK_BEREQ) {
pp = shard_param_task(ctx, vshard->shardd,
vshard->shardd->param);
if (pp == NULL)
return (NULL);
pp->vcl_name = vshard->shardd->name;
}
if (resolve == VENUM(LAZY)) {
if ((args & ~arg_resolve) == 0) {
AN(vshard->dir);
......@@ -621,14 +629,6 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
"context");
return (NULL);
}
assert(ctx->method & SHARD_VCL_TASK_BEREQ);
pp = shard_param_task(ctx, vshard->shardd,
vshard->shardd->param);
if (pp == NULL)
return (NULL);
pp->vcl_name = vshard->shardd->name;
} else if (resolve == VENUM(NOW)) {
if (ctx->method & VCL_MET_TASK_H) {
shard_fail(ctx, vshard->shardd->name, "%s",
......@@ -636,8 +636,9 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
"used in vcl_init{}/vcl_fini{}");
return (NULL);
}
pp = shard_param_stack(&pstk, vshard->shardd->param,
vshard->shardd->name);
pp = shard_param_stack(&pstk,
pp != NULL ? pp : vshard->shardd->param,
vshard->shardd->name);
} else {
WRONG("resolve enum");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment