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.
// either use @tail[key], if it is present, or @head[key]
rev = δBtail.Tail()
revExact = false
// XXX kill KVAtTail completely
value, ok = δTtail.KVAtTail[key] // XXX kill - just use δvalue.Old from next-to-at entry
if ok {
return
......
......@@ -205,6 +205,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
blkTab := map[int64]string{} // #blk -> ZBlk<name>
dataTab := map[string]string{} // ZBlk<name> -> data
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']
for /*oid*/_, zblki := range t.Head().ZBlkTab {
......@@ -276,6 +277,19 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
dTxt := "D" + dataTabTxt(dataTab)
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
if len(δblk) != 0 {
δfok = &ΔFile{
......@@ -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