forked from TrueCloudLab/restic
Add more debug for preloading
This commit is contained in:
parent
65aae5f8c1
commit
f8e47181b0
1 changed files with 12 additions and 0 deletions
12
archiver.go
12
archiver.go
|
@ -63,6 +63,8 @@ func NewArchiver(s Server, p *Progress) (*Archiver, error) {
|
|||
// Preload loads all tree objects from repository and adds all blobs that are
|
||||
// still available to the map for deduplication.
|
||||
func (arch *Archiver) Preload() error {
|
||||
debug.Log("Archiver.Preload", "Start loading known blobs")
|
||||
|
||||
// load all trees, in parallel
|
||||
worker := func(wg *sync.WaitGroup, c <-chan backend.ID) {
|
||||
for id := range c {
|
||||
|
@ -72,6 +74,8 @@ func (arch *Archiver) Preload() error {
|
|||
return
|
||||
}
|
||||
|
||||
debug.Log("Archiver.Preload", "load tree %v with %d blobs", id, tree.Map.Len())
|
||||
|
||||
arch.m.Merge(tree.Map)
|
||||
}
|
||||
wg.Done()
|
||||
|
@ -87,7 +91,13 @@ func (arch *Archiver) Preload() error {
|
|||
}
|
||||
|
||||
// list ids
|
||||
trees := 0
|
||||
err := arch.s.EachID(backend.Tree, func(id backend.ID) {
|
||||
trees++
|
||||
|
||||
if trees%1000 == 0 {
|
||||
debug.Log("Archiver.Preload", "Loaded %v trees", trees)
|
||||
}
|
||||
idCh <- id
|
||||
})
|
||||
|
||||
|
@ -96,6 +106,8 @@ func (arch *Archiver) Preload() error {
|
|||
// wait for workers
|
||||
wg.Wait()
|
||||
|
||||
debug.Log("Archiver.Preload", "Loaded %v blobs from %v trees", arch.m.Len(), trees)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue