forked from TrueCloudLab/rclone
Don't delete files if errors in copy phase of sync
Make check return errors on differences
This commit is contained in:
parent
555ab5001e
commit
8b066ba77c
2 changed files with 9 additions and 2 deletions
|
@ -2,7 +2,6 @@ Todo
|
||||||
* Factor fses into own packages
|
* Factor fses into own packages
|
||||||
* FIXME: ls without an argument for buckets/containers?
|
* FIXME: ls without an argument for buckets/containers?
|
||||||
* FIXME: More -dry-run checks for object transfer
|
* FIXME: More -dry-run checks for object transfer
|
||||||
* FIXME: don't delete in sync if errors
|
|
||||||
* Might be quicker to check md5sums first? for swift <-> swift certainly, and maybe for small files
|
* Might be quicker to check md5sums first? for swift <-> swift certainly, and maybe for small files
|
||||||
* Ignoring the pseudo directories
|
* Ignoring the pseudo directories
|
||||||
* if object.PseudoDirectory {
|
* if object.PseudoDirectory {
|
||||||
|
|
10
swiftsync.go
10
swiftsync.go
|
@ -173,7 +173,10 @@ func Sync(fdst, fsrc Fs) {
|
||||||
log.Printf("Waiting for transfers to finish")
|
log.Printf("Waiting for transfers to finish")
|
||||||
copierWg.Wait()
|
copierWg.Wait()
|
||||||
|
|
||||||
// FIXME don't delete if IO errors
|
if stats.errors != 0 {
|
||||||
|
log.Printf("Not deleting files as there were IO errors")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Delete the spare files
|
// Delete the spare files
|
||||||
toDelete := make(FsObjectsChan, *transfers)
|
toDelete := make(FsObjectsChan, *transfers)
|
||||||
|
@ -213,11 +216,13 @@ func Check(fdst, fsrc Fs) {
|
||||||
|
|
||||||
log.Printf("Files in %s but not in %s", fdst, fsrc)
|
log.Printf("Files in %s but not in %s", fdst, fsrc)
|
||||||
for remote := range dstFiles {
|
for remote := range dstFiles {
|
||||||
|
stats.Error()
|
||||||
log.Printf(remote)
|
log.Printf(remote)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Files in %s but not in %s", fsrc, fdst)
|
log.Printf("Files in %s but not in %s", fsrc, fdst)
|
||||||
for remote := range srcFiles {
|
for remote := range srcFiles {
|
||||||
|
stats.Error()
|
||||||
log.Printf(remote)
|
log.Printf(remote)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,6 +244,7 @@ func Check(fdst, fsrc Fs) {
|
||||||
stats.Checking(src)
|
stats.Checking(src)
|
||||||
if src.Size() != dst.Size() {
|
if src.Size() != dst.Size() {
|
||||||
stats.DoneChecking(src)
|
stats.DoneChecking(src)
|
||||||
|
stats.Error()
|
||||||
FsLog(src, "Sizes differ")
|
FsLog(src, "Sizes differ")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -248,6 +254,7 @@ func Check(fdst, fsrc Fs) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !same {
|
if !same {
|
||||||
|
stats.Error()
|
||||||
FsLog(src, "Md5sums differ")
|
FsLog(src, "Md5sums differ")
|
||||||
}
|
}
|
||||||
FsDebug(src, "OK")
|
FsDebug(src, "OK")
|
||||||
|
@ -257,6 +264,7 @@ func Check(fdst, fsrc Fs) {
|
||||||
|
|
||||||
log.Printf("Waiting for checks to finish")
|
log.Printf("Waiting for checks to finish")
|
||||||
checkerWg.Wait()
|
checkerWg.Wait()
|
||||||
|
log.Printf("%d differences found", stats.errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
// List the Fs to stdout
|
// List the Fs to stdout
|
||||||
|
|
Loading…
Reference in a new issue