Ayounsi has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/382175 )
Change subject: Adapt WMF specific patches for Varnish5
......................................................................
Adapt WMF specific patches for Varnish5
Change-Id: I75ea64ee7f97987f1daf2758643f95b1fbc2651e
---
M debian/patches/0002-exp-thread-realtime.patch
M debian/patches/0004-storage-file-off-t.patch
M debian/patches/0005-stats-shortlived.patch
3 files changed, 43 insertions(+), 91 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/debs/varnish4
refs/changes/75/382175/1
diff --git a/debian/patches/0002-exp-thread-realtime.patch
b/debian/patches/0002-exp-thread-realtime.patch
index 1034495..d6da18d 100644
--- a/debian/patches/0002-exp-thread-realtime.patch
+++ b/debian/patches/0002-exp-thread-realtime.patch
@@ -1,16 +1,17 @@
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
-index c03570389..da9ba22aa 100644
+index ee33de0..e0f0f6d 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
-@@ -824,14 +824,15 @@ extern pthread_key_t witness_key;
+@@ -828,7 +828,7 @@ extern pthread_key_t witness_key;
void Lck__Lock(struct lock *lck, const char *p, int l);
void Lck__Unlock(struct lock *lck, const char *p, int l);
int Lck__Trylock(struct lock *lck, const char *p, int l);
-void Lck__New(struct lock *lck, struct VSC_C_lck *, const char *);
+void Lck__New(struct lock *lck, struct VSC_C_lck *, const char *, int
protocol);
- void Lck__Assert(const struct lock *lck, int held);
+ int Lck__Held(const struct lock *lck);
+ int Lck__Owned(const struct lock *lck);
- /* public interface: */
+@@ -836,7 +836,8 @@ int Lck__Owned(const struct lock *lck);
void Lck_Delete(struct lock *lck);
int Lck_CondWait(pthread_cond_t *cond, struct lock *lck, double);
@@ -21,7 +22,7 @@
#define Lck_Unlock(a) Lck__Unlock(a, __func__, __LINE__)
#define Lck_Trylock(a) Lck__Trylock(a, __func__, __LINE__)
diff --git a/bin/varnishd/cache/cache_expire.c
b/bin/varnishd/cache/cache_expire.c
-index 5c27d0741..6cd079f6d 100644
+index f0ca523..fc16096 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -33,6 +33,7 @@
@@ -32,33 +33,34 @@
#include "cache.h"
-@@ -575,12 +576,25 @@ exp_thread(struct worker *wrk, void *priv)
+@@ -307,6 +308,8 @@ exp_thread(struct worker *wrk, void *priv)
struct objcore *oc;
double t = 0, tnext = 0;
struct exp_priv *ep;
+ struct sched_param param;
+ int s;
+ unsigned flags = 0;
CAST_OBJ_NOTNULL(ep, priv, EXP_PRIV_MAGIC);
- ep->wrk = wrk;
+@@ -314,6 +317,17 @@ exp_thread(struct worker *wrk, void *priv)
VSL_Setup(&ep->vsl, NULL, 0);
ep->heap = binheap_new(NULL, object_cmp, object_update);
AN(ep->heap);
+
-+ if (cache_param->exp_thread_rt) {
-+ // Pick a realtime policy scheduling (SCHED_FIFO) and bump prio
-+ param.sched_priority = 1;
-+ s = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m);
-+ if (s != 0) {
-+ perror("pthread_getschedparam");
-+ exit(EXIT_FAILURE);
-+ }
-+ }
++ if (cache_param->exp_thread_rt) {
++ // Pick a realtime policy scheduling (SCHED_FIFO) and bump
prio
++ param.sched_priority = 1;
++ s = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m);
++ if (s != 0) {
++ perror("pthread_getschedparam");
++ exit(EXIT_FAILURE);
++ }
++ }
+
while (1) {
Lck_Lock(&ep->mtx);
-@@ -617,7 +631,12 @@ EXP_Init(void)
+@@ -357,7 +371,12 @@ EXP_Init(void)
ALLOC_OBJ(ep, EXP_PRIV_MAGIC);
AN(ep);
@@ -70,13 +72,13 @@
+ }
+
AZ(pthread_cond_init(&ep->condvar, NULL));
- VTAILQ_INIT(&ep->inbox);
+ VSTAILQ_INIT(&ep->inbox);
AZ(pthread_rwlock_init(&ep->cb_rwl, NULL));
diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
-index 90190dcea..782d3778f 100644
+index 609971a..d18a0d8 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
-@@ -209,7 +209,7 @@ Lck_CondWait(pthread_cond_t *cond, struct lock *lck,
double when)
+@@ -214,7 +214,7 @@ Lck_CondWait(pthread_cond_t *cond, struct lock *lck,
double when)
}
void
@@ -85,7 +87,7 @@
{
struct ilck *ilck;
-@@ -221,6 +221,10 @@ Lck__New(struct lock *lck, struct VSC_C_lck *st, const
char *w)
+@@ -226,6 +226,10 @@ Lck__New(struct lock *lck, struct VSC_C_lck *st, const
char *w)
ilck->w = w;
ilck->stat = st;
ilck->stat->creat++;
@@ -97,10 +99,10 @@
lck->priv = ilck;
}
diff --git a/include/tbl/params.h b/include/tbl/params.h
-index ab80349a8..33feb8d87 100644
+index a44b625..21a5b49 100644
--- a/include/tbl/params.h
+++ b/include/tbl/params.h
-@@ -416,6 +416,34 @@ PARAM(
+@@ -467,6 +467,34 @@ PARAM(
/* func */ NULL
)
diff --git a/debian/patches/0004-storage-file-off-t.patch
b/debian/patches/0004-storage-file-off-t.patch
index d1ce5c7..c729f12 100644
--- a/debian/patches/0004-storage-file-off-t.patch
+++ b/debian/patches/0004-storage-file-off-t.patch
@@ -1,17 +1,17 @@
diff --git a/bin/varnishd/storage/storage_file.c
b/bin/varnishd/storage/storage_file.c
-index 395e6081d..03bb4ed0f 100644
+index 143ab9d..58657a9 100644
--- a/bin/varnishd/storage/storage_file.c
+++ b/bin/varnishd/storage/storage_file.c
-@@ -35,6 +35,7 @@
+@@ -37,6 +37,7 @@
#include <errno.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
- #include "cache/cache.h"
-@@ -418,7 +419,7 @@ static void
- smf_open(const struct stevedore *st)
+ #include "storage/storage.h"
+@@ -402,7 +403,7 @@ static void __match_proto__(storage_open_f)
+ smf_open(struct stevedore *st)
{
struct smf_sc *sc;
- off_t fail = 1 << 30; /* XXX: where is OFF_T_MAX ? */
diff --git a/debian/patches/0005-stats-shortlived.patch
b/debian/patches/0005-stats-shortlived.patch
index 25e9394..cca753f 100644
--- a/debian/patches/0005-stats-shortlived.patch
+++ b/debian/patches/0005-stats-shortlived.patch
@@ -1,32 +1,32 @@
diff --git a/bin/varnishd/cache/cache_fetch.c
b/bin/varnishd/cache/cache_fetch.c
-index 8cb14fe1b..6f6215311 100644
+index 670dc8f..9edbeb4 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
-@@ -55,8 +55,14 @@ vbf_allocobj(struct busyobj *bo, unsigned l)
+@@ -56,8 +56,14 @@ vbf_allocobj(struct busyobj *bo, unsigned l)
- lifetime = oc->exp.ttl + oc->exp.grace + oc->exp.keep;
+ lifetime = oc->ttl + oc->grace + oc->keep;
- if (bo->uncacheable || lifetime < cache_param->shortlived)
-+ if (bo->uncacheable) {
++ if (bo->uncacheable) {
+ bo->wrk->stats->cache_uncacheable++;
- storage_hint = TRANSIENT_STORAGE;
+ stv = stv_transient;
+ }
+ else if (lifetime < cache_param->shortlived) {
+ bo->wrk->stats->cache_shortlived++;
-+ storage_hint = TRANSIENT_STORAGE;
++ stv = stv_transient;
+ }
else
- storage_hint = bo->storage_hint;
+ stv = bo->storage;
diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h
-index ab926d9b7..4ad35f681 100644
+index 206cd03..406050c 100644
--- a/include/tbl/vsc_f_main.h
+++ b/include/tbl/vsc_f_main.h
-@@ -105,6 +105,19 @@ VSC_F(cache_miss, uint64_t, 1, 'c', 'i', info,
- " backend before delivering it to the client."
+@@ -115,6 +115,19 @@ VSC_FF(cache_miss, uint64_t, 1, 'c', 'i',
info,
+ " backend before delivering it to the client."
)
-+VSC_F(cache_shortlived, uint64_t, 1, 'c', 'i', info,
++VSC_FF(cache_shortlived, uint64_t, 1, 'c', 'i', info,
+ "Shortlived objects",
+ "Count of shortlived objects"
+ " Objects created with (ttl+grace+keep) shorter than the"
@@ -34,61 +34,11 @@
+ " storage."
+)
+
-+VSC_F(cache_uncacheable, uint64_t, 1, 'c', 'i', info,
++VSC_FF(cache_uncacheable, uint64_t, 1, 'c', 'i', info,
+ "Uncacheable objects",
+ "Count of uncacheable objects"
+)
+
/*---------------------------------------------------------------------*/
- VSC_F(backend_conn, uint64_t, 0, 'c', 'i', info,
-diff --git a/bin/varnishtest/tests/b00051.vtc
b/bin/varnishtest/tests/b00051.vtc
-new file mode 100644
-index 000000000..2e9fb65bb
---- /dev/null
-+++ b/bin/varnishtest/tests/b00051.vtc
-@@ -0,0 +1,44 @@
-+varnishtest "Test cache_{shortlived,uncacheable} counters"
-+
-+server s1 {
-+ rxreq
-+ txresp -hdr "Cache-Control: max-age=2"
-+
-+ rxreq
-+ txresp -hdr "Cache-Control: max-age=5"
-+
-+ rxreq
-+ txresp -hdr "Cache-Control: no-cache"
-+
-+ rxreq
-+ txresp
-+} -start
-+
-+varnish v1 -arg "-pshortlived=30" -vcl+backend {} -start
-+
-+varnish v1 -expect cache_shortlived == 0
-+varnish v1 -expect cache_uncacheable == 0
-+varnish v1 -expect cache_miss == 0
-+varnish v1 -expect cache_hit == 0
-+
-+client c1 {
-+ txreq -url "/banana"
-+ rxresp
-+
-+ txreq -url "/potato"
-+ rxresp
-+
-+ txreq -url "/gelato"
-+ rxresp
-+
-+ txreq -url "/naaaah"
-+ rxresp
-+
-+ txreq -url "/naaaah"
-+ rxresp
-+} -run
-+
-+varnish v1 -expect cache_shortlived == 2
-+varnish v1 -expect cache_uncacheable == 1
-+varnish v1 -expect cache_miss == 4
-+varnish v1 -expect cache_hit == 1
+ VSC_FF(backend_conn, uint64_t, 0, 'c', 'i', info,
--
To view, visit https://gerrit.wikimedia.org/r/382175
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I75ea64ee7f97987f1daf2758643f95b1fbc2651e
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/varnish4
Gerrit-Branch: debian-wmf
Gerrit-Owner: Ayounsi <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits