Commit 80bdf7e4 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 66359658
......@@ -98,8 +98,9 @@ type Key = int64
const KeyMax Key = math.MaxInt64
const KeyMin Key = math.MinInt64
type Value = zodb.Oid // assumes value is persistent reference
// deletion is represented as VDEL
// value is assumed to be persistent reference.
// deletion is represented as VDEL.
type Value = zodb.Oid
const VDEL = zodb.InvalidOid
......@@ -162,7 +163,7 @@ type ΔBtail struct {
// includes all changed objects, not only tracked ones.
δZtail *zodb.ΔTail
// XXX vvv keys keys ∈ tracked -> keys ∈ kadj[tracket] ?
// XXX vvv keys ∈ tracked -> keys ∈ kadj[tracked] ?
// δRtail []ΔRoots // which BTree were changed; Noted only by keys ∈ tracket subset
byRoot map[zodb.Oid]*ΔTtail // {} root -> [] k/v change history; only for keys ∈ tracket subset
......@@ -172,6 +173,7 @@ type ΔBtail struct {
// tracked nodes index: node -> parent + accessed holes under this node XXX -> holeIdx
// we only allow single parent/root case and report "tree corrupt" otherwise.
// trackIdx describes @head state
// XXX -> parentIdx
trackIdx map[zodb.Oid]nodeTrack
// XXX tracked holes
......@@ -185,8 +187,10 @@ type ΔBtail struct {
// nodeTrack represents tracking information about a node.
type nodeTrack struct {
parent zodb.Oid // parent node | InvalidOid for root
/*
holes SetKey // missing keys tracked under this node; nil for !leaf
// XXX move holes into separate ΔBtail..holeIdx
*/
}
// treeSetKey represents ordered set of keys.
......@@ -310,15 +314,17 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
parent := zodb.InvalidOid
var track nodeTrack
var oldTrack bool
for i, node := range path {
for _, node := range path {
oid := node.POid()
// 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}
/*
if i == l-1 { // leaf
track.holes = SetKey{}
}
*/
δBtail.trackIdx[oid] = track
// XXX .trackNew += oid
}
......@@ -335,11 +341,13 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
// remember missing keys in track of leaf node (bucket or top-level ø tree)
if !keyPresent {
δBtail.holeIdx.Add(key)
track.holes.Add(key)
//track.holes.Add(key)
} else {
/*
if track.holes.Has(key) {
panicf("[%v] was previously requested to be tracked as ø", key)
}
*/
if δBtail.holeIdx.Has(key) {
panicf("[%v] was previously requested to be tracked as ø", key)
}
......@@ -1263,7 +1271,8 @@ func (rn nodeInRange) String() string {
}
func (track nodeTrack) String() string {
return fmt.Sprintf("{p%s h%s}", track.parent, track.holes)
//return fmt.Sprintf("{p%s h%s}", track.parent, track.holes)
return fmt.Sprintf("{p%s}", track.parent)
}
......
......@@ -543,8 +543,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
emsg += strings.Join(badv, "\n")
emsg += "\n"
//t.Error(emsg)
t.Fatal(emsg)
t.Error(emsg)
}
}()
......
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