• Kirill Smelkov's avatar
    lib/zodb: Add zconn_at draft (ZODB5 only) · 3bd82127
    Kirill Smelkov authored
    For wendelin.core v2 we need a way to know at which particular database
    state application-level ZODB connection is viewing the database. Knowing
    that state, WCFS client library will interact with WCFS filesystem server
    and, in simple terms, request the server to provide data as of that
    particular database state.
    
    Contrary to ZODB/go[1] ZODB/py does not provide the functionality to
    obtain DB state of connection view, so we have to build it ourselves.
    Let us call the function that for a client ZODB connection returns
    database state corresponding to its database view as zconn_at.
    
    It is relatively easy to implement zconn_at for ZODB5, since ZODB5
    adopted MVCC uniformly and this patch does just that. However even with
    ZODB5 currently all released ZODB5 versions have race in
    Connection.open() vs invalidations[2], and so the first ZODB5 release
    with which zconn_at implemented here will work reliable should be
    upcoming ZODB 5.5.2
    
    It is TODO to implement zconn_at for ZODB4 and ZODB3, which organize
    things differently.
    
    Please note what would happen if zconn_at gives, even a bit, incorrect
    answer: wcfs client will ask wcfs server to provide array data as of
    different database state compared to current on-client ZODB connection.
    This will result in that data accessed via ZBigArray will _not_
    correspond to all other data accessed via regular ZODB mechanism.
    It is, in other words, would be a data corruptions.
    
    [1] https://godoc.org/lab.nexedi.com/kirr/neo/go/zodb#Connection
    [2] https://github.com/zopefoundation/ZODB/issues/290
    3bd82127
zodb.py 8.92 KB