Commit 8db3f96a authored by Kirill Smelkov's avatar Kirill Smelkov

X don't track embedded buckets

Reason: see comments.
Prerequisite to fix test_wcfs_watch_2files
parent 74bf1db8
......@@ -416,7 +416,6 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { //
}
}
_, ok := δBtail.byRoot[root]
if !ok {
δBtail.byRoot[root] = newΔTtail()
......@@ -446,13 +445,21 @@ func (tidx trackIndex) AddPath(path []zodb.Oid) {
panic("empty path")
}
// don't explicitly keep track of embedded buckets - they all have
// InvalidOid, and thus, if kept in tidx, e.g. T/B1:a and another
// T/B2:b would lead to InvalidOid having multiple parents.
if l >= 2 && path[l-1] == zodb.InvalidOid {
path = path[:l-1]
}
parent := zodb.InvalidOid
var ptrack *nodeTrack = nil
var track *nodeTrack // XXX kill here
var oldTrack bool
for _, oid := range path {
// XXX skip InvalidOid ?
// InvalidOid means embedded bucket - e.g. T/B1:a with bucket not having its own oid.
if oid == zodb.InvalidOid {
panicf("path has node with invalid oid: %v", path)
}
track, oldTrack = tidx[oid]
if !oldTrack {
......@@ -994,7 +1001,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
for _, ac := range achildren {
acOid := ac.node.POid()
_, tracked := trackIdx[acOid]
if !tracked {
if !tracked && /*cannot skip embedded bucket:*/acOid != zodb.InvalidOid {
continue
}
......
......@@ -339,11 +339,10 @@ func (rbs RBucketSet) trackIdx(tracked SetKey) trackIndex {
trackIdx := trackIndex{}
for k := range tracked {
kb := rbs.Get(k)
// trackIdx records regular buckets or non-empty embedded bucket
// ( empty embedded bucket means there is just empty tree node
// and only that empty tree node is recorded in trackIdx )
// trackIdx explicitly records only regular buckets.
// embedded buckets all have oid=zodb.InvalidOid and would lead to z
newNode := false
if (kb.oid != zodb.InvalidOid || len(kb.kv) != 0) {
if kb.oid != zodb.InvalidOid {
track, already := trackIdx[kb.oid]
if !already {
track = &nodeTrack{parent: kb.parent.oid, nchild: 0}
......
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