Commit 1f866c00 authored by Kirill Smelkov's avatar Kirill Smelkov

lib/zodb: Teach zconn_at to work on ZODB4

In 3bd82127 (lib/zodb: Add zconn_at draft (ZODB5 only)) we added
zconn_at function to find out as of which state a ZODB connection is
viewing the database. That was ZODB5-only however.

Let's add support for ZODB4 now - by requiring ZODB4-wc2 - a version of
ZODB4 with MVCC backported from ZODB5: nexedi/ZODB!1

This makes wendelin.core to work on either ZODB5 or ZODB4-wc2, but not
plain ZODB4. However as zconn_at will be used only for WCFS-integration,
non-wcfs mode will continue to work on all ZODB5, ZODB4-wc2 and plain
ZODB4.

ZBigFile + WCFS client integration will use zconn_at to open WCFS
connection that corresponds to ZODB connection.

Preliminary history:

kirr/wendelin.core@1c3b7750    X zconn_at for ZODB4
parent 1dba3a9a
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# #
# See COPYING file for full licensing terms. # See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
from wendelin.lib.zodb import LivePersistent, deactivate_btree, dbclose, zconn_at, zstor_2zurl, zmajor from wendelin.lib.zodb import LivePersistent, deactivate_btree, dbclose, zconn_at, zstor_2zurl
from wendelin.lib.testing import getTestDB from wendelin.lib.testing import getTestDB
from wendelin.lib import testing from wendelin.lib import testing
from persistent import Persistent, UPTODATE, GHOST, CHANGED from persistent import Persistent, UPTODATE, GHOST, CHANGED
...@@ -236,7 +236,6 @@ def test_deactivate_btree(): ...@@ -236,7 +236,6 @@ def test_deactivate_btree():
# verify that zconn_at gives correct answer. # verify that zconn_at gives correct answer.
@xfail(zmajor < 5, reason="zconn_at is TODO for ZODB4")
@func @func
def test_zconn_at(): def test_zconn_at():
stor = testdb.getZODBStorage() stor = testdb.getZODBStorage()
......
...@@ -156,18 +156,18 @@ def zconn_at(zconn): # -> tid ...@@ -156,18 +156,18 @@ def zconn_at(zconn): # -> tid
# ZODB4 # ZODB4
# #
# Connection: # We rely on our patch in 4-nxd branch that reworks ZODB.Connection to
# .before !None for historic connections # implement MVCC via always calling loadBefore(zconn._txn_time) to load objects.
#
# ._txn_time - if !None - set to tid of _next_ transaction
# XXX set to None initially - what to do?
#
# # XXX do something like that ZODB5 is doing:
# zconn._start = zconn._storage.lastTransaction() + 1
# # XXX _and_ check out queued invalidations
elif zmajor == 4: elif zmajor == 4:
raise AssertionError("zconn_at: TODO: add support for ZODB4") assert 'conn:MVCC-via-loadBefore-only' in ZODB.nxd_patches, \
"https://lab.nexedi.com/nexedi/ZODB/merge_requests/1"
if zconn._mvcc_storage:
raise NotImplementedError("Connection.at for IMVCCStorage is not implemented")
if zconn.before is not None:
return before2at(zconn.before) # historical connection
else:
return before2at(zconn._txn_time) # "current" connection
# ZODB3 # ZODB3
else: else:
......
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