Commit e514617a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a5130f26
......@@ -47,13 +47,15 @@ import sys
from golang import func, defer, panic
from golang import time
from ZODB import DB
from ZODB.Connection import Connection
import transaction
import random
from wendelin.wcfs.internal import xbtree
from wendelin.bigfile.file_zodb import ZBlk
from zodbtools.util import storageFromURL
from zodbtools.util import storageFromURL, ashex
from persistent import CHANGED
from persistent.mapping import PersistentMapping
import BTrees.LOBTree
......@@ -119,7 +121,16 @@ def patch(d, diff, verify):
def commit(description):
txn = transaction.get()
txn.description = description
# XXX hack to retrieve committed transaction ID via ._p_serial of object changed in this transaction
assert len(txn._resources) == 1
zconn = txn._resources[0]
assert isinstance(zconn, Connection)
assert len(zconn._added) > 0
k = set(zconn._added.keys()).pop()
obj = zconn._added[k]
assert obj._p_state == CHANGED
txn.commit()
return obj._p_serial
# treetxt returns text representation of a tree.
......@@ -212,8 +223,8 @@ def treedeltaGenAllStructs(zstor, kv1txt, kv2txt, n):
xbtree.Restructure(ztree, tstruct)
ttxt_prev = ttxt
ttxt = treetxt(ztree)
commit('%s -> %s' % (ttxt_prev, ttxt))
# XXX printδ
tid = commit('%s -> %s' % (ttxt_prev, ttxt))
print('txn %s # %s -> %s' % (ashex(tid), ttxt_prev, ttxt))
......
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