[3.0] 48ab7aa Req.hash_always_miss now implies req.hash_ignore_busy.
Tollef Fog Heen
tfheen at varnish-cache.org
Thu May 24 14:51:12 CEST 2012
commit 48ab7aa14ee48facf8fb0ccd74058c2e69ec0cb4
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date: Tue May 8 17:10:58 2012 +0200
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
diff --git a/bin/varnishd/cache_hash.c b/bin/varnishd/cache_hash.c
index 328964a..8da00a4 100644
--- a/bin/varnishd/cache_hash.c
+++ b/bin/varnishd/cache_hash.c
@@ -352,7 +352,7 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
if (oc->flags & OC_F_BUSY) {
CHECK_OBJ_NOTNULL(oc->busyobj, BUSYOBJ_MAGIC);
- if (sp->hash_ignore_busy)
+ if (sp->hash_ignore_busy || sp->hash_always_miss)
continue;
if (oc->busyobj->vary != NULL &&
diff --git a/bin/varnishtest/tests/r01073.vtc b/bin/varnishtest/tests/r01073.vtc
new file mode 100644
index 0000000..936f8ce
--- /dev/null
+++ b/bin/varnishtest/tests/r01073.vtc
@@ -0,0 +1,55 @@
+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
More information about the varnish-commit
mailing list