BBlack has submitted this change and it was merged.

Change subject: upload storage: fix CL comparisons
......................................................................


upload storage: fix CL comparisons

Failed to use std.integer(), cleaned up related logic a bit after
checking that std.integer() properly handles up to signed 64-bit
values on our hosts.

Bug: T145661
Change-Id: If79a9ad86d159000e597115ab73712a0e6aed0ad
---
M modules/varnish/templates/upload-backend.inc.vcl.erb
1 file changed, 9 insertions(+), 10 deletions(-)

Approvals:
  BBlack: Verified; Looks good to me, approved



diff --git a/modules/varnish/templates/upload-backend.inc.vcl.erb 
b/modules/varnish/templates/upload-backend.inc.vcl.erb
index 1a61af2..27a2c11 100644
--- a/modules/varnish/templates/upload-backend.inc.vcl.erb
+++ b/modules/varnish/templates/upload-backend.inc.vcl.erb
@@ -4,27 +4,26 @@
 <%- if @vcl_config.fetch('upload_storage_experiment') -%>
 sub pick_stevedore {
        // Select a storage size class/bin
-       if (beresp.http.Content-Length !~ "^[0-9]+$") { // XXX even possible on 
upload?
+       if (beresp.http.Content-Length !~ "^[0-9]+$") { // even possible on 
upload?
                set beresp.storage_hint = "bin1";
        }
-       elsif (beresp.http.Content-Length ~ "^[0-9]{10}") { // 1GB+
-               set beresp.uncacheable = true;
-               set beresp.storage_hint = "bin4";
-       }
-       elsif (beresp.http.Content-Length < 1024 * 16) { // 16KB
+       elsif (std.integer(beresp.http.Content-Length, 0) < 1024 * 16) { // 16KB
                set beresp.storage_hint = "bin0";
        }
-       elsif (beresp.http.Content-Length < 1024 * 16 * 16) { // 256KB
+       elsif (std.integer(beresp.http.Content-Length, 0) < 1024 * 16 * 16) { 
// 256KB
                set beresp.storage_hint = "bin1";
        }
-       elsif (beresp.http.Content-Length < 1024 * 16 * 16 * 16) { // 4MB
+       elsif (std.integer(beresp.http.Content-Length, 0) < 1024 * 16 * 16 * 
16) { // 4MB
                set beresp.storage_hint = "bin2";
        }
-       elsif (beresp.http.Content-Length < 1024 * 16 * 16 * 16 * 16) { // 64MB
+       elsif (std.integer(beresp.http.Content-Length, 0) < 1024 * 16 * 16 * 16 
* 16) { // 64MB
                set beresp.storage_hint = "bin3";
        }
-       else { // 64MB-1GB
+       else { // >= 64MB
                set beresp.storage_hint = "bin4";
+               if (std.integer(beresp.http.Content-Length, 0) >= 1024 * 16 * 
16 * 16 * 16 * 16) { // 1GB
+                       set beresp.uncacheable = true;
+               }
        }
 }
 <%- else -%>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If79a9ad86d159000e597115ab73712a0e6aed0ad
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to