[memcached] plindner, r496: Add patch for changable verbosity levels
commits at code.sixapart.com
commits at code.sixapart.com
Thu Apr 12 14:38:06 UTC 2007
Add patch for changable verbosity levels
U trunk/server/ChangeLog
U trunk/server/assoc.c
U trunk/server/doc/protocol.txt
U trunk/server/items.c
U trunk/server/memcached.c
U trunk/server/memcached.h
Modified: trunk/server/ChangeLog
===================================================================
--- trunk/server/ChangeLog 2007-04-10 14:58:42 UTC (rev 495)
+++ trunk/server/ChangeLog 2007-04-12 14:38:05 UTC (rev 496)
@@ -1,3 +1,9 @@
+2007-04-12 Paul Lindner <lindner at mirth.inuus.com>
+
+ * Allow changes to the verbosity level of the server with a new
+ "verbosity" command. Patch contributed by Paolo Borelli
+ <paolo.borelli at gmail.com>.
+
2007-04-08 Paul Lindner <lindner at inuus.com>
* Add cleanup patch from "Tim Yardley" <liquid at haveheart.com> to
Modified: trunk/server/assoc.c
===================================================================
--- trunk/server/assoc.c 2007-04-10 14:58:42 UTC (rev 495)
+++ trunk/server/assoc.c 2007-04-12 14:38:05 UTC (rev 496)
@@ -245,23 +245,23 @@
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
- case 10: c+=k[4];
+ case 11: c+=((uint32_t)k8[10])<<16; /* @fallthrough */
+ case 10: c+=k[4]; /* @fallthrough@ */
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 9 : c+=k8[8]; /* fall through */
+ case 9 : c+=k8[8]; /* @fallthrough */
case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
+ case 7 : b+=((uint32_t)k8[6])<<16; /* @fallthrough */
case 6 : b+=k[2];
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 5 : b+=k8[4]; /* fall through */
+ case 5 : b+=k8[4]; /* @fallthrough */
case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
+ case 3 : a+=((uint32_t)k8[2])<<16; /* @fallthrough */
case 2 : a+=k[0];
break;
case 1 : a+=k8[0];
Modified: trunk/server/doc/protocol.txt
===================================================================
--- trunk/server/doc/protocol.txt 2007-04-10 14:58:42 UTC (rev 495)
+++ trunk/server/doc/protocol.txt 2007-04-12 14:38:05 UTC (rev 496)
@@ -399,7 +399,15 @@
"VERSION <version>\r\n", where <version> is the version string for the
server.
+"verbosity" is a command with one argument, the verbosity level:
+verbosity 2\r\n
+
+In response, the server sends
+
+"DONE"
+
+
"quit" is a command with no arguments:
quit\r\n
Modified: trunk/server/items.c
===================================================================
--- trunk/server/items.c 2007-04-10 14:58:42 UTC (rev 495)
+++ trunk/server/items.c 2007-04-12 14:38:05 UTC (rev 496)
@@ -96,7 +96,7 @@
if (id > LARGEST_ID) return NULL;
if (tails[id] == 0) return NULL;
- for (search = tails[id]; tries > 0 && search; tries--, search=search->prev) {
+ for (search = tails[id]; tries > 0 && search != NULL; tries--, search=search->prev) {
if (search->refcount == 0) {
if (search->exptime > current_time)
stats.evictions++;
Modified: trunk/server/memcached.c
===================================================================
--- trunk/server/memcached.c 2007-04-10 14:58:42 UTC (rev 495)
+++ trunk/server/memcached.c 2007-04-12 14:38:05 UTC (rev 496)
@@ -1322,6 +1322,17 @@
return;
}
+static void process_verbosity_command(conn *c, token_t *tokens, const size_t ntokens) {
+ unsigned int level;
+
+ assert(c != NULL);
+
+ level = strtoul(tokens[1].value, NULL, 10);
+ settings.verbose = level > MAX_VERBOSITY_LEVEL ? MAX_VERBOSITY_LEVEL : level;
+ out_string(c, "DONE");
+ return;
+}
+
static void process_command(conn *c, char *command) {
token_t tokens[MAX_TOKENS];
@@ -1498,7 +1509,8 @@
#else
out_string(c, "CLIENT_ERROR Slab reassignment not supported");
#endif
-
+ } else if (ntokens == 3 && (strcmp(tokens[COMMAND_TOKEN].value, "verbosity") == 0)) {
+ process_verbosity_command(c, tokens, ntokens);
} else {
out_string(c, "ERROR");
}
Modified: trunk/server/memcached.h
===================================================================
--- trunk/server/memcached.h 2007-04-10 14:58:42 UTC (rev 495)
+++ trunk/server/memcached.h 2007-04-12 14:38:05 UTC (rev 496)
@@ -54,6 +54,8 @@
unsigned long long bytes_written;
};
+#define MAX_VERBOSITY_LEVEL 2
+
struct settings {
size_t maxbytes;
int maxconns;
More information about the memcached-commits
mailing list