Commit 190617f5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e072a39f
......@@ -43,18 +43,12 @@ const debugΔBtail = false
// It semantically consists of
//
// []δB ; rev ∈ (tail, head]
// atTail XXX no need (see vvv)
//
// where δB represents a change in BTrees space
//
// δB:
// .rev↑
// {} root -> {}(key, δvalue) XXX was value
//
// and atTail keeps set of k/v @tail for keys changed in (tail, head]
//
// atTail: XXX no need for atTail as we have δvalue.Old
// {} root -> {}(key, value)
// {} root -> {}(key, δvalue)
//
// It covers only changes to keys from tracked subset of BTrees parts.
// In particular a key that was not explicitly requested to be tracked, even if
......@@ -62,7 +56,7 @@ const debugΔBtail = false
//
// ΔBtail provides the following operations:
//
// .Track(path) - start tracking tree nodes and keys; root=path[0], keys=path[-1].keys XXX keys not correct - e.g. track missing key
// .Track(path) - start tracking tree nodes and keys; root=path[0], keys=path[-1].(lo,hi]
//
// .Update(δZ) -> δB - update BTree δ tail given raw ZODB changes
// .ForgetPast(revCut) - forget changes past revCut
......@@ -80,7 +74,7 @@ const debugΔBtail = false
//
// XXX incremental; not full coverage
//
// ΔBtail is not safe for concurrent access.
// ΔBtail is not safe for concurrent access. XXX rework
// XXX -> multiple readers / single writer?
//
// See also zodb.ΔTail
......@@ -775,7 +769,8 @@ func (δTtail *ΔTtail) forgetPast(revCut zodb.Tid) {
//
// XXX root -> Oid ?
func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.Tid) (value Value, ok bool, rev zodb.Tid, revExact bool, err error) {
defer xerr.Contextf(&err, "δBtail: root<%s>: get %d @%s", root.POid(), key, at)
rootOid := root.POid()
defer xerr.Contextf(&err, "δBtail: root<%s>: get %d @%s", rootOid, key, at)
// XXX key not tracked -> panic
// XXX at not ∈ (tail, head] -> panic
......@@ -786,14 +781,14 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
panicf("δBtail: root.at (@%s) != head (@%s)", rootAt, δBtail.Head())
}
err = δBtail.rebuild1IfNeeded(root.POid())
err = δBtail.rebuild1IfNeeded(rootOid)
if err != nil {
return
}
δTtail := δBtail.vδTbyRoot[root.POid()]
δTtail := δBtail.vδTbyRoot[rootOid]
if δTtail == nil {
panicf("δBtail: root<%s> not tracked", root.POid())
panicf("δBtail: root<%s> not tracked", rootOid)
}
// XXX -> index lastXXXOf(key) | linear scan ↓ looking for change <= at
......@@ -823,12 +818,12 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
return
}
// key not in history tail at all.
// use @head[key]
// XXX can we avoid requiring live root?
// @tail[key] is not present - key was not changing in (tail, head].
// since at ∈ (tail, head] we can use @head[key] as the result
// δBtail[key] is not present - key was not changing in (tail, head].
// since at ∈ (tail, head] as the result we can use @rev[key] for any
// rev ∈ (tail, head].
//
// XXX can we avoid requiring live root? (think again afresh)
// XXX -> move handling of "key not in δBtail -> to δFtail.LastBlkRev"
xvalue, ok, err := root.Get(ctx, key)
if !ok {
value = VDEL
......
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