[memcached] plindner, r497: Merge in rev 496 -- support for verbosit...

commits at code.sixapart.com commits at code.sixapart.com
Thu Apr 12 14:40:19 UTC 2007


Merge in rev 496 -- support for verbosity switching

svn merge -r 495:496 http://code.sixapart.com/svn/memcached/trunk


U   branches/multithreaded/server/ChangeLog
U   branches/multithreaded/server/assoc.c
U   branches/multithreaded/server/doc/protocol.txt
U   branches/multithreaded/server/items.c
U   branches/multithreaded/server/memcached.c
U   branches/multithreaded/server/memcached.h


Modified: branches/multithreaded/server/ChangeLog
===================================================================
--- branches/multithreaded/server/ChangeLog	2007-04-12 14:38:05 UTC (rev 496)
+++ branches/multithreaded/server/ChangeLog	2007-04-12 14:40:18 UTC (rev 497)
@@ -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: branches/multithreaded/server/assoc.c
===================================================================
--- branches/multithreaded/server/assoc.c	2007-04-12 14:38:05 UTC (rev 496)
+++ branches/multithreaded/server/assoc.c	2007-04-12 14:40:18 UTC (rev 497)
@@ -240,23 +240,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: branches/multithreaded/server/doc/protocol.txt
===================================================================
--- branches/multithreaded/server/doc/protocol.txt	2007-04-12 14:38:05 UTC (rev 496)
+++ branches/multithreaded/server/doc/protocol.txt	2007-04-12 14:40:18 UTC (rev 497)
@@ -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: branches/multithreaded/server/items.c
===================================================================
--- branches/multithreaded/server/items.c	2007-04-12 14:38:05 UTC (rev 496)
+++ branches/multithreaded/server/items.c	2007-04-12 14:40:18 UTC (rev 497)
@@ -102,7 +102,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_LOCK();

Modified: branches/multithreaded/server/memcached.c
===================================================================
--- branches/multithreaded/server/memcached.c	2007-04-12 14:38:05 UTC (rev 496)
+++ branches/multithreaded/server/memcached.c	2007-04-12 14:40:18 UTC (rev 497)
@@ -1411,6 +1411,17 @@
     return "DELETED";
 }
 
+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];
@@ -1587,7 +1598,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: branches/multithreaded/server/memcached.h
===================================================================
--- branches/multithreaded/server/memcached.h	2007-04-12 14:38:05 UTC (rev 496)
+++ branches/multithreaded/server/memcached.h	2007-04-12 14:40:18 UTC (rev 497)
@@ -60,6 +60,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