Commit 2952501b authored by Jim Fulton's avatar Jim Fulton Committed by GitHub

Merge pull request #25 from zopefoundation/zodb5

Zodb5
parents 6d05cc16 b793437a
......@@ -1119,7 +1119,8 @@ class ClientStorage(object):
self._tpc_cond.release()
def lastTransaction(self):
return self._cache.getLastTid()
with self._lock:
return self._cache.getLastTid()
def tpc_abort(self, txn):
"""Storage API: abort a transaction."""
......@@ -1388,6 +1389,15 @@ class ClientStorage(object):
for oid, tid in self._cache.contents():
server.verify(oid, tid)
server.endZeoVerify()
with self._lock:
if server_tid > self._cache.getLastTid():
# We verified the cache, and got no new invalidations
# while doing so. The records in the cache are valid,
# in that invalid current records were invalidated,
# but the last tid is wrong. Let's fix it:
self._cache.setLastTid(server_tid)
return "full verification"
def invalidateVerify(self, oid):
......@@ -1465,11 +1475,12 @@ class ClientStorage(object):
if oid == self._load_oid:
self._load_status = 0
self._cache.invalidate(oid, tid)
self._cache.setLastTid(tid)
if self._db is not None:
self._db.invalidate(tid, oids)
self._cache.setLastTid(tid)
# The following are for compatibility with protocol version 2.0.0
def invalidateTrans(self, oids):
......
......@@ -1468,9 +1468,9 @@ But, if we abort, we'll get up to date data and we'll see the changes.
>>> sorted(conn2.root.x.items())
[('x', 1), ('y', 1)]
>>> conn2.close()
>>> cs.close()
>>> conn1.close()
"""
......
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