Commit 55d3f53c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 539ec405
......@@ -863,9 +863,9 @@ retry:
return err
}
if false { // XXX -> V(2) ?
if !log.V(2) {
// debug dump δF
fmt.Printf("\n\nS: handleδZ: δF (#%d):\n", len(δF.ByFile))
log.Infof("\n\nS: handleδZ: δF (#%d):\n", len(δF.ByFile))
for file, δfile := range δF.ByFile {
blkv := δfile.Blocks.Elements()
sort.Slice(blkv, func(i, j int) bool {
......@@ -875,9 +875,9 @@ retry:
if δfile.Size {
size = "S"
}
fmt.Printf("S: \t- %s\t%s %v\n", file.zfile.POid(), size, blkv)
log.Infof("S: \t- %s\t%s %v\n", file.zfile.POid(), size, blkv)
}
fmt.Printf("\n\n")
log.Infof("\n\n")
}
wg := xsync.NewWorkGroup(ctx)
......
......@@ -120,7 +120,7 @@ type ΔValue struct {
// It semantically consists of
//
// []δB ; rev ∈ (tail, head]
// atTail
// atTail XXX no need (see vvv)
//
// where δB represents a change in BTrees space
//
......@@ -154,10 +154,11 @@ type ΔValue struct {
// that ∈ BTree subgraphs that were explicitly requested to be tracked by δB.
//
// XXX incremental; not full coverage
// XXX see also zodb.ΔTail .
//
// ΔBtail is not safe for concurrent access.
// XXX -> multiple readers / single writer?
//
// See also zodb.ΔTail
type ΔBtail struct {
// raw ZODB changes; Kept to rebuild δBtail/byRoot after new Track.
// includes all changed objects, not only tracked ones.
......@@ -347,8 +348,8 @@ type ΔTree struct {
// Initial tracked set is empty.
// Initial coverage is (at₀, at₀].
//
// db will be used by ΔBtail to open database connections ... XXX
// XXX or caller provides zhead/zprev explicitly?
// db will be used by ΔBtail to open database connections to load data from
// ZODB when needed. XXX or caller provides zhead/zprev explicitly?
func NewΔBtail(at0 zodb.Tid, db *zodb.DB) *ΔBtail {
return &ΔBtail{
δZtail: zodb.NewΔTail(at0),
......
......@@ -24,6 +24,7 @@ package main
import (
"context"
"fmt"
"runtime"
"sync"
......@@ -95,7 +96,6 @@ type ΔFile struct {
Size bool // whether file size changed
}
// zblkInΔFtail is ΔFtail-related volatile data embedded into ZBlk*.
//
// The data is preserved even when ZBlk comes to ghost state, but is lost if
......@@ -120,7 +120,8 @@ func (z *zblkInΔFtail) inΔFtail() *zblkInΔFtail { return z }
// Initial tracked set is empty.
// Initial coverage of created ΔFtail is (at₀, at₀].
//
// XXX db
// db will be used by ΔFtail to open database connections to load data from
// ZODB when needed.
func NewΔFtail(at0 zodb.Tid, db *zodb.DB) *ΔFtail {
return &ΔFtail{
δBtail: NewΔBtail(at0, db),
......@@ -134,7 +135,7 @@ func (δFtail *ΔFtail) Head() zodb.Tid { return δFtail.δBtail.Head() }
func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
// Track associates file[blk] with tree path and zblk object there.
// Track associates file[blk]@head with tree path and zblk object.
//
// zblk can be nil, which represents a hole.
// XXX blk=-1 is used for tracking after Size (no zblk is accessed at all).
......@@ -143,6 +144,8 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
//
// XXX text
//
// XXX objects in path and zblk must be with .PJar().At() == .head
//
// A root can be associated with several files (each provided on different Track call).
func (δFtail *ΔFtail) Track(file *BigFile, blk int64, path []btree.LONode, zblk ZBlk) {
if blk == -1 {
......@@ -225,7 +228,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) (_ ΔF, err
for root, δt := range δB.ByRoot {
files := δFtail.fileIdx[root]
if len(files) == 0 {
panicf("ΔFtail: root<%s> -> ø file", root)
panicf("BUG: ΔFtail: root<%s> -> ø files", root)
}
for file := range files {
δfile, ok := δF.ByFile[file]
......@@ -277,11 +280,10 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) (_ ΔF, err
// XXX update z.infile according to btree changes
case *ZBigFile:
// XXX check that .blksize and .blktab (it is only
// TODO check that .blksize and .blktab (it is only
// persistent reference) do not change.
// XXX shutdown fs with ^^^ message.
panic("ZBigFile changed")
return ΔF{}, fmt.Errorf("ZBigFile<%s> changed @%s", oid, δZ.Tid)
}
// make sure obj won't be garbage-collected until we finish handling it.
......
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