Commit d1f62516 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f7215d1c
...@@ -342,12 +342,13 @@ func (rbs RBucketSet) trackIdx(tracked SetKey) trackIndex { ...@@ -342,12 +342,13 @@ func (rbs RBucketSet) trackIdx(tracked SetKey) trackIndex {
// trackIdx records regular buckets or non-empty embedded bucket // trackIdx records regular buckets or non-empty embedded bucket
// ( empty embedded bucket means there is just empty tree node // ( empty embedded bucket means there is just empty tree node
// and only that empty tree node is recorded in trackIdx ) // and only that empty tree node is recorded in trackIdx )
trackKB := (kb.oid != zodb.InvalidOid || len(kb.kv) != 0) newNode := false
if trackKB { if (kb.oid != zodb.InvalidOid || len(kb.kv) != 0) {
track, already := trackIdx[kb.oid] track, already := trackIdx[kb.oid]
if !already { if !already {
track = &nodeTrack{parent: kb.parent.oid, nchild: 0} track = &nodeTrack{parent: kb.parent.oid, nchild: 0}
trackIdx[kb.oid] = track trackIdx[kb.oid] = track
newNode = true
} }
if track.parent != kb.parent.oid { if track.parent != kb.parent.oid {
panicf("BUG: %s: B%s -> multiple parents: %s %s", rbs.coverage(), kb.oid, track.parent, kb.parent.oid) panicf("BUG: %s: B%s -> multiple parents: %s %s", rbs.coverage(), kb.oid, track.parent, kb.parent.oid)
...@@ -362,18 +363,21 @@ func (rbs RBucketSet) trackIdx(tracked SetKey) trackIndex { ...@@ -362,18 +363,21 @@ func (rbs RBucketSet) trackIdx(tracked SetKey) trackIndex {
} }
pt, already := trackIdx[p.oid] pt, already := trackIdx[p.oid]
newParent := false
if !already { if !already {
pt = &nodeTrack{parent: ppoid, nchild: 0} pt = &nodeTrack{parent: ppoid, nchild: 0}
trackIdx[p.oid] = pt trackIdx[p.oid] = pt
newParent = true
} }
if pt.parent != ppoid { if pt.parent != ppoid {
panicf("BUG: %s: T%s -> multiple parents: %s %s", rbs.coverage(), p.oid, pt.parent, ppoid) panicf("BUG: %s: T%s -> multiple parents: %s %s", rbs.coverage(), p.oid, pt.parent, ppoid)
} }
if trackKB { if newNode {
pt.nchild++ pt.nchild++
} }
p = p.parent p = p.parent
newNode = newParent
} }
} }
return trackIdx return trackIdx
......
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