Commit 0cd6ed95 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 50bc3b82
......@@ -189,7 +189,7 @@ type ΔBtail struct {
type nodeTrack struct {
parent zodb.Oid // parent node | InvalidOid for root
holes SetKey // missing keys tracked under this node XXX nil for root(?) XXX only !empty root
trackedKeys SetKey // XXX kill
// trackedKeys SetKey // XXX kill
}
// ΔB represents a change in BTrees space.
......@@ -279,7 +279,6 @@ const (
// XXX TrackMinKey (we don't need it in WCFS)
)
// XXX kill keyPresent?
// XXX keep in trackedKeys only keys that are not present in btree - i.e. only negative entries
// -> this requires to merge δc returned by diffT and adjust bChildren to tail into
// -> it will use less memory and offload Track from (re)loading leaf bucket
......@@ -310,7 +309,7 @@ func (δBtail *ΔBtail) Track(ctx context.Context, key Key, keyPresent bool, pat
// XXX check for InvalidOid (e.g. T/B1:a with bucket not having its own oid.
track, oldTrack = δBtail.trackIdx[oid]
if !oldTrack {
track = nodeTrack{parent: parent, holes: SetKey{}, trackedKeys: SetKey{}}
track = nodeTrack{parent: parent, holes: SetKey{}}
δBtail.trackIdx[oid] = track
// XXX .trackNew += oid
}
......@@ -319,9 +318,6 @@ func (δBtail *ΔBtail) Track(ctx context.Context, key Key, keyPresent bool, pat
panicf("node %s is reachable from multiple parents: %s %s",
oid, track.parent, parent)
}
if track.trackedKeys != nil { // root always covers [-∞, ∞)
track.trackedKeys.Add(key)
}
parent = oid
}
......@@ -366,6 +362,7 @@ func (δBtail *ΔBtail) Track(ctx context.Context, key Key, keyPresent bool, pat
}
fmt.Printf(" bkeys: %s\n", bkeys)
/*
for {
track.trackedKeys.Update(bkeys)
if track.parent == zodb.InvalidOid {
......@@ -373,6 +370,7 @@ func (δBtail *ΔBtail) Track(ctx context.Context, key Key, keyPresent bool, pat
}
track = δBtail.trackIdx[track.parent]
}
*/
}
......@@ -1051,6 +1049,7 @@ func δMerge(δ, δ2 map[Key]ΔValue) error {
/*
func __diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]nodeTrack) (δ map[Key]ΔValue, err error) {
fmt.Printf(" T %s %s\n", xidOf(a), xidOf(b))
defer xerr.Contextf(&err, "diffT %s %s", xidOf(a), xidOf(b))
......@@ -1084,7 +1083,7 @@ func __diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oi
child := __.Child()
coid := child.POid()
if δZTC.Has(coid) ||
(len(av) == 1 && coid == zodb.InvalidOid) /* embedded bucket */ {
(len(av) == 1 && coid == zodb.InvalidOid) { // embedded bucket {
aChildren[coid] = child
}
}
......@@ -1199,6 +1198,7 @@ func __diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oi
}
*/
/*
allChildren := SetOid{}
......@@ -1277,8 +1277,10 @@ func __diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oi
}
*/
/*
return δ, nil
}
*/
// diffB computes difference in between two buckets.
// see diffX for details.
......@@ -1528,5 +1530,5 @@ func (rn nodeInRange) String() string {
}
func (track nodeTrack) String() string {
return fmt.Sprintf("{p%s h%s k%s}", track.parent, track.holes, track.trackedKeys)
return fmt.Sprintf("{p%s h%s}", track.parent, track.holes)
}
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