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

cache: try a full read on the last chunk for #1896

remusb829dd1ad25d3
diff --git a/cache/handle.go b/cache/handle.go
index c24295fec..747afb7c8 100644
--- a/cache/handle.go
+++ b/cache/handle.go
@@ -427,9 +427,10 @@ func (w *worker) run() {
}
chunkEnd := chunkStart + w.r.cacheFs().chunkSize
- if chunkEnd > w.r.cachedObject.Size() {
- chunkEnd = w.r.cachedObject.Size()
- }
+ // TODO: Remove this comment if it proves to be reliable for #1896
+ //if chunkEnd > w.r.cachedObject.Size() {
+ // chunkEnd = w.r.cachedObject.Size()
+ //}
w.download(chunkStart, chunkEnd, 0)
}
@@ -464,11 +465,12 @@ func (w *worker) download(chunkStart, chunkEnd int64, retry int) {
w.download(chunkStart, chunkEnd, retry+1)
return
}
+ data = data[:sourceRead] // reslice to remove extra garbage
if err == io.ErrUnexpectedEOF {
- fs.Debugf(w, "partial read chunk %v: %v", chunkStart, err)
+ fs.Debugf(w, "partial downloaded chunk %v", fs.SizeSuffix(chunkStart))
+ } else {
+ fs.Debugf(w, "downloaded chunk %v", fs.SizeSuffix(chunkStart))
}
- data = data[:sourceRead] // reslice to remove extra garbage
- fs.Debugf(w, "downloaded chunk %v", fs.SizeSuffix(chunkStart))
if w.r.UseMemory {
err = w.r.memory.AddChunk(w.r.cachedObject.abs(), data, chunkStart)