Commit ca480ebd authored by Christian Theune's avatar Christian Theune

First part of the fix for #181712.

parent e61af093
......@@ -35,6 +35,9 @@ New Features
Bugs Fixed
----------
- Fix for bug #181712: Make ClientStorage update `lastTransaction` directly
after connecting to a server, even when no cache verification is necessary.
- Fixed bug in blob filesystem helper: the `isSecure` check was inversed.
- Fixed bug in transaction buffer: a tuple was unpacked incorrectly in
......
......@@ -567,21 +567,22 @@ class ClientStorage(object):
The return value (indicating which path we took) is used by
the test suite.
"""
# If verify_cache() finishes the cache verification process,
# it should set self._server. If it goes through full cache
# verification, then endVerify() should self._server.
# verification, then endVerify() should set self._server.
ltid = server.lastTransaction()
if not self._cache:
log2("No verification necessary -- empty cache")
self._server = server
if ltid and ltid != utils.z64:
self._cache.setLastTid(ltid)
self._ready.set()
return "full verification"
last_inval_tid = self._cache.getLastTid()
if last_inval_tid is not None:
ltid = server.lastTransaction()
if ltid == last_inval_tid:
log2("No verification necessary (last_inval_tid up-to-date)")
self._server = server
......
......@@ -57,10 +57,12 @@ import ZEO.StorageServer
logger = logging.getLogger('ZEO.tests.testZEO')
class DummyDB:
def invalidate(self, *args):
pass
class OneTimeTests(unittest.TestCase):
def checkZEOVersionNumber(self):
......@@ -128,6 +130,23 @@ class MiscZEOTests:
finally:
storage2.close()
def checkVolatileCacheWithImmediateLastTransaction(self):
# Earlier, a ClientStorage would not have the last transaction id
# available right after successful connection, this is required now.
addr = self._storage._addr
storage2 = ClientStorage(addr)
self.assert_(storage2.is_connected())
self.assertEquals(None, storage2.lastTransaction())
storage2.close()
self._dostore()
storage3 = ClientStorage(addr)
self.assert_(storage3.is_connected())
self.assertEquals(8, len(storage3.lastTransaction()))
self.assertNotEquals(ZODB.utils.z64, storage3.lastTransaction())
storage3.close()
def get_port():
"""Return a port that is not in use.
......@@ -645,9 +664,9 @@ class BlobAdaptedFileStorageTests(GenericTests, CommonBlobTests):
]
[thread.start() for thread in threads]
[thread.join() for thread in threads]
[self.assertEqual(r, filename) for r in returns]
[self.assertEqual(r, filename) for r in returns]
check_data(filename)
class BlobWritableCacheTests(GenericTests, CommonBlobTests):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment