2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 14:56:29 +00:00

pipe/archiver: Add more debug messages

This commit is contained in:
Alexander Neumann 2016-02-07 23:22:06 +01:00
parent 9048eb676b
commit 68db75b4e3
2 changed files with 9 additions and 6 deletions

View File

@ -366,6 +366,7 @@ func (arch *Archiver) dirWorker(wg *sync.WaitGroup, p *Progress, done <-chan str
// if we get a nil pointer here, an error has happened while // if we get a nil pointer here, an error has happened while
// processing this entry. Ignore it for now. // processing this entry. Ignore it for now.
if res == nil { if res == nil {
debug.Log("Archiver.dirWorker", "got nil result?")
continue continue
} }
@ -374,7 +375,7 @@ func (arch *Archiver) dirWorker(wg *sync.WaitGroup, p *Progress, done <-chan str
tree.Insert(node) tree.Insert(node)
if node.Type == "dir" { if node.Type == "dir" {
debug.Log("Archiver.dirWorker", "got tree node for %s: %v", node.path, node.blobs) debug.Log("Archiver.dirWorker", "got tree node for %s: %v", node.path, node.Subtree)
if node.Subtree.IsNull() { if node.Subtree.IsNull() {
panic("invalid null subtree ID") panic("invalid null subtree ID")

View File

@ -92,7 +92,7 @@ func walk(basedir, dir string, selectFunc SelectFunc, done <-chan struct{}, jobs
info, err := os.Lstat(dir) info, err := os.Lstat(dir)
if err != nil { if err != nil {
debug.Log("pipe.walk", "error for %v: %v", dir, err) debug.Log("pipe.walk", "error for %v: %v, res %p", dir, err, res)
select { select {
case jobs <- Dir{basedir: basedir, path: relpath, info: info, error: err, result: res}: case jobs <- Dir{basedir: basedir, path: relpath, info: info, error: err, result: res}:
case <-done: case <-done:
@ -101,11 +101,12 @@ func walk(basedir, dir string, selectFunc SelectFunc, done <-chan struct{}, jobs
} }
if !selectFunc(dir, info) { if !selectFunc(dir, info) {
debug.Log("pipe.walk", "file %v excluded by filter", dir) debug.Log("pipe.walk", "file %v excluded by filter, res %p", dir, res)
return return
} }
if !info.IsDir() { if !info.IsDir() {
debug.Log("pipe.walk", "sending file job for %v, res %p", dir, res)
select { select {
case jobs <- Entry{info: info, basedir: basedir, path: relpath, result: res}: case jobs <- Entry{info: info, basedir: basedir, path: relpath, result: res}:
case <-done: case <-done:
@ -116,7 +117,7 @@ func walk(basedir, dir string, selectFunc SelectFunc, done <-chan struct{}, jobs
debug.RunHook("pipe.readdirnames", dir) debug.RunHook("pipe.readdirnames", dir)
names, err := readDirNames(dir) names, err := readDirNames(dir)
if err != nil { if err != nil {
debug.Log("pipe.walk", "Readdirnames(%v) returned error: %v", dir, err) debug.Log("pipe.walk", "Readdirnames(%v) returned error: %v, res %p", dir, err, res)
select { select {
case <-done: case <-done:
case jobs <- Dir{basedir: basedir, path: relpath, info: info, error: err, result: res}: case jobs <- Dir{basedir: basedir, path: relpath, info: info, error: err, result: res}:
@ -143,6 +144,7 @@ func walk(basedir, dir string, selectFunc SelectFunc, done <-chan struct{}, jobs
entries = append(entries, ch) entries = append(entries, ch)
if statErr != nil { if statErr != nil {
debug.Log("pipe.walk", "sending file job for %v, err %v, res %p", subpath, err, res)
select { select {
case jobs <- Entry{info: fi, error: statErr, basedir: basedir, path: filepath.Join(relpath, name), result: ch}: case jobs <- Entry{info: fi, error: statErr, basedir: basedir, path: filepath.Join(relpath, name), result: ch}:
case <-done: case <-done:
@ -158,7 +160,7 @@ func walk(basedir, dir string, selectFunc SelectFunc, done <-chan struct{}, jobs
walk(basedir, subpath, selectFunc, done, jobs, ch) walk(basedir, subpath, selectFunc, done, jobs, ch)
} }
debug.Log("pipe.walk", "sending dirjob for %q, basedir %q", dir, basedir) debug.Log("pipe.walk", "sending dirjob for %q, basedir %q, res %p", dir, basedir, res)
select { select {
case jobs <- Dir{basedir: basedir, path: relpath, info: info, Entries: entries, result: res}: case jobs <- Dir{basedir: basedir, path: relpath, info: info, Entries: entries, result: res}:
case <-done: case <-done:
@ -217,7 +219,7 @@ func Walk(walkPaths []string, selectFunc SelectFunc, done chan struct{}, jobs ch
debug.Log("pipe.Walk", "walker for %v done", path) debug.Log("pipe.Walk", "walker for %v done", path)
} }
debug.Log("pipe.Walk", "sending root node") debug.Log("pipe.Walk", "sending root node, res %p", res)
select { select {
case <-done: case <-done:
return return