Skip to content

Commit a06df7a

Browse files
committed
protondrive: fix corrupted uploads after a retried upload error - fixes #9722
When an upload failed part way through with a retryable error (eg a 502 from the block storage servers) the pacer retried the whole upload call with the same input stream. The stream had already been partially consumed, so the retry re-created the upload draft and committed just the remainder of the stream as a complete file, silently truncating it. With restic over serve restic this corrupted the repository as the truncated pack was reported as successfully uploaded. This fixes it by using CallNoRetry for the upload, as the other backends do, so retryable errors are returned wrapped in a RetryError for the caller to retry the upload with a fresh stream.
1 parent 9b13247 commit a06df7a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎backend/protondrive/protondrive.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
11141114
modTime := src.ModTime(ctx)
11151115
var linkID string
11161116
var fileSystemAttrs *proton.RevisionXAttrCommon
1117-
if err = o.fs.pacer.Call(func() (bool, error) {
1117+
if err = o.fs.pacer.CallNoRetry(func() (bool, error) {
11181118
linkID, fileSystemAttrs, err = o.fs.protonDrive.UploadFileByReader(ctx, folderLinkID, leaf, modTime, in, 0)
11191119
return shouldRetry(ctx, err)
11201120
}); err != nil {

0 commit comments

Comments
 (0)