From c0ef92ab156705fbba23cb439c7b2d95a62656e6 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 20 Jun 2008 13:08:52 +0000 Subject: [PATCH] Add a param "log_hashstring" that controls logging of the completed hash string in SHM log under the "Hash" tag. Enabling this increases pressure on the SHM log considerably, so don't enable it, unless you need it. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2744 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_hash.c | 4 ++++ varnish-cache/bin/varnishd/heritage.h | 3 +++ varnish-cache/bin/varnishd/mgt_param.c | 4 ++++ varnish-cache/include/shmlog_tags.h | 2 ++ 4 files changed, 13 insertions(+) diff --git a/varnish-cache/bin/varnishd/cache_hash.c b/varnish-cache/bin/varnishd/cache_hash.c index 46e00e66..99a05268 100644 --- a/varnish-cache/bin/varnishd/cache_hash.c +++ b/varnish-cache/bin/varnishd/cache_hash.c @@ -248,6 +248,8 @@ HSH_Lookup(struct sess *sp) /* We found an object we like */ o->refcnt++; UNLOCK(&oh->mtx); + if (params->log_hash) + WSP(sp, SLT_Hash, "%s", oh->hash); (void)hash->deref(oh); return (o); } @@ -273,6 +275,8 @@ HSH_Lookup(struct sess *sp) grace_o->refcnt++; } UNLOCK(&oh->mtx); + if (params->log_hash) + WSP(sp, SLT_Hash, "%s", oh->hash); /* * XXX: This may be too early, relative to pass objects. * XXX: possibly move to when we commit to have it in the cache. diff --git a/varnish-cache/bin/varnishd/heritage.h b/varnish-cache/bin/varnishd/heritage.h index 41d8a73d..3e892618 100644 --- a/varnish-cache/bin/varnishd/heritage.h +++ b/varnish-cache/bin/varnishd/heritage.h @@ -159,6 +159,9 @@ struct params { /* Default grace period */ unsigned default_grace; + + /* Log hash string to shm */ + unsigned log_hash; }; extern volatile struct params *params; diff --git a/varnish-cache/bin/varnishd/mgt_param.c b/varnish-cache/bin/varnishd/mgt_param.c index 091c30ab..cb27e4f4 100644 --- a/varnish-cache/bin/varnishd/mgt_param.c +++ b/varnish-cache/bin/varnishd/mgt_param.c @@ -743,6 +743,10 @@ static const struct parspec parspec[] = { "NB: Must be specified with -p to have effect.\n", 0, "8192", "bytes" }, + { "log_hashstring", tweak_bool, &master.log_hash, 0, 0, + "Log the hash string to shared memory log.\n", + 0, + "off", "bool" }, { "diag_bitmap", tweak_diag_bitmap, 0, 0, 0, "Bitmap controlling diagnostics code:\n" " 0x00000001 - CNT_Session states.\n" diff --git a/varnish-cache/include/shmlog_tags.h b/varnish-cache/include/shmlog_tags.h index 11ca9e88..55022b81 100644 --- a/varnish-cache/include/shmlog_tags.h +++ b/varnish-cache/include/shmlog_tags.h @@ -97,3 +97,5 @@ SLTM(Terminate) SLTM(ESItrace) SLTM(ESI_xmlerror) + +SLTM(Hash) -- 2.39.5