aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_remote_sync.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-08-28 01:56:56 -0700
committerChris Lu <chris.lu@gmail.com>2021-08-28 01:56:56 -0700
commita9b41900d87f4fbdb2d0f9a6745fc563daff03d6 (patch)
tree6798a09f6489dccad0f22a21a759bdec10ceeb36 /weed/command/filer_remote_sync.go
parent0d8936f6cdeba0809ff6971c3717634d8d82e5fa (diff)
downloadseaweedfs-a9b41900d87f4fbdb2d0f9a6745fc563daff03d6.tar.xz
seaweedfs-a9b41900d87f4fbdb2d0f9a6745fc563daff03d6.zip
handle cases when mounted directory does not exist
Diffstat (limited to 'weed/command/filer_remote_sync.go')
-rw-r--r--weed/command/filer_remote_sync.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/weed/command/filer_remote_sync.go b/weed/command/filer_remote_sync.go
index e9286b705..db5ce8b90 100644
--- a/weed/command/filer_remote_sync.go
+++ b/weed/command/filer_remote_sync.go
@@ -116,11 +116,15 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
}
lastOffsetTsNs, err := getOffset(option.grpcDialOption, *option.filerAddress, RemoteSyncKeyPrefix, int32(dirHash))
- if err == nil && mountedDirEntry.Attributes.Crtime < lastOffsetTsNs/1000000 {
- lastOffsetTs = time.Unix(0, lastOffsetTsNs)
- glog.V(0).Infof("resume from %v", lastOffsetTs)
+ if mountedDirEntry != nil {
+ if err == nil && mountedDirEntry.Attributes.Crtime < lastOffsetTsNs/1000000 {
+ lastOffsetTs = time.Unix(0, lastOffsetTsNs)
+ glog.V(0).Infof("resume from %v", lastOffsetTs)
+ } else {
+ lastOffsetTs = time.Unix(mountedDirEntry.Attributes.Crtime, 0)
+ }
} else {
- lastOffsetTs = time.Unix(mountedDirEntry.Attributes.Crtime, 0)
+ lastOffsetTs = time.Now()
}
} else {
lastOffsetTs = time.Now().Add(-*option.timeAgo)