Commit 77a84f9d authored by Christian Theune's avatar Christian Theune

First part of the fix for #181712.

parent d6ff8d25
...@@ -35,6 +35,9 @@ New Features ...@@ -35,6 +35,9 @@ New Features
Bugs Fixed 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 blob filesystem helper: the `isSecure` check was inversed.
- Fixed bug in transaction buffer: a tuple was unpacked incorrectly in - Fixed bug in transaction buffer: a tuple was unpacked incorrectly in
......
...@@ -567,21 +567,22 @@ class ClientStorage(object): ...@@ -567,21 +567,22 @@ class ClientStorage(object):
The return value (indicating which path we took) is used by The return value (indicating which path we took) is used by
the test suite. the test suite.
""" """
# If verify_cache() finishes the cache verification process, # If verify_cache() finishes the cache verification process,
# it should set self._server. If it goes through full cache # 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: if not self._cache:
log2("No verification necessary -- empty cache") log2("No verification necessary -- empty cache")
self._server = server self._server = server
if ltid and ltid != utils.z64:
self._cache.setLastTid(ltid)
self._ready.set() self._ready.set()
return "full verification" return "full verification"
last_inval_tid = self._cache.getLastTid() last_inval_tid = self._cache.getLastTid()
if last_inval_tid is not None: if last_inval_tid is not None:
ltid = server.lastTransaction()
if ltid == last_inval_tid: if ltid == last_inval_tid:
log2("No verification necessary (last_inval_tid up-to-date)") log2("No verification necessary (last_inval_tid up-to-date)")
self._server = server self._server = server
......
...@@ -57,10 +57,12 @@ import ZEO.StorageServer ...@@ -57,10 +57,12 @@ import ZEO.StorageServer
logger = logging.getLogger('ZEO.tests.testZEO') logger = logging.getLogger('ZEO.tests.testZEO')
class DummyDB: class DummyDB:
def invalidate(self, *args): def invalidate(self, *args):
pass pass
class OneTimeTests(unittest.TestCase): class OneTimeTests(unittest.TestCase):
def checkZEOVersionNumber(self): def checkZEOVersionNumber(self):
...@@ -128,6 +130,23 @@ class MiscZEOTests: ...@@ -128,6 +130,23 @@ class MiscZEOTests:
finally: finally:
storage2.close() 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(): def get_port():
"""Return a port that is not in use. """Return a port that is not in use.
......
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