Commit eb8703df authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 1a10f6bc
...@@ -806,6 +806,7 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb. ...@@ -806,6 +806,7 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
// either use @tail[key], if it is present, or @head[key] // either use @tail[key], if it is present, or @head[key]
rev = δBtail.Tail() rev = δBtail.Tail()
revExact = false revExact = false
// XXX kill KVAtTail completely
value, ok = δTtail.KVAtTail[key] // XXX kill - just use δvalue.Old from next-to-at entry value, ok = δTtail.KVAtTail[key] // XXX kill - just use δvalue.Old from next-to-at entry
if ok { if ok {
return return
......
...@@ -201,10 +201,11 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) { ...@@ -201,10 +201,11 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
} }
// data built via applying changes from testv // data built via applying changes from testv
vδf := []*ΔFile{} // (rev↑, {}blk) vδf := []*ΔFile{} // (rev↑, {}blk)
blkTab := map[int64]string{} // #blk -> ZBlk<name> blkTab := map[int64]string{} // #blk -> ZBlk<name>
dataTab := map[string]string{} // ZBlk<name> -> data dataTab := map[string]string{} // ZBlk<name> -> data
Zinblk := map[string]setI64{} // ZBlk<name> -> which #blk refer to it Zinblk := map[string]setI64{} // ZBlk<name> -> which #blk refer to it
blkRevAt := map[zodb.Tid]map[int64]zodb.Tid{} // {} at -> {} #blk -> rev
// initialize dataTab from root['treegen/values'] // initialize dataTab from root['treegen/values']
for /*oid*/_, zblki := range t.Head().ZBlkTab { for /*oid*/_, zblki := range t.Head().ZBlkTab {
...@@ -276,6 +277,19 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) { ...@@ -276,6 +277,19 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
dTxt := "D" + dataTabTxt(dataTab) dTxt := "D" + dataTabTxt(dataTab)
commit := t.CommitTree(tTxt + " " + dTxt) commit := t.CommitTree(tTxt + " " + dTxt)
// update blkRevAt
var blkRevPrev map[int64]zodb.Tid
if i != 0 {
blkRevPrev = blkRevAt[δftail.Head()]
}
blkRev := map[int64]zodb.Tid{}
for blk, rev := range blkRevPrev {
blkRev[blk] = rev
}
for blk := range δblk {
blkRev[blk] = commit.At
}
var δfok *ΔFile var δfok *ΔFile
if len(δblk) != 0 { if len(δblk) != 0 {
δfok = &ΔFile{ δfok = &ΔFile{
...@@ -375,7 +389,32 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) { ...@@ -375,7 +389,32 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
} }
// XXX LastBlkRev // LastBlkRev
blkv := []int64{} // all blocks
for blk := range blkRevAt[vδf[len(vδf)-1].Rev] {
blkv = append(blkv, blk)
}
blkv = append(blkv, 1E4/*this block is hole*/)
sort.Slice(blkv, func(i, j int) bool {
return blkv[i] < blkv[j]
})
for j := 0; j < len(vδf); j++ {
at := vδf[j].Rev
blkRev := blkRevAt[at]
for _, blk := range blkv {
rev, exact := δftail.LastBlkRev(ctx, zfile, blk, at)
revOK, exactOK := blkRev[blk], true
if revOK <= δftail.Tail() {
revOK, exactOK = δftail.Tail(), false
}
if !(rev == revOK && exact == exactOK) {
t.Errorf("blkrev #%d @%s:\nhave: @%s, %v\nwant: @%s, %v", blk, at, rev, exact, revOK, exactOK)
}
}
}
} }
} }
......
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