Skip to content

Commit

Permalink
Merge pull request #25 from zopefoundation/zodb5
Browse files Browse the repository at this point in the history
Zodb5
  • Loading branch information
jimfulton committed Jun 15, 2016
2 parents 6d05cc1 + b793437 commit 2952501
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/ZEO/ClientStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,8 @@ def end_transaction(self):
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."""
Expand Down Expand Up @@ -1388,6 +1389,15 @@ def verify_cache(self, server):
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):
Expand Down Expand Up @@ -1465,11 +1475,12 @@ def _process_invalidations(self, tid, oids):
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):
Expand Down
2 changes: 1 addition & 1 deletion src/ZEO/tests/testZEO.py
Original file line number Diff line number Diff line change
Expand Up @@ -1468,9 +1468,9 @@ def invalidate_client_cache_entry_on_server_commit_error():
>>> sorted(conn2.root.x.items())
[('x', 1), ('y', 1)]
>>> conn2.close()
>>> cs.close()
>>> conn1.close()
"""


Expand Down

0 comments on commit 2952501

Please sign in to comment.