r2744 - in trunk/varnish-cache: bin/varnishd include

phk at projects.linpro.no phk at projects.linpro.no
Fri Jun 20 15:08:52 CEST 2008


Author: phk
Date: 2008-06-20 15:08:52 +0200 (Fri, 20 Jun 2008)
New Revision: 2744

Modified:
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/heritage.h
   trunk/varnish-cache/bin/varnishd/mgt_param.c
   trunk/varnish-cache/include/shmlog_tags.h
Log:
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.



Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2008-06-20 12:43:45 UTC (rev 2743)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2008-06-20 13:08:52 UTC (rev 2744)
@@ -248,6 +248,8 @@
 		/* 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 @@
 		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.

Modified: trunk/varnish-cache/bin/varnishd/heritage.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/heritage.h	2008-06-20 12:43:45 UTC (rev 2743)
+++ trunk/varnish-cache/bin/varnishd/heritage.h	2008-06-20 13:08:52 UTC (rev 2744)
@@ -159,6 +159,9 @@
 
 	/* Default grace period */
 	unsigned		default_grace;
+
+	/* Log hash string to shm */
+	unsigned		log_hash;
 };
 
 extern volatile struct params *params;

Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_param.c	2008-06-20 12:43:45 UTC (rev 2743)
+++ trunk/varnish-cache/bin/varnishd/mgt_param.c	2008-06-20 13:08:52 UTC (rev 2744)
@@ -743,6 +743,10 @@
 		"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"

Modified: trunk/varnish-cache/include/shmlog_tags.h
===================================================================
--- trunk/varnish-cache/include/shmlog_tags.h	2008-06-20 12:43:45 UTC (rev 2743)
+++ trunk/varnish-cache/include/shmlog_tags.h	2008-06-20 13:08:52 UTC (rev 2744)
@@ -97,3 +97,5 @@
 
 SLTM(ESItrace)
 SLTM(ESI_xmlerror)
+
+SLTM(Hash)




More information about the varnish-commit mailing list