Jdesk / memcached

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

cas+incr integrity bug #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
  Basically, it appears that the integrity of 'cas' is tainted.  Both 
the 'incr' and 'decr' operations do not update the cas ID of the key. 
I realize that this is a fringe case, but I think for something like 
'cas' to be effective and reliable, it needs to stay true to its 
principal.  I should be guaranteed that when the cas command accepts 
my update, that I am replacing the value I think I am.  See below for 
an example of the current behavior: 

set test 0 0 1 
0 
STORED 
gets test 
VALUE test 0 1 2   # CAS ID is 2 
0 
END 
incr test 1 
1 
gets test 
VALUE test 0 1 2   # CAS ID is still 2, despite the key's value 
changing 
1 
END 
cas test 0 0 1 2 
9 
STORED              # This would've succeeded no matter when I got 
that 
cas ID.  It's useless. 
gets test 
VALUE test 0 1 3 
9 
END 

Original issue reported on code.google.com by geni...@gmail.com on 12 Feb 2009 at 1:23

GoogleCodeExporter commented 9 years ago
I've got a failing test for this.  I'll have it fixed soon.

Original comment by dsalli...@gmail.com on 12 Feb 2009 at 1:46

GoogleCodeExporter commented 9 years ago
Reproduced, fixed and pushed as
http://github.com/dustin/memcached/commit/bad6c614e58639d0685706f17dc9562323c30f
39

Original comment by dsalli...@gmail.com on 12 Feb 2009 at 2:05