flush_all is broken?
blais at furius.ca
Sat May 13 21:49:38 UTC 2006
This will break with memcached-1.1.12:
# Have some data, will store.
value = ("Some value",)
# Connect to memcached.
mc = memcache.Client(['127.0.0.1:11211'], debug=0)
# Flush everything (this triggers the bug).
# Set the value.
# Get it.
newvalue = mc.get("some_key")
# Check that we have what we stored.
assert newvalue == value ## <-- fails!
Am I missing something about the meaning of flush_all?
I just tested with 1.1.13-pre, and I get the same problem.
Here is the verbose output from the server:
<7 new client connection
<7 set some_key 1 0 20
<7 get some_key
<7 connection closed.
(Rummaging in the code)
Ah, found it, the problem is due to the resolution of the
clock (1 second) and the way that the flush_all is
implemented. It simply sets the oldest's time to NOW, but
the set/get that follow also happen within that second,
and the get is thus ignored. Looking at it more, I think
that the O(1) flush_all implementation is not possible at
Any commments/info welcome.
More information about the memcached