Jdesk / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

Unnecessary stats locks around flushes. #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Since stats are thread-local, there should be no reason to lock them.  I've
got a patch that updates them in my issue_whatever_number_this_is branch
(over issue_71).  Looks like this:

diff --git a/memcached.c b/memcached.c
index 6edc481..b6b5312 100644
--- a/memcached.c
+++ b/memcached.c
@@ -1764,9 +1764,7 @@ static void process_bin_flush(conn *c) {
     }
     item_flush_expired();

-    STATS_LOCK();
     c->thread->stats.flush_cmds++;
-    STATS_UNLOCK();

     write_bin_response(c, NULL, 0, 0, 0);
 }
@@ -2778,9 +2776,7 @@ static void process_command(conn *c, char *command) {

         set_noreply_maybe(c, tokens, ntokens);

-        STATS_LOCK();
         c->thread->stats.flush_cmds++;
-        STATS_UNLOCK();

         if(ntokens == (c->noreply ? 3 : 2)) {
             settings.oldest_live = current_time - 1;

Original issue reported on code.google.com by dsalli...@gmail.com on 18 Aug 2009 at 5:51

GoogleCodeExporter commented 9 years ago

Original comment by dsalli...@gmail.com on 18 Aug 2009 at 5:51

GoogleCodeExporter commented 9 years ago
Can someone take a look at this and tell me if I'm doing this wrong?

Original comment by dsalli...@gmail.com on 18 Aug 2009 at 6:13

GoogleCodeExporter commented 9 years ago
Pushed.

Original comment by dsalli...@gmail.com on 19 Aug 2009 at 9:40

GoogleCodeExporter commented 9 years ago
Pushed.

Original comment by dsalli...@gmail.com on 19 Aug 2009 at 9:40