Commit fc5deb55 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4f6d5caf
...@@ -116,6 +116,9 @@ type ΔBtail struct { ...@@ -116,6 +116,9 @@ type ΔBtail struct {
// tracked objects that are not yet taken into account in current δBtail // tracked objects that are not yet taken into account in current δBtail
trackNew SetOid trackNew SetOid
// tracked keys that are not in current version of the tree.
tkdel SetKey
} }
// ΔB represents a change in BTrees space. // ΔB represents a change in BTrees space.
...@@ -203,7 +206,7 @@ const ( ...@@ -203,7 +206,7 @@ const (
// XXX TrackMinKey (we don't need it in WCFS) // XXX TrackMinKey (we don't need it in WCFS)
) )
func (δBtail *ΔBtail) Track(path []Node, flags TrackFlags) { // XXX Tree|Bucket; path[0] = root func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags TrackFlags) { // XXX Tree|Bucket; path[0] = root
l := len(path) l := len(path)
if l == 0 { if l == 0 {
panic("empty path") panic("empty path")
...@@ -244,6 +247,8 @@ func (δBtail *ΔBtail) Track(path []Node, flags TrackFlags) { // XXX Tree|Bucke ...@@ -244,6 +247,8 @@ func (δBtail *ΔBtail) Track(path []Node, flags TrackFlags) { // XXX Tree|Bucke
// only those keys, that correspond to tracked subset of δZ. // only those keys, that correspond to tracked subset of δZ.
// //
// δZ should include all objects changed by ZODB transaction. // δZ should include all objects changed by ZODB transaction.
//
// XXX optionally accept zconnOld/zconnNew from client
func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) { func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
headOld := δBtail.Head() headOld := δBtail.Head()
defer xerr.Contextf(&err, "ΔBtail update %s -> %s", headOld, δZ.Tid) defer xerr.Contextf(&err, "ΔBtail update %s -> %s", headOld, δZ.Tid)
......
...@@ -529,7 +529,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, ...@@ -529,7 +529,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
kadjTracked = SetKey{} // kadj[Tracked] (all keys adjacent to tracked keys) kadjTracked = SetKey{} // kadj[Tracked] (all keys adjacent to tracked keys)
for k := range initialTrackedKeys { for k := range initialTrackedKeys {
path := []Node{} path := []Node{}
_, _, err = ztree.VGet(ctx, k, func(node Node) { _, ok, err := ztree.VGet(ctx, k, func(node Node) {
path = append(path, node) path = append(path, node)
}); X(err) }); X(err)
...@@ -538,7 +538,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, ...@@ -538,7 +538,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
if k == kInf { if k == kInf {
trackFlags = TrackMaxKey trackFlags = TrackMaxKey
} }
δbtail.Track(path, trackFlags) δbtail.Track(k, ok, path, trackFlags)
kadjTracked.Update(kadj[k]) kadjTracked.Update(kadj[k])
} }
......
...@@ -139,9 +139,10 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() } ...@@ -139,9 +139,10 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
func (δFtail *ΔFtail) Track(file *BigFile, blk int64, path []btree.LONode, zblk zBlk) { func (δFtail *ΔFtail) Track(file *BigFile, blk int64, path []btree.LONode, zblk zBlk) {
δbTrackFlags := TrackFlags(0) δbTrackFlags := TrackFlags(0)
if blk == -1 { if blk == -1 {
// XXX blk = ∞ ?
δbTrackFlags = TrackMaxKey δbTrackFlags = TrackMaxKey
} }
δFtail.δBtail.Track(path, δbTrackFlags) δFtail.δBtail.Track(blk, zblk != nil, path, δbTrackFlags)
root := path[0].(*btree.LOBTree) root := path[0].(*btree.LOBTree)
files, ok := δFtail.fileIdx[root.POid()] files, ok := δFtail.fileIdx[root.POid()]
if !ok { if !ok {
......
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