2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 21:05:10 +00:00

Add more debug for preloading

This commit is contained in:
Alexander Neumann 2015-02-17 23:38:40 +01:00
parent 65aae5f8c1
commit f8e47181b0

View File

@ -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
}