Commit 6ec94d4d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3563e821
...@@ -227,6 +227,12 @@ def TreesSrv(zstor, r): ...@@ -227,6 +227,12 @@ def TreesSrv(zstor, r):
xprint("%s" % ashex(head)) xprint("%s" % ashex(head))
continue continue
# make sure we continue with undeleted ztree/zfile
if deleted(ztree):
undelete(ztree)
if deleted(zfile):
undelete(zfile)
# t... D... commands to natively commit updates to tree and values # t... D... commands to natively commit updates to tree and values
if treetxt.startswith('t'): if treetxt.startswith('t'):
t, D = treetxt.split() t, D = treetxt.split()
...@@ -486,8 +492,18 @@ def commitDelete(obj, description): # -> tid ...@@ -486,8 +492,18 @@ def commitDelete(obj, description): # -> tid
# reset transaction to a new one # reset transaction to a new one
transaction.begin() transaction.begin()
obj._v_deleted = True
return tid return tid
# deleted reports whether obj was deleted via commitDelete.
def deleted(obj): # -> bool
return getattr(obj, '_v_deleted', False)
# undelete forces recreation for obj that was previously deleted via commitDelete.
def undelete(obj):
obj._p_changed = True
del obj._v_deleted
# ztreetxt returns text representation of a ZODB tree. # ztreetxt returns text representation of a ZODB tree.
@func(ZCtx) @func(ZCtx)
......
...@@ -306,6 +306,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) { ...@@ -306,6 +306,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
if err != nil { if err != nil {
return ΔF{}, err return ΔF{}, err
} }
//fmt.Printf("zfile<%s> diff %s..%s -> δ: %v\n", oid, headOld, δZ.Tid, δ)
if δ != nil { if δ != nil {
// XXX rebuild first // XXX rebuild first
...@@ -550,6 +551,7 @@ func (δFtail *ΔFtail) LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64, ...@@ -550,6 +551,7 @@ func (δFtail *ΔFtail) LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64,
func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64, at zodb.Tid) (_ zodb.Tid, exact bool, err error) { func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64, at zodb.Tid) (_ zodb.Tid, exact bool, err error) {
defer xerr.Contextf(&err, "blkrev f<%s> #%d @%s", zf.POid(), blk, at) defer xerr.Contextf(&err, "blkrev f<%s> #%d @%s", zf.POid(), blk, at)
//fmt.Printf("\nblkrev #%d @%s\n", blk, at)
// XXX locking // XXX locking
// XXX rebuild // XXX rebuild
...@@ -557,6 +559,7 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64 ...@@ -557,6 +559,7 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64
// find epoch that covers at and associated blktab root/object // find epoch that covers at and associated blktab root/object
vδE := δftail.vδE vδE := δftail.vδE
//fmt.Printf(" vδE: %v\n", vδE)
l := len(vδE) l := len(vδE)
i := sort.Search(l, func(i int) bool { i := sort.Search(l, func(i int) bool {
return at < vδE[i].Rev return at < vδE[i].Rev
...@@ -595,6 +598,8 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64 ...@@ -595,6 +598,8 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64
epoch = vδE[i].Rev epoch = vδE[i].Rev
} }
//fmt.Printf(" epoch: @%s root: %s\n", epoch, root)
// get to rootObj (NOTE @head, because it is ΔBtail.GetAt requirement) // get to rootObj (NOTE @head, because it is ΔBtail.GetAt requirement)
if rootObj == nil && root != xbtree.VDEL { if rootObj == nil && root != xbtree.VDEL {
zconn := zf.PJar() zconn := zf.PJar()
...@@ -616,7 +621,7 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64 ...@@ -616,7 +621,7 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64
var tabRevExact, ok bool var tabRevExact, ok bool
if rootObj != nil { if rootObj != nil {
zblkOid, ok, tabRev, tabRevExact, err = δFtail.δBtail.GetAt(ctx, rootObj, blk, at) zblkOid, ok, tabRev, tabRevExact, err = δFtail.δBtail.GetAt(ctx, rootObj, blk, at)
//fmt.Printf("GetAt #%d @%s -> %s, %v, @%s, %v\n", blk, at, zblkOid, ok, tabRev, tabRevExact) //fmt.Printf(" GetAt #%d @%s -> %s, %v, @%s, %v\n", blk, at, zblkOid, ok, tabRev, tabRevExact)
if err != nil { if err != nil {
return zodb.InvalidTid, false, err return zodb.InvalidTid, false, err
} }
...@@ -635,7 +640,7 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64 ...@@ -635,7 +640,7 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64
// blktab[blk] was changed to point to a zblk @rev. // blktab[blk] was changed to point to a zblk @rev.
// blk revision is max rev and when zblk changed last in (rev, at] range. // blk revision is max rev and when zblk changed last in (rev, at] range.
zblkRev, zblkRevExact := δFtail.δBtail.ΔZtail().LastRevOf(zblkOid, at) zblkRev, zblkRevExact := δFtail.δBtail.ΔZtail().LastRevOf(zblkOid, at)
//fmt.Printf("ZRevOf %s @%s -> @%s, %v\n", zblkOid, at, zblkRev, zblkRevExact) //fmt.Printf(" ZRevOf %s @%s -> @%s, %v\n", zblkOid, at, zblkRev, zblkRevExact)
if zblkRev > tabRev { if zblkRev > tabRev {
return zblkRev, zblkRevExact, nil return zblkRev, zblkRevExact, nil
} 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