rgw: fix multipart min part size

As part of the fix for wip-7169 it turned out that we removed
min_part_size. Looking back, the original implementation was broken
anyway and didn't do anything. This fixes it and makes it configurable.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
This commit is contained in:
Yehuda Sadeh 2014-01-27 14:11:43 -08:00
parent 2e7bd83f99
commit 11cf9bbb29
3 changed files with 14 additions and 5 deletions

View File

@ -766,6 +766,8 @@ OPTION(rgw_user_quota_sync_interval, OPT_INT, 3600 * 24) // time period for accu
OPTION(rgw_user_quota_sync_idle_users, OPT_BOOL, false) // whether stats for idle users be fully synced
OPTION(rgw_user_quota_sync_wait_time, OPT_INT, 3600 * 24) // min time between two full stats syc for non-idle users
OPTION(rgw_multipart_min_part_size, OPT_INT, 5 * 1024 * 1024) // min size for each part (except for last one) in multipart upload
OPTION(mutex_perf_counter, OPT_BOOL, false) // enable/disable mutex perf counter
// This will be set to true when it is safe to start threads.

View File

@ -2549,10 +2549,13 @@ void RGWCompleteMultipart::execute()
meta_oid = mp.get_meta();
int total_parts = 0;
int handled_parts = 0;
int max_parts = 1000;
int marker = 0;
bool truncated;
uint64_t min_part_size = s->cct->_conf->rgw_multipart_min_part_size;
list<string> remove_objs; /* objects to be removed from index listing */
iter = parts->parts.begin();
@ -2571,7 +2574,14 @@ void RGWCompleteMultipart::execute()
return;
}
for (obj_iter = obj_parts.begin(); iter != parts->parts.end() && obj_iter != obj_parts.end(); ++iter, ++obj_iter) {
for (obj_iter = obj_parts.begin(); iter != parts->parts.end() && obj_iter != obj_parts.end(); ++iter, ++obj_iter, ++handled_parts) {
uint64_t part_size = obj_iter->second.size;
if (handled_parts < (int)parts->parts.size() - 1 &&
part_size < min_part_size) {
ret = -ERR_TOO_SMALL;
return;
}
char etag[CEPH_CRYPTO_MD5_DIGESTSIZE];
if (iter->first != (int)obj_iter->first) {
ldout(s->cct, 0) << "NOTICE: parts num mismatch: next requested: " << iter->first << " next uploaded: " << obj_iter->first << dendl;
@ -2600,7 +2610,7 @@ void RGWCompleteMultipart::execute()
part.loc = src_obj;
part.loc_ofs = 0;
part.size = obj_iter->second.size;
part.size = part_size;
} else {
manifest.append(obj_part.manifest);
}

View File

@ -672,15 +672,12 @@ protected:
string etag;
char *data;
int len;
uint64_t min_part_size;
public:
RGWCompleteMultipart() {
ret = 0;
data = NULL;
len = 0;
// min_part_size = RGW_MIN_MULTIPART_SIZE;
min_part_size = 0;
}
virtual ~RGWCompleteMultipart() {
free(data);