• Julien Muchembled's avatar
    mvccadapter: check if the last TID changed without invalidation · 4a6b0283
    Julien Muchembled authored
    Since commit b5895a5c ("mvccadapter:
    fix race with invalidations when starting a new transaction"),
    a ZEO test fails as follows:
    
        File "src/ZEO/tests/drop_cache_rather_than_verify.txt", line 114, in drop_cache_rather_than_verify.txt
        Failed example:
            conn.root()[1].x
        Expected:
            6
        Got:
            1
    
    Earlier in the test, the ZEO server is restarted and then another
    client commits. When disconnected, the first client does not receive
    invalidations anymore and the connection gets stuck in the past until
    there's a new commit after it reconnected. It was possible to make the
    test pass with the following patch:
    
    --- a/src/ZEO/ClientStorage.py
    +++ b/src/ZEO/ClientStorage.py
    @@ -357,6 +357,7 @@ def notify_connected(self, conn, info):
    
             # invalidate our db cache
             if self._db is not None:
    +            self._db.invalidate(self.lastTransaction(), ())
                 self._db.invalidateCache()
    
             logger.info("%s %s to storage: %s",
    
    Other implementations like NEO are probably affected the same way.
    
    Rather than changing interfaces in a backward-incompatible way,
    this commit revert to the original behaviour, and all the changes
    that were done in existing tests are reverted.
    
    However, the interfaces are clarified about the fact that storage
    implementations must update at a precise moment the value that is
    returned by lastTransaction(): just after invalidate() or
    tpc_finish callback.
    4a6b0283
mvccadapter.py 8.06 KB