1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-02-22 22:22:14 +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 // Preload loads all tree objects from repository and adds all blobs that are
// still available to the map for deduplication. // still available to the map for deduplication.
func (arch *Archiver) Preload() error { func (arch *Archiver) Preload() error {
debug.Log("Archiver.Preload", "Start loading known blobs")
// load all trees, in parallel // load all trees, in parallel
worker := func(wg *sync.WaitGroup, c <-chan backend.ID) { worker := func(wg *sync.WaitGroup, c <-chan backend.ID) {
for id := range c { for id := range c {
@ -72,6 +74,8 @@ func (arch *Archiver) Preload() error {
return return
} }
debug.Log("Archiver.Preload", "load tree %v with %d blobs", id, tree.Map.Len())
arch.m.Merge(tree.Map) arch.m.Merge(tree.Map)
} }
wg.Done() wg.Done()
@ -87,7 +91,13 @@ func (arch *Archiver) Preload() error {
} }
// list ids // list ids
trees := 0
err := arch.s.EachID(backend.Tree, func(id backend.ID) { 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 idCh <- id
}) })
@ -96,6 +106,8 @@ func (arch *Archiver) Preload() error {
// wait for workers // wait for workers
wg.Wait() wg.Wait()
debug.Log("Archiver.Preload", "Loaded %v blobs from %v trees", arch.m.Len(), trees)
return err return err
} }