[ZEO4] Fixed: were sending out of date size info on commit
This is ZEO4 backport of commit 8d7b1ceb ("Fixed: were sending out of date size info on commit", 2016-06-21) needed to get tests passing after previous patch. It is needed because BasicStorage.checkLen was previously passing just by luck because transactions in that test only create objects, and the test is tolerating storages that do not update their len at all. Before previous patch, if ZEOStorage.invalidated was == [], neither invalidateTransaction, _nor_ info messages were sent (which is incorrect since when object is created len has to be adjusted too). After previous patch we always delve into sending invalidateTransaction and info, but, since ZEOStorage._invalidate is called from under tpc_finish, storage sizes are not yet updated and get_info retrieves len from previous - not for committed - transaction, leading to errors like: Failure in test checkLen (ZEO.tests.testZEO.DemoStorageTests) Traceback (most recent call last): File "/usr/lib/python2.7/unittest/case.py", line 329, in run testMethod() File "/home/kirr/src/wendelin/z/ZODB4/src/ZODB/tests/BasicStorage.py", line 175, in checkLen self.assertIn(len(self._storage), [0,2]) File "/usr/lib/python2.7/unittest/case.py", line 804, in assertIn self.fail(self._formatMessage(msg, standardMsg)) File "/usr/lib/python2.7/unittest/case.py", line 410, in fail raise self.failureException(msg) AssertionError: 1 not found in [0, 2] Original description follows: ---- 8< ---- (original description) Because we were computing the size info in the commit callback, which might be before before the inderlying data were committed. This caused the computation to be wrong in some cases. Instead we get and send the size information after committing.
Showing