[master] e8e208b Fix the "shortlived" test to look a the sum of ttl + grace + keep rather than just the ttl.

Poul-Henning Kamp phk at FreeBSD.org
Tue Dec 17 11:19:19 CET 2013


commit e8e208b1095c174e264e138ef24d1dd7f19e2215
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Dec 17 10:17:46 2013 +0000

    Fix the "shortlived" test to look a the sum of ttl + grace + keep
    rather than just the ttl.
    
    Fixes		#1268
    Spotted by:	daghf
    Partial fix by:	gquintard

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index eb066eb..16067b2 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -370,7 +370,8 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 	if (bo->uncacheable)
 		bo->fetch_objcore->flags |= OC_F_PASS;
 
-	if (bo->exp.ttl < cache_param->shortlived || bo->uncacheable == 1)
+	if (bo->uncacheable ||
+	    bo->exp.ttl+bo->exp.grace+bo->exp.keep < cache_param->shortlived)
 		bo->storage_hint = TRANSIENT_STORAGE;
 
 	AZ(bo->stats);
diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c
index e63ce33..ecc36f7 100644
--- a/bin/varnishd/mgt/mgt_param_tbl.c
+++ b/bin/varnishd/mgt/mgt_param_tbl.c
@@ -537,8 +537,8 @@ struct parspec mgt_parspec[] = {
 	{ "shortlived", tweak_timeout,
 		&mgt_param.shortlived,
 		"0", NULL,
-		"Objects created with TTL shorter than this are always "
-		"put in transient storage.",
+		"Objects created with (ttl+grace+keep) shorter than this"
+		" are always put in transient storage.",
 		0,
 		"10.0", "s" },
 	{ "critbit_cooloff", tweak_timeout,



More information about the varnish-commit mailing list