[5.2] 279bc80 Ignore req.ttl when keeping track of epired objects

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Fri Sep 15 11:17:17 UTC 2017


commit 279bc800716428eb559d8712691d73b2e018e42b
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Sep 11 13:03:52 2017 +0200

    Ignore req.ttl when keeping track of epired objects
    
    The goal of `req.ttl` is to allow lower requirements for known
    transactions (since this has to be done in VCL) but objects with
    an age higher than `req.ttl` would always be considered expired
    during lookup even if their actual TTL (obj.ttl) is still positive.
    
    Ignoring `req.ttl` gives a better control over explicit refreshes
    made to optimize latency and greatly reduces the risk of running
    into #1799 (for a subset of use cases).
    
    Closes #2422

diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 55fa342..2e9baf9 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -461,7 +461,8 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
 			*ocp = oc;
 			return (HSH_HIT);
 		}
-		if (oc->t_origin > exp_t_origin) {
+		if (EXP_Ttl(NULL, oc) < req->t_req && /* ignore req.ttl */
+		    oc->t_origin > exp_t_origin) {
 			/* record the newest object */
 			exp_oc = oc;
 			exp_t_origin = oc->t_origin;


More information about the varnish-commit mailing list