Commit a16ba656 authored by Joan Piles's avatar Joan Piles

Bugfixes: bigger queue for snapshots, and be tolerant to vanished files

in rsync
parent 5358a620
......@@ -50,6 +50,7 @@ func LastGoodTicker(in, out chan *Snapshot, cl Clock) {
if wait > 0 {
log.Println("wait", wait, "before next snapshot")
time.Sleep(wait)
Debugf("Awoken at %s\n", cl.Now())
}
}
out <- sn
......@@ -76,7 +77,7 @@ func subcmdRun() (ferr error) {
// The obsoleteQueue should not be larger than the absolute number of
// expected snapshots. However, there is no way (yet) to calculate that
// number.
obsoleteQueue := make(chan *Snapshot, 100)
obsoleteQueue := make(chan *Snapshot, 10000)
lastGoodIn := make(chan *Snapshot)
lastGoodOut := make(chan *Snapshot)
freeSpaceCheck := make(chan struct{}) // Empty type for the channel: we don't care about what is inside, only about the fact that there is something inside
......
......@@ -84,7 +84,22 @@ func CreateSnapshot(base *Snapshot) (*Snapshot, error) {
// - temporary network error
// - disk full?
// Detect external signalling?
return nil, err
failed := true
// First, get the error code
if exiterr, ok := err.(*exec.ExitError); ok { // The return code != 0)
if status, ok := exiterr.Sys().(syscall.WaitStatus); ok { // Finally get the actual status code
// status now holds the actual return code
if status == 24 { // Magic number: means some files couldn't be copied because they vanished, so nothing critical. See man rsync
Debugf("Some files failed to copy because they were deleted in the meantime, but nothing critical... going on...")
failed = false
}
}
}
if failed {
return nil, err
}
}
newSn.transComplete(cl)
log.Println("finished:", newSn.Name())
......
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