Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 220 by [email protected]: Binary Increment returns old cas
http://code.google.com/p/memcached/issues/detail?id=220
What steps will reproduce the problem?
1. Send the following byte stream (which is interpreted by Memcached to be
SET where key="Bob" and val="100"
0x80 0x01 0x00 0x03
0x08 0x00 0x00 0x00
0x00 0x00 0x00 0x0e
0xde 0xad 0xbe 0xef
0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00
0xc8 0x11 0x00 0x00
0x00 0x00 0x00 0x00
0x42 0x6f 0x62 0x31
0x30 0x30
2. Send the Increment with increment size = 999
0x80 0x01 0x00 0x03
0x08 0x00 0x00 0x00
0x00 0x00 0x00 0x0e
0xde 0xad 0xbe 0xef
0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00
0xc8 0x11 0x00 0x00
0x00 0x00 0x00 0x00
0x42 0x6f 0x62 0x31
0x30 0x30
What is the expected output? What do you see instead?
I expect the cas to be incremented; instead I see the old cas. However,
when I do the next get, it returns the new, correct cas.
==Expected byte stream==
0x81 0x05 0x00 0x00
0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x08
0xde 0xad 0xbe 0xef
0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x02
0x00 0x00 0x00 0x00
0x00 0x00 0x04 0x4b
==Observed byte stream==
0x81 0x05 0x00 0x00
0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x08
0xde 0xad 0xbe 0xef
0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x01
0x00 0x00 0x00 0x00
0x00 0x00 0x04 0x4b
What version of the product are you using? On what operating system?
memcached 1.4.5 on Ubuntu 11.04 x64
Please provide any additional information below.
I've looked at the source code, and it appears that the problem resides in
how the logic in do_add_delta will give the the new cas to new_it and the
function that sends the response, complete_incr_bin, will read it from the
original item, it.