[ZODB-Dev] zeo.memcache

Shane Hathaway shane at hathawaymix.org
Wed Oct 12 18:12:22 UTC 2011


On 10/12/2011 04:53 PM, Shane Hathaway wrote:
> Given the choice to structure the cache as {(oid, tid): (state,
> last_tid)}, a simple way to use the cache would be to get the last
> committed tid from the database and use that tid for the lookup key.
> This would be extremely efficient until the next commit, at which point
> the entire cache would become irrelevant and would have to be rebuilt.
>
> Therefore, most of the interesting parts of the cache code in RelStorage
> are focused on simply choosing a good tid for the cache lookup operation.

Furthermore... anytime the cache chooses a tid other than the most 
recently committed tid for the lookup operation, there is a risk that it 
will choose a tid that is too old, leading to consistency errors. I have 
searched deeply for any such holes and closed some obscure ones, but 
it's important to acknowledge the risk.

(BTW, I worked with a client who saw many consistency errors that seemed 
to be caused by the cache, but the problem turned out to be a major flaw 
in Oracle's documentation of read only mode. The cache operated flawlessly.)

Shane


More information about the ZODB-Dev mailing list