I would always suggest updating your persistent storage first, then
updating the cache when the database transaction is committed. Updating
the cache any sooner than the DB transaction commit exposes data that could
be incorrect and thus is problematic. That doesn't really help you with
your current problem, but it can help avoid it happening again.
Brandon Ramirez | Office: 585.214.5013 | Fax: 585.295.4848
Software Engineer II | Element K | www.elementk.com
From: StephenChan <[email protected]>
To: [email protected]
Date: 12/21/2009 12:51 PM
Subject: Re: How to get data after execute flush_all?
Sent by: [email protected]
Hi Matt ,thanks for your reply!
Actually, my situation is something like "data recovery", before I save the
data into database, I executed "flush_all" command, and now I need to get
the data of the memory and push them into database. As the ref says, "The
most precise definition of what flush_all does is the following: it causes
all items whose update time is earlier than the time at which flush_all was
set to be executed to be ignored for retrieval purposes." . The memcached
just ignored the get request for the data that have been flushed,
according to the update time, but the data remains intact in memory,
besides to gcore the memcached process image, is there any other way such
as change os time or something to recovery the data from memory ?
2009/12/22 Matt Ingenthron <[email protected]>
Stephen wrote:
Hi, everyone:
In my project, I execute the "flush_all" command with careless,
however, the data in the memcache is important for me, it has not to
be saved into database.
And I read the doc, it says " flush_all doesn't actually free all
the memory taken up by existing items; that will happen gradually as
new items are stored." Since the memcache just use a half of the
memory allocated, I think the data which are not saved into database
may be still in the MEMORY, so is there anyone tell me how I could get
the data ?
There is no method of doing so designed for users, but there are a couple
of things underneath. It sounds like you're in a "data recovery" type
situation. This being the case, I might recommend you use gcore to get a
core of the running memcached process(es) so you'll have something point
in time stable you can later use a debugger to get the data out of.
If I misunderstand and you're looking to do this on a regular basis or as
part of some recovery plan for your database, please give us some more
info on what you want your app to do and we may be able to help point you
to a solution that doesn't require getting to all of the items in the
cache.
Hope that helps,
- Matt