mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-14 16:34:09 +00:00
fix mixupload return EntityTooSmall while a copypart is less than 5MB after split (#1809)
* fix mixupload return EntityTooSmall while a copypart is less than 5MB after split * fix possible part exceeds 5GB when multipart_copy_size is set to 5120MB * Update curl.cpp Co-authored-by: liubingrun <liubr1@chinatelecom.cn>
This commit is contained in:
parent
07e2e3f72a
commit
85ca2a3e45
15
src/curl.cpp
15
src/curl.cpp
@ -1453,10 +1453,21 @@ int S3fsCurl::ParallelMixMultipartUploadRequest(const char* tpath, headers_t& me
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// Multipart copy
|
// Multipart copy
|
||||||
for(off_t i = 0; i < iter->bytes; i += GetMultipartCopySize()){
|
for(off_t i = 0, bytes = 0; i < iter->bytes; i += bytes){
|
||||||
S3fsCurl* s3fscurl_para = new S3fsCurl(true);
|
S3fsCurl* s3fscurl_para = new S3fsCurl(true);
|
||||||
|
|
||||||
off_t bytes = std::min(static_cast<off_t>(GetMultipartCopySize()), iter->bytes - i);
|
bytes = std::min(static_cast<off_t>(GetMultipartCopySize()), iter->bytes - i);
|
||||||
|
/* every part should be larger than MIN_MULTIPART_SIZE and smaller than FIVE_GB */
|
||||||
|
off_t remain_bytes = iter->bytes - i - bytes;
|
||||||
|
|
||||||
|
if ((MIN_MULTIPART_SIZE > remain_bytes) && (0 < remain_bytes)){
|
||||||
|
if(FIVE_GB < (bytes + remain_bytes)){
|
||||||
|
bytes = (bytes + remain_bytes)/2;
|
||||||
|
} else{
|
||||||
|
bytes += remain_bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::ostringstream strrange;
|
std::ostringstream strrange;
|
||||||
strrange << "bytes=" << (iter->offset + i) << "-" << (iter->offset + i + bytes - 1);
|
strrange << "bytes=" << (iter->offset + i) << "-" << (iter->offset + i + bytes - 1);
|
||||||
meta["x-amz-copy-source-range"] = strrange.str();
|
meta["x-amz-copy-source-range"] = strrange.str();
|
||||||
|
Loading…
Reference in New Issue
Block a user