|
|
@ -141,7 +141,7 @@ func (fs *FilerSink) fetchAndWrite(sourceChunk *filer_pb.FileChunk, path string, |
|
|
return nil |
|
|
return nil |
|
|
}, func(uploadErr error) (shouldContinue bool) { |
|
|
}, func(uploadErr error) (shouldContinue bool) { |
|
|
if fs.hasSourceNewerVersion(path, sourceMtime) { |
|
|
if fs.hasSourceNewerVersion(path, sourceMtime) { |
|
|
glog.V(0).Infof("skip retrying stale source %s for %s: %v", sourceChunk.GetFileIdString(), path, uploadErr) |
|
|
|
|
|
|
|
|
glog.V(1).Infof("skip retrying stale source %s for %s: %v", sourceChunk.GetFileIdString(), path, uploadErr) |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
glog.V(0).Infof("upload source data %v: %v", sourceChunk.GetFileIdString(), uploadErr) |
|
|
glog.V(0).Infof("upload source data %v: %v", sourceChunk.GetFileIdString(), uploadErr) |
|
|
@ -182,19 +182,18 @@ func (fs *FilerSink) targetPathToSourcePath(targetPath string) (util.FullPath, b |
|
|
return "", false |
|
|
return "", false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
sourceRoot := strings.TrimSuffix(fs.filerSource.Dir, "/") |
|
|
|
|
|
targetRoot := strings.TrimSuffix(fs.dir, "/") |
|
|
|
|
|
targetPath = strings.TrimSuffix(targetPath, "/") |
|
|
|
|
|
if sourceRoot == "" { |
|
|
|
|
|
sourceRoot = "/" |
|
|
|
|
|
} |
|
|
|
|
|
if targetRoot == "" { |
|
|
|
|
|
targetRoot = "/" |
|
|
|
|
|
} |
|
|
|
|
|
if targetPath == "" { |
|
|
|
|
|
targetPath = "/" |
|
|
|
|
|
|
|
|
normalizePath := func(p string) string { |
|
|
|
|
|
p = strings.TrimSuffix(p, "/") |
|
|
|
|
|
if p == "" { |
|
|
|
|
|
return "/" |
|
|
|
|
|
} |
|
|
|
|
|
return p |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sourceRoot := normalizePath(fs.filerSource.Dir) |
|
|
|
|
|
targetRoot := normalizePath(fs.dir) |
|
|
|
|
|
targetPath = normalizePath(targetPath) |
|
|
|
|
|
|
|
|
var relative string |
|
|
var relative string |
|
|
switch { |
|
|
switch { |
|
|
case targetRoot == "/": |
|
|
case targetRoot == "/": |
|
|
|