Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

operations: don't buffer when a backend implements OpenWriterAt

Nick Craig-Wood2f424ceecfbb
diff --git a/fs/operations/multithread.go b/fs/operations/multithread.go
index 8cb78dc0a..a780bfd15 100644
--- a/fs/operations/multithread.go
+++ b/fs/operations/multithread.go
@@ -135,12 +135,15 @@ func calculateNumChunks(size int64, chunkSize int64) int {
func multiThreadCopy(ctx context.Context, f fs.Fs, remote string, src fs.Object, streams int, tr *accounting.Transfer) (newDst fs.Object, err error) {
openChunkWriter := f.Features().OpenChunkWriter
ci := fs.GetConfig(ctx)
+ noseek := false
if openChunkWriter == nil {
openWriterAt := f.Features().OpenWriterAt
if openWriterAt == nil {
return nil, errors.New("multi-thread copy: neither OpenChunkWriter nor OpenWriterAt supported")
}
openChunkWriter = openChunkWriterFromOpenWriterAt(openWriterAt, int64(ci.MultiThreadChunkSize), int64(ci.MultiThreadWriteBufferSize), f)
+ // We don't seek the chunks with OpenWriterAt
+ noseek = true
}
if src.Size() < 0 {
@@ -184,7 +187,7 @@ func multiThreadCopy(ctx context.Context, f fs.Fs, remote string, src fs.Object,
partSize: chunkSize,
streams: streams,
numChunks: numChunks,
- noSeek: f.Features().PartialUploads,
+ noSeek: noseek,
}
// Make accounting