Commit b8666c09 authored by Joshua Woelfel's avatar Joshua Woelfel

Fixed problem with initializing db's latest state field

parent 1c1688c0
...@@ -179,13 +179,8 @@ def zconn_at(zconn): # -> tid ...@@ -179,13 +179,8 @@ def zconn_at(zconn): # -> tid
raise AssertionError("zconn_at: TODO: add support for zstor %r" % zstor) raise AssertionError("zconn_at: TODO: add support for zstor %r" % zstor)
# ZODB3, ZODB4 elif zmajor == 4:
# if not zconn.before
# If historic connection, convert and return zconn.before. Otherwise
# returns tid of last transaction, if viewing latest db state, or if
# later db state exists, returns tid of db state previous to later
# state
else:
zconn._inv_lock.acquire() zconn._inv_lock.acquire()
try: try:
viewed_state = zconn.viewed_db_state viewed_state = zconn.viewed_db_state
...@@ -193,6 +188,10 @@ def zconn_at(zconn): # -> tid ...@@ -193,6 +188,10 @@ def zconn_at(zconn): # -> tid
zconn._inv_lock.release() zconn._inv_lock.release()
return viewed_state return viewed_state
# TODO ZODB3
else:
pass
# before2at converts tid that specifies database state as "before" into tid that # before2at converts tid that specifies database state as "before" into tid that
# specifies database state as "at". # specifies database state as "at".
def before2at(before): # -> at def before2at(before): # -> at
...@@ -342,7 +341,9 @@ if zmajor == 4: ...@@ -342,7 +341,9 @@ if zmajor == 4:
self.history(z64) self.history(z64)
self._a() self._a()
try: try:
if self.latest_state is None: # initialize latest_state with last_tid if not yet initialized
# during invalidation process
if not hasattr(self, 'latest_state'):
self.latest_state = last_tid self.latest_state = last_tid
finally: finally:
self._r() self._r()
......
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