mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
filer.remote.sync: parallelize uploading to remove object storage
This commit is contained in:
parent
f6b92b8561
commit
b4131a3a72
|
@ -32,10 +32,21 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
processEventFnWithOffset := pb.AddOffsetFunc(eachEntryFunc, 3*time.Second, func(counter int64, lastTsNs int64) error {
|
processor := NewMetadataProcessor(eachEntryFunc, 128)
|
||||||
lastTime := time.Unix(0, lastTsNs)
|
|
||||||
glog.V(0).Infof("remote sync %s progressed to %v %0.2f/sec", *option.filerAddress, lastTime, float64(counter)/float64(3))
|
var lastLogTsNs = time.Now().UnixNano()
|
||||||
return remote_storage.SetSyncOffset(option.grpcDialOption, pb.ServerAddress(*option.filerAddress), mountedDir, lastTsNs)
|
processEventFnWithOffset := pb.AddOffsetFunc(func(resp *filer_pb.SubscribeMetadataResponse) error {
|
||||||
|
processor.AddSyncJob(resp)
|
||||||
|
return nil
|
||||||
|
}, 3*time.Second, func(counter int64, lastTsNs int64) error {
|
||||||
|
if processor.processedTsWatermark == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
// use processor.processedTsWatermark instead of the lastTsNs from the most recent job
|
||||||
|
now := time.Now().UnixNano()
|
||||||
|
glog.V(0).Infof("remote sync %s progressed to %v %0.2f/sec", *option.filerAddress, time.Unix(0, processor.processedTsWatermark), float64(counter)/(float64(now-lastLogTsNs)/1e9))
|
||||||
|
lastLogTsNs = now
|
||||||
|
return remote_storage.SetSyncOffset(option.grpcDialOption, pb.ServerAddress(*option.filerAddress), mountedDir, processor.processedTsWatermark)
|
||||||
})
|
})
|
||||||
|
|
||||||
lastOffsetTs := collectLastSyncOffset(option, option.grpcDialOption, pb.ServerAddress(*option.filerAddress), mountedDir, *option.timeAgo)
|
lastOffsetTs := collectLastSyncOffset(option, option.grpcDialOption, pb.ServerAddress(*option.filerAddress), mountedDir, *option.timeAgo)
|
||||||
|
|
Loading…
Reference in a new issue