[master] 2261dcf Change type of oc->last_lru from float back to double
Martin Blix Grydeland
martin at varnish-software.com
Mon Jan 8 15:10:08 UTC 2018
commit 2261dcfd545e6c9a5d60000cce06e9930557d73e
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Mon Jan 8 16:05:05 2018 +0100
Change type of oc->last_lru from float back to double
Since the last_lru tracks epoch time, it needs the double precision
floating point type to accurately track the time.
Fixes: #2527
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index b02fe00..ed5602f 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -376,7 +376,7 @@ struct objcore {
uint16_t oa_present;
unsigned timer_idx; // XXX 4Gobj limit
- float last_lru;
+ double last_lru;
VTAILQ_ENTRY(objcore) hsh_list;
VTAILQ_ENTRY(objcore) lru_list;
VTAILQ_ENTRY(objcore) ban_list;
diff --git a/bin/varnishtest/tests/r02527.vtc b/bin/varnishtest/tests/r02527.vtc
new file mode 100644
index 0000000..ae8ed03
--- /dev/null
+++ b/bin/varnishtest/tests/r02527.vtc
@@ -0,0 +1,30 @@
+varnishtest "Test the n_lru_moved counter"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -arg "-p lru_interval=1" -vcl+backend {
+ sub vcl_backend_response {
+ set beresp.do_stream = false;
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+} -run
+
+varnish v1 -expect MAIN.n_lru_moved == 0
+
+delay 1
+
+client c1 {
+ txreq
+ rxresp
+ txreq
+ rxresp
+} -run
+
+varnish v1 -expect MAIN.n_lru_moved == 1
More information about the varnish-commit
mailing list