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

.

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