BBlack has submitted this change and it was merged.

Change subject: ttl_fixed: limit to tier-1 backends
......................................................................


ttl_fixed: limit to tier-1 backends

Even before the creation of "ttl_fixed", all cache_upload backends were
hisorically fixing TTLs at 30 days regardless of tier.  This is incorrect,
as for example a fixed-30-day object in a tier-1 backend could be served to
a tier-2 backend with only 3 days left, at which point it would be re-upped
to a full 30 days again, causing a total maximum object life of up to ~60
days.

This patch renames ttl_fixed to ttl_fixed_1be, so that the name reflect the
new constraint that the parameter is ignored except in tier1 backend VCLs.

Change-Id: I1e65daec5017192558fc1869d5056a7f5e76773e
---
M modules/role/manifests/cache/upload.pp
M modules/varnish/templates/vcl/wikimedia.vcl.erb
2 files changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Ema: Looks good to me, but someone else must approve
  BBlack: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/role/manifests/cache/upload.pp 
b/modules/role/manifests/cache/upload.pp
index 226ff24..7e0a9bd 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -83,7 +83,7 @@
 
     $be_vcl_config = merge($common_vcl_config, {
         'layer'            => 'backend',
-        'ttl_fixed'        => '30d',
+        'ttl_fixed_1be'    => '30d',
         'ttl_cap'          => '30d',
     })
 
diff --git a/modules/varnish/templates/vcl/wikimedia.vcl.erb 
b/modules/varnish/templates/vcl/wikimedia.vcl.erb
index 62e4e51..65e4fa9 100644
--- a/modules/varnish/templates/vcl/wikimedia.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia.vcl.erb
@@ -474,13 +474,17 @@
 }
 
 sub vcl_fetch {
-<% if @vcl_config.fetch("ttl_fixed", false) -%>
+<% if @site_tier == "one" && @vcl_config.fetch("layer", "") == "backend" -%>
+<% if @vcl_config.fetch("ttl_fixed_1be", false) -%>
        // Fixed TTL (rare/questionable, only used on upload backend right now)
+       // Only valid in tier-1 backend; it would be incorrect to re-raise the
+       // TTL on cache->cache fetches...
        // Note the ttl_cap comes after this and takes precedence!
        if (beresp.status <= 400) {
-               set beresp.ttl = <%= @vcl_config.fetch("ttl_fixed", "invalid") 
%>;
+               set beresp.ttl = <%= @vcl_config.fetch("ttl_fixed_1be", 
"invalid") %>;
        }
 <% end -%>
+<% end -%>
 
        // Hard TTL cap on all fetched objects (default 21d)
        if (beresp.ttl > <%= @vcl_config.fetch("ttl_cap", "21d") %>) {

-- 
To view, visit https://gerrit.wikimedia.org/r/270957
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1e65daec5017192558fc1869d5056a7f5e76773e
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
Gerrit-Reviewer: Ema <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to