Commit 4020b13d authored by Dag Haavi Finstad's avatar Dag Haavi Finstad

Req.hash_always_miss now implies req.hash_ignore_busy.

Fixes a case where we might get a cache hit even though hash_always_miss is set.

Fixes: #1073
parent 40ee205a
......@@ -332,7 +332,7 @@ HSH_Lookup(struct sess *sp)
if (oc->flags & OC_F_BUSY || oc->busyobj != NULL) {
CHECK_OBJ_ORNULL(oc->busyobj, BUSYOBJ_MAGIC);
if (req->hash_ignore_busy)
if (req->hash_ignore_busy || req->hash_always_miss)
continue;
if (oc->busyobj != NULL &&
......
varnishtest "Test that hash_always_miss also implies hash_ignore_busy. Ticket #1073."
server s1 {
rxreq
sema r1 sync 2
sema r2 sync 2
delay 1
txresp -hdr "Server: 1"
} -start
server s2 {
rxreq
sema r2 sync 2
txresp -hdr "Server: 2"
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.http.x-hash-always-miss == "1") {
set req.hash_always_miss = true;
}
if (req.http.x-client == "1") {
set req.backend = s1;
}
if (req.http.x-client == "2") {
set req.backend = s2;
}
}
sub vcl_deliver {
if(obj.hits > 0) {
set resp.http.X-Cache = "HIT";
} else {
set resp.http.X-Cache = "MISS";
}
}
} -start
client c1 {
txreq -url "/" -hdr "x-client: 1"
rxresp
expect resp.status == 200
expect resp.http.Server == "1"
} -start
client c2 {
sema r1 sync 2
txreq -url "/" -hdr "x-client: 2" -hdr "x-hash-always-miss: 1"
txreq -url "/" -hdr "x-client: 2"
rxresp
expect resp.status == 200
expect resp.http.Server == "2"
} -start
client c1 -wait
client c2 -wait
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