Commit c9658ff3 authored by Julien Muchembled's avatar Julien Muchembled

Importer: fix retrieval of an object from ZODB when next serial in NEO

parent f1bc3c32
...@@ -491,8 +491,11 @@ class ImporterDatabaseManager(DatabaseManager): ...@@ -491,8 +491,11 @@ class ImporterDatabaseManager(DatabaseManager):
# except clause because it would be crazy to import a # except clause because it would be crazy to import a
# NEO DB using this backend. # NEO DB using this backend.
checksum = None checksum = None
return (serial, next_serial or if not next_serial:
db._getNextTID(db._getPartition(u_oid), u_oid, u_tid), next_serial = db._getNextTID(db._getPartition(u_oid), u_oid, u_tid)
if next_serial:
next_serial = p64(next_serial)
return (serial, next_serial,
0, checksum, value, zodb.getDataTid(z_oid, u_tid)) 0, checksum, value, zodb.getDataTid(z_oid, u_tid))
def getTransaction(self, tid, all=False): def getTransaction(self, tid, all=False):
......
...@@ -193,11 +193,20 @@ class ImporterTests(NEOThreadedTest): ...@@ -193,11 +193,20 @@ class ImporterTests(NEOThreadedTest):
cluster.start() cluster.start()
t, c = cluster.getTransaction() t, c = cluster.getTransaction()
r = c.root()["neo"] r = c.root()["neo"]
# Test retrieving of an object from ZODB when next serial in NEO.
r._p_changed = 1
t.commit()
t.begin()
storage = c.db().storage
storage._cache.clear()
storage.loadBefore(r._p_oid, r._p_serial)
##
self.assertRaisesRegexp(NotImplementedError, " getObjectHistory$", self.assertRaisesRegexp(NotImplementedError, " getObjectHistory$",
c.db().history, r._p_oid) c.db().history, r._p_oid)
i = r.walk() i = r.walk()
next(islice(i, 9, None)) next(islice(i, 9, None))
dm.doOperation(cluster.storage) # resume logging.info("start migration")
dm.doOperation(cluster.storage)
deque(i, maxlen=0) deque(i, maxlen=0)
last_import = None last_import = None
for i, r in enumerate(r.treeFromFs(src_root, 10)): for i, r in enumerate(r.treeFromFs(src_root, 10)):
......
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