• Kirill Smelkov's avatar
    bigfile: ZODB -> BigFileH invalidate propagation · 92bfd03e
    Kirill Smelkov authored
    Continuing theme from the previous patch, here is propagation of
    invalidation messages from ZODB to BigFileH memory.
    
    The use-case here is that e.g. one fileh mapping was created in one
    connection, another in another, and after doing changes in second
    connection and committing there, the first fileh has to invalidate
    appropriate already-loaded pages, so its next transaction won't work
    with stale data.
    
    To do it, we hook into ZBlk._p_invalidate() and propagate the
    invalidation message to ZBigFile which then notifies all
    opened-through-it ZBigFileH to invalidate a page.
    
    ZBlk -> ZBigFile lookup is done without storing backpointer in ZODB -
    instead, every time ZBigFile touches ZBlk object (and thus potentially
    does GHOST -> Live transition to it), we (re-)bind it back to ZBigFile.
    Since ZBigFile is the only class that works with ZBlk objects it is safe
    to do so.
    
    For ZBigFile to notify "all-opened-through-it" ZBigFileH, a weakset is
    introduced to track them.
    
    Otherwise the real page invalidation work is done by virtmem (see
    previous patch).
    92bfd03e
_bigfile.c 26.1 KB