allen8807 / memcached

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

Binary Delete Stats are not recorded #245

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
***What steps will reproduce the problem?***
1. Start a memcached server 
2. Send a binary packet for deleting "key" via
echo -en 
'\x80\x04\x00\x03\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x0
0\x00\x00\x00\x00\x6b\x65\x79' | nc localhost 11211

3. start a telnet to the server and send "stats" i.e. 
>telnet localhost 11211
>stats

***What is the expected output? What do you see instead?***
-=Expected output =-
[...]
STAT delete_misses 1
STAT delete_hits 0
[...]
END

-=Observed Output=-
[...]
STAT delete_misses 0
STAT delete_hits 0
[...]
END

***What version of the product are you using? On what operating system?***
Memcached 1.4.7 on Ubuntu 11.10 x86

***Please provide any additional information below.***

     The delete stats are recorded when I do an ascii request for a delete, but not when I do a binary request. Looking at the source, the code that increments the delete counter is indeed missing from the code to do a binary delete. More specifically in 

   static void process_bin_delete(conn *c) of [memcached.c]

   after the line "write_bin_response(c, NULL, 0, 0, 0);", there should be this block of code: 

        pthread_mutex_lock(&c->thread->stats.mutex);
        c->thread->stats.delete_misses++;
        pthread_mutex_unlock(&c->thread->stats.mutex);

--Thanks,
Stephen Yang

Original issue reported on code.google.com by step...@uci.edu on 31 Dec 2011 at 1:04

GoogleCodeExporter commented 9 years ago
Thanks for the report! I've fixed this (added hits/misses in the right place) 
and it'll go into 1.4.11

Original comment by dorma...@rydia.net on 12 Jan 2012 at 12:53