aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_remote_sync.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-09-04 13:46:44 -0700
committerChris Lu <chris.lu@gmail.com>2021-09-04 13:46:44 -0700
commit16a342eb8a4396a21121782fa24ed4963e9ef77c (patch)
tree7d60c895ab431576605d2ecbcbb9039467d9a059 /weed/command/filer_remote_sync.go
parent796b2eb92967b8d1b94c1facc4842e9f177431d6 (diff)
downloadseaweedfs-16a342eb8a4396a21121782fa24ed4963e9ef77c.tar.xz
seaweedfs-16a342eb8a4396a21121782fa24ed4963e9ef77c.zip
re-ordering
Diffstat (limited to 'weed/command/filer_remote_sync.go')
-rw-r--r--weed/command/filer_remote_sync.go43
1 files changed, 22 insertions, 21 deletions
diff --git a/weed/command/filer_remote_sync.go b/weed/command/filer_remote_sync.go
index c3f96668e..ef023b9cb 100644
--- a/weed/command/filer_remote_sync.go
+++ b/weed/command/filer_remote_sync.go
@@ -93,31 +93,20 @@ func runFilerRemoteSynchronize(cmd *Command, args []string) bool {
*remoteSyncOptions.readChunkFromFiler,
)
- if dir != "" {
- fmt.Printf("synchronize %s to remote storage...\n", dir)
- util.RetryForever("filer.remote.sync "+dir, func() error {
- return followUpdatesAndUploadToRemote(&remoteSyncOptions, filerSource, dir)
- }, func(err error) bool {
+ storageName := *remoteSyncOptions.createBucketAt
+ if storageName != "" {
+
+ remoteSyncOptions.bucketsDir = "/buckets"
+ // check buckets again
+ remoteSyncOptions.WithFilerClient(func(filerClient filer_pb.SeaweedFilerClient) error {
+ resp, err := filerClient.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
if err != nil {
- glog.Errorf("synchronize %s: %v", dir, err)
+ return err
}
- return true
+ remoteSyncOptions.bucketsDir = resp.DirBuckets
+ return nil
})
- }
- remoteSyncOptions.bucketsDir = "/buckets"
- // check buckets again
- remoteSyncOptions.WithFilerClient(func(filerClient filer_pb.SeaweedFilerClient) error {
- resp, err := filerClient.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
- if err != nil {
- return err
- }
- remoteSyncOptions.bucketsDir = resp.DirBuckets
- return nil
- })
-
- storageName := *remoteSyncOptions.createBucketAt
- if storageName != "" {
fmt.Printf("synchronize %s, default new bucket creation in %s ...\n", remoteSyncOptions.bucketsDir, storageName)
util.RetryForever("filer.remote.sync buckets "+storageName, func() error {
return remoteSyncOptions.followBucketUpdatesAndUploadToRemote(filerSource)
@@ -129,5 +118,17 @@ func runFilerRemoteSynchronize(cmd *Command, args []string) bool {
})
}
+ if dir != "" {
+ fmt.Printf("synchronize %s to remote storage...\n", dir)
+ util.RetryForever("filer.remote.sync "+dir, func() error {
+ return followUpdatesAndUploadToRemote(&remoteSyncOptions, filerSource, dir)
+ }, func(err error) bool {
+ if err != nil {
+ glog.Errorf("synchronize %s: %v", dir, err)
+ }
+ return true
+ })
+ }
+
return true
}