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

phk at projects.linpro.no phk at projects.linpro.no
Wed Sep 30 10:38:08 CEST 2009


Author: phk
Date: 2009-09-30 10:38:07 +0200 (Wed, 30 Sep 2009)
New Revision: 4264

Modified:
   trunk/varnish-cache/bin/varnishd/shmlog.c
   trunk/varnish-cache/include/shmlog.h
Log:
Ohh, this tiny men with their mighty machines:

Increase the ID field in the shmlog records from 16 to 32 bits to cater
for 64k+ connections.

Both varnishd and libvarnishapi needs to be recompiled, but apps should
not need to.



Modified: trunk/varnish-cache/bin/varnishd/shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/shmlog.c	2009-09-29 17:07:35 UTC (rev 4263)
+++ trunk/varnish-cache/bin/varnishd/shmlog.c	2009-09-30 08:38:07 UTC (rev 4264)
@@ -86,10 +86,11 @@
 
 	assert(loghead->magic == SHMLOGHEAD_MAGIC);
 	assert(len < 0x10000);
-	assert(id < 0x10000);
 	p[__SHMLOG_LEN_HIGH] = (len >> 8) & 0xff;
 	p[__SHMLOG_LEN_LOW] = len & 0xff;
-	p[__SHMLOG_ID_HIGH] = (id >> 8) & 0xff;
+	p[__SHMLOG_ID_HIGH] = (id >> 24) & 0xff;
+	p[__SHMLOG_ID_MEDHIGH] = (id >> 16) & 0xff;
+	p[__SHMLOG_ID_MEDLOW] = (id >> 8) & 0xff;
 	p[__SHMLOG_ID_LOW] = id & 0xff;
 	p[SHMLOG_DATA + len] = '\0';
 	p[SHMLOG_NEXTTAG + len] = SLT_ENDMARKER;

Modified: trunk/varnish-cache/include/shmlog.h
===================================================================
--- trunk/varnish-cache/include/shmlog.h	2009-09-29 17:07:35 UTC (rev 4263)
+++ trunk/varnish-cache/include/shmlog.h	2009-09-30 08:38:07 UTC (rev 4264)
@@ -73,7 +73,7 @@
  *
  *	1 byte		field type (enum shmlogtag)
  *	2 bytes		length of contents
- *	2 bytes		record identifier
+ *	4 bytes		record identifier
  *	n bytes		field contents (isgraph(c) || isspace(c)) allowed.
  */
 
@@ -81,12 +81,18 @@
 #define __SHMLOG_LEN_HIGH	1
 #define __SHMLOG_LEN_LOW	2
 #define __SHMLOG_ID_HIGH	3
-#define __SHMLOG_ID_LOW	4
-#define SHMLOG_DATA	5
-#define SHMLOG_NEXTTAG	6	/* ... + len */
+#define __SHMLOG_ID_MEDHIGH	4
+#define __SHMLOG_ID_MEDLOW	5
+#define __SHMLOG_ID_LOW		6
+#define SHMLOG_DATA		7
+#define SHMLOG_NEXTTAG		8	/* ... + len */
 
 #define SHMLOG_LEN(p)	(((p)[__SHMLOG_LEN_HIGH] << 8) | (p)[__SHMLOG_LEN_LOW])
-#define SHMLOG_ID(p)	(((p)[__SHMLOG_ID_HIGH] << 8) | (p)[__SHMLOG_ID_LOW])
+#define SHMLOG_ID(p)	( \
+	((p)[__SHMLOG_ID_HIGH] << 24) | \
+	((p)[__SHMLOG_ID_MEDHIGH] << 16) | \
+	((p)[__SHMLOG_ID_MEDLOW] << 8) | \
+	 (p)[__SHMLOG_ID_LOW])
 
 /*
  * The identifiers in shmlogtag are "SLT_" + XML tag.  A script may be run



More information about the varnish-commit mailing list