fix(upload): set concurrent chunk upload to 1 when disk pre-allocation is disabled

pull/3501/head
Darren Yu 2 weeks ago
parent 0bb0ab8335
commit 304c3480df
No known key found for this signature in database
GPG Key ID: 2D69AA5646405984

@ -226,6 +226,10 @@ func (handler *Driver) Token(ctx context.Context, uploadSession *fs.UploadSessio
if err := Fallocate(f, 0, uploadSession.Props.Size); err != nil {
handler.l.Warning("Failed to preallocate file: %s", err)
}
} else {
// When disk pre-allocation is disabled, concurrent chunk uploads must be 1
// to avoid disk fragmentation and write contention on local storage.
handler.Policy.Settings.ChunkConcurrency = 1
}
return &fs.UploadCredential{

@ -150,6 +150,12 @@ func (handler *Driver) Token(ctx context.Context, uploadSession *fs.UploadSessio
return nil, fmt.Errorf("failed to sign upload url: %w", err)
}
// When disk pre-allocation is disabled, concurrent chunk uploads must be 1
// to avoid disk fragmentation and write contention on slave storage.
if !handler.Policy.Settings.PreAllocate {
handler.Policy.Settings.ChunkConcurrency = 1
}
return &fs.UploadCredential{
SessionID: uploadSession.Props.UploadSessionID,
ChunkSize: handler.Policy.Settings.ChunkSize,

Loading…
Cancel
Save