cos/put: make chunk small to not block other reqs

This commit is contained in:
Minglei Jin 2023-10-20 15:15:03 +08:00
parent f016dab40a
commit 55647f9ce9
1 changed files with 7 additions and 8 deletions

View File

@ -499,9 +499,8 @@ int32_t s3PutObjectFromFile2(const char *file, const char *object) {
// div round up // div round up
int seq; int seq;
// uint64_t chunk_size = MULTIPART_CHUNK_SIZE >> 8; uint64_t chunk_size = MULTIPART_CHUNK_SIZE >> 8;
int totalSeq = ((contentLength + MULTIPART_CHUNK_SIZE - 1) / MULTIPART_CHUNK_SIZE); int totalSeq = ((contentLength + chunk_size - 1) / chunk_size);
// int totalSeq = ((contentLength + chunk_size - 1) / chunk_size);
MultipartPartData partData; MultipartPartData partData;
memset(&partData, 0, sizeof(MultipartPartData)); memset(&partData, 0, sizeof(MultipartPartData));
@ -543,14 +542,14 @@ int32_t s3PutObjectFromFile2(const char *file, const char *object) {
} }
upload: upload:
todoContentLength -= MULTIPART_CHUNK_SIZE * manager.next_etags_pos; todoContentLength -= chunk_size * manager.next_etags_pos;
for (seq = manager.next_etags_pos + 1; seq <= totalSeq; seq++) { for (seq = manager.next_etags_pos + 1; seq <= totalSeq; seq++) {
partData.manager = &manager; partData.manager = &manager;
partData.seq = seq; partData.seq = seq;
if (partData.put_object_data.gb == NULL) { if (partData.put_object_data.gb == NULL) {
partData.put_object_data = data; partData.put_object_data = data;
} }
partContentLength = ((contentLength > MULTIPART_CHUNK_SIZE) ? MULTIPART_CHUNK_SIZE : contentLength); partContentLength = ((contentLength > chunk_size) ? chunk_size : contentLength);
// printf("%s Part Seq %d, length=%d\n", srcSize ? "Copying" : "Sending", seq, partContentLength); // printf("%s Part Seq %d, length=%d\n", srcSize ? "Copying" : "Sending", seq, partContentLength);
partData.put_object_data.contentLength = partContentLength; partData.put_object_data.contentLength = partContentLength;
partData.put_object_data.originalContentLength = partContentLength; partData.put_object_data.originalContentLength = partContentLength;
@ -566,8 +565,8 @@ int32_t s3PutObjectFromFile2(const char *file, const char *object) {
code = TAOS_SYSTEM_ERROR(EIO); code = TAOS_SYSTEM_ERROR(EIO);
goto clean; goto clean;
} }
contentLength -= MULTIPART_CHUNK_SIZE; contentLength -= chunk_size;
todoContentLength -= MULTIPART_CHUNK_SIZE; todoContentLength -= chunk_size;
} }
int i; int i;