Commit 0e46b293 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ac195099
...@@ -96,7 +96,7 @@ type ΔFtail struct { ...@@ -96,7 +96,7 @@ type ΔFtail struct {
// _ΔFileTail represents tail of revisional changes to one file. // _ΔFileTail represents tail of revisional changes to one file.
type _ΔFileTail struct { type _ΔFileTail struct {
root zodb.Oid // .blktab as of @head root zodb.Oid // .blktab as of @head
vδE []_ΔFileEpoch // changes to ZBigFile object itself ; nil if not yet rebuilt vδE []_ΔFileEpoch // epochs (changes to ZBigFile object itself) ; nil if not yet rebuilt
} }
// _ΔFileEpoch represent a change to ZBigFile object. // _ΔFileEpoch represent a change to ZBigFile object.
...@@ -202,7 +202,8 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb ...@@ -202,7 +202,8 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb
δFtail.trackNew.Add(foid) δFtail.trackNew.Add(foid)
} }
if δftail.root != roid { if δftail.root != roid {
panicf("zfile<%s> changed root from %s -> %s", foid, δftail.root, roid) // .root can change during epochs, but in between them it must be stable
panicf("BUG: zfile<%s> root mutated from %s -> %s", foid, δftail.root, roid)
} }
...@@ -320,16 +321,9 @@ func (δftail *_ΔFileTail) rebuild1(foid zodb.Oid, δZtail *zodb.ΔTail, db *zo ...@@ -320,16 +321,9 @@ func (δftail *_ΔFileTail) rebuild1(foid zodb.Oid, δZtail *zodb.ΔTail, db *zo
// It returns change in files space that corresponds to δZ. // It returns change in files space that corresponds to δZ.
// //
// δZ should include all objects changed by ZODB transaction. // δZ should include all objects changed by ZODB transaction.
//
// XXX readd zhead?
// // Zhead must be active connection at δFtail.Head() database state.
// // Objects in Zhead must not be modified.
// // During call to Update zhead must not be otherwise used - even for reading.
//func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *xzodb.ZConn) (_ ΔF, err error) {
func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) { func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
defer xerr.Contextf(&err, "ΔFtail update %s -> %s", δFtail.Head(), δZ.Tid) defer xerr.Contextf(&err, "ΔFtail update %s -> %s", δFtail.Head(), δZ.Tid)
// XXX verify zhead.At() == δFtail.Head()
// XXX locking // XXX locking
// rebuild vδE for newly tracked files // rebuild vδE for newly tracked files
...@@ -361,7 +355,6 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) { ...@@ -361,7 +355,6 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
//fmt.Printf("zfile<%s> diff %s..%s -> δ: %v\n", oid, headOld, δZ.Tid, δ) //fmt.Printf("zfile<%s> diff %s..%s -> δ: %v\n", oid, headOld, δZ.Tid, δ)
if δ != nil { if δ != nil {
// XXX rebuild first
δzfile[oid] = δ δzfile[oid] = δ
δE := _ΔFileEpoch{ δE := _ΔFileEpoch{
Rev: δZ.Tid, Rev: δZ.Tid,
......
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